mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-25 12:33:33 +00:00
Skip slow tests by default
This commit is contained in:
parent
431836f4a0
commit
8ec5f2fcdc
3 changed files with 54 additions and 3 deletions
8
.github/workflows/ci.yaml
vendored
8
.github/workflows/ci.yaml
vendored
|
@ -14,6 +14,7 @@ jobs:
|
|||
env:
|
||||
RUSTFLAGS: -D warnings
|
||||
CARGO_INCREMENTAL: 0
|
||||
RUN_SLOW_TESTS: 1
|
||||
steps:
|
||||
|
||||
- name: Checkout repository
|
||||
|
@ -46,9 +47,10 @@ jobs:
|
|||
|
||||
- name: Prepare build directory for cache
|
||||
run: |
|
||||
find ./target/debug -maxdepth 1 -type f -delete && \
|
||||
rm -fr ./target/debug/{deps,.fingerprint}/{*ra_*,*heavy_test*,*gen_lsp*,*thread_worker*} && \
|
||||
rm -f ./target/.rustc_info.json
|
||||
find ./target/debug -maxdepth 1 -type f -delete \
|
||||
&& rm -fr ./target/debug/{deps,.fingerprint}/{*ra_*,*heavy_test*,*gen_lsp*,*thread_worker*} \
|
||||
&& rm -f ./target/.rustc_info.json \
|
||||
&& rm ./target/.slow_tests_cookie
|
||||
|
||||
type-script:
|
||||
name: TypeScript
|
||||
|
|
|
@ -12,6 +12,7 @@ use ra_lsp_server::req::{
|
|||
};
|
||||
use serde_json::json;
|
||||
use tempfile::TempDir;
|
||||
use test_utils::skip_slow_tests;
|
||||
|
||||
use crate::support::{project, Project};
|
||||
|
||||
|
@ -20,6 +21,10 @@ const PROFILE: &'static str = "";
|
|||
|
||||
#[test]
|
||||
fn completes_items_from_standard_library() {
|
||||
if skip_slow_tests() {
|
||||
return;
|
||||
}
|
||||
|
||||
let project_start = Instant::now();
|
||||
let server = Project::with_fixture(
|
||||
r#"
|
||||
|
@ -50,6 +55,10 @@ use std::collections::Spam;
|
|||
|
||||
#[test]
|
||||
fn test_runnables_no_project() {
|
||||
if skip_slow_tests() {
|
||||
return;
|
||||
}
|
||||
|
||||
let server = project(
|
||||
r"
|
||||
//- lib.rs
|
||||
|
@ -99,6 +108,10 @@ fn foo() {
|
|||
|
||||
#[test]
|
||||
fn test_runnables_project() {
|
||||
if skip_slow_tests() {
|
||||
return;
|
||||
}
|
||||
|
||||
let code = r#"
|
||||
//- foo/Cargo.toml
|
||||
[package]
|
||||
|
@ -170,6 +183,10 @@ fn main() {}
|
|||
|
||||
#[test]
|
||||
fn test_format_document() {
|
||||
if skip_slow_tests() {
|
||||
return;
|
||||
}
|
||||
|
||||
let server = project(
|
||||
r#"
|
||||
//- Cargo.toml
|
||||
|
@ -222,6 +239,10 @@ pub use std::collections::HashMap;
|
|||
|
||||
#[test]
|
||||
fn test_format_document_2018() {
|
||||
if skip_slow_tests() {
|
||||
return;
|
||||
}
|
||||
|
||||
let server = project(
|
||||
r#"
|
||||
//- Cargo.toml
|
||||
|
@ -277,8 +298,13 @@ pub use std::collections::HashMap;
|
|||
]),
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_missing_module_code_action() {
|
||||
if skip_slow_tests() {
|
||||
return;
|
||||
}
|
||||
|
||||
let server = project(
|
||||
r#"
|
||||
//- Cargo.toml
|
||||
|
@ -337,6 +363,10 @@ fn main() {}
|
|||
|
||||
#[test]
|
||||
fn test_missing_module_code_action_in_json_project() {
|
||||
if skip_slow_tests() {
|
||||
return;
|
||||
}
|
||||
|
||||
let tmp_dir = TempDir::new().unwrap();
|
||||
|
||||
let path = tmp_dir.path();
|
||||
|
@ -412,6 +442,10 @@ fn main() {{}}
|
|||
|
||||
#[test]
|
||||
fn diagnostics_dont_block_typing() {
|
||||
if skip_slow_tests() {
|
||||
return;
|
||||
}
|
||||
|
||||
let librs: String = (0..10).map(|i| format!("mod m{};", i)).collect();
|
||||
let libs: String = (0..10).map(|i| format!("//- src/m{}.rs\nfn foo() {{}}\n\n", i)).collect();
|
||||
let server = Project::with_fixture(&format!(
|
||||
|
@ -480,6 +514,10 @@ fn main() {{}}
|
|||
|
||||
#[test]
|
||||
fn preserves_dos_line_endings() {
|
||||
if skip_slow_tests() {
|
||||
return;
|
||||
}
|
||||
|
||||
let server = Project::with_fixture(
|
||||
&"
|
||||
//- Cargo.toml
|
||||
|
|
|
@ -356,6 +356,17 @@ pub fn read_text(path: &Path) -> String {
|
|||
.replace("\r\n", "\n")
|
||||
}
|
||||
|
||||
pub fn skip_slow_tests() -> bool {
|
||||
let should_skip = std::env::var("CI").is_err() && std::env::var("RUN_SLOW_TESTS").is_err();
|
||||
if should_skip {
|
||||
eprintln!("ignoring slow test")
|
||||
} else {
|
||||
let path = project_dir().join("./target/.slow_tests_cookie");
|
||||
fs::write(&path, ".").unwrap();
|
||||
}
|
||||
should_skip
|
||||
}
|
||||
|
||||
const REWRITE: bool = false;
|
||||
|
||||
fn assert_equal_text(expected: &str, actual: &str, path: &Path) {
|
||||
|
|
Loading…
Reference in a new issue