mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +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:
|
env:
|
||||||
RUSTFLAGS: -D warnings
|
RUSTFLAGS: -D warnings
|
||||||
CARGO_INCREMENTAL: 0
|
CARGO_INCREMENTAL: 0
|
||||||
|
RUN_SLOW_TESTS: 1
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
|
@ -46,9 +47,10 @@ jobs:
|
||||||
|
|
||||||
- name: Prepare build directory for cache
|
- name: Prepare build directory for cache
|
||||||
run: |
|
run: |
|
||||||
find ./target/debug -maxdepth 1 -type f -delete && \
|
find ./target/debug -maxdepth 1 -type f -delete \
|
||||||
rm -fr ./target/debug/{deps,.fingerprint}/{*ra_*,*heavy_test*,*gen_lsp*,*thread_worker*} && \
|
&& rm -fr ./target/debug/{deps,.fingerprint}/{*ra_*,*heavy_test*,*gen_lsp*,*thread_worker*} \
|
||||||
rm -f ./target/.rustc_info.json
|
&& rm -f ./target/.rustc_info.json \
|
||||||
|
&& rm ./target/.slow_tests_cookie
|
||||||
|
|
||||||
type-script:
|
type-script:
|
||||||
name: TypeScript
|
name: TypeScript
|
||||||
|
|
|
@ -12,6 +12,7 @@ use ra_lsp_server::req::{
|
||||||
};
|
};
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
use tempfile::TempDir;
|
use tempfile::TempDir;
|
||||||
|
use test_utils::skip_slow_tests;
|
||||||
|
|
||||||
use crate::support::{project, Project};
|
use crate::support::{project, Project};
|
||||||
|
|
||||||
|
@ -20,6 +21,10 @@ const PROFILE: &'static str = "";
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn completes_items_from_standard_library() {
|
fn completes_items_from_standard_library() {
|
||||||
|
if skip_slow_tests() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let project_start = Instant::now();
|
let project_start = Instant::now();
|
||||||
let server = Project::with_fixture(
|
let server = Project::with_fixture(
|
||||||
r#"
|
r#"
|
||||||
|
@ -50,6 +55,10 @@ use std::collections::Spam;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_runnables_no_project() {
|
fn test_runnables_no_project() {
|
||||||
|
if skip_slow_tests() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let server = project(
|
let server = project(
|
||||||
r"
|
r"
|
||||||
//- lib.rs
|
//- lib.rs
|
||||||
|
@ -99,6 +108,10 @@ fn foo() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_runnables_project() {
|
fn test_runnables_project() {
|
||||||
|
if skip_slow_tests() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let code = r#"
|
let code = r#"
|
||||||
//- foo/Cargo.toml
|
//- foo/Cargo.toml
|
||||||
[package]
|
[package]
|
||||||
|
@ -170,6 +183,10 @@ fn main() {}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_format_document() {
|
fn test_format_document() {
|
||||||
|
if skip_slow_tests() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let server = project(
|
let server = project(
|
||||||
r#"
|
r#"
|
||||||
//- Cargo.toml
|
//- Cargo.toml
|
||||||
|
@ -222,6 +239,10 @@ pub use std::collections::HashMap;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_format_document_2018() {
|
fn test_format_document_2018() {
|
||||||
|
if skip_slow_tests() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let server = project(
|
let server = project(
|
||||||
r#"
|
r#"
|
||||||
//- Cargo.toml
|
//- Cargo.toml
|
||||||
|
@ -277,8 +298,13 @@ pub use std::collections::HashMap;
|
||||||
]),
|
]),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_missing_module_code_action() {
|
fn test_missing_module_code_action() {
|
||||||
|
if skip_slow_tests() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let server = project(
|
let server = project(
|
||||||
r#"
|
r#"
|
||||||
//- Cargo.toml
|
//- Cargo.toml
|
||||||
|
@ -337,6 +363,10 @@ fn main() {}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_missing_module_code_action_in_json_project() {
|
fn test_missing_module_code_action_in_json_project() {
|
||||||
|
if skip_slow_tests() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let tmp_dir = TempDir::new().unwrap();
|
let tmp_dir = TempDir::new().unwrap();
|
||||||
|
|
||||||
let path = tmp_dir.path();
|
let path = tmp_dir.path();
|
||||||
|
@ -412,6 +442,10 @@ fn main() {{}}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn diagnostics_dont_block_typing() {
|
fn diagnostics_dont_block_typing() {
|
||||||
|
if skip_slow_tests() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let librs: String = (0..10).map(|i| format!("mod m{};", i)).collect();
|
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 libs: String = (0..10).map(|i| format!("//- src/m{}.rs\nfn foo() {{}}\n\n", i)).collect();
|
||||||
let server = Project::with_fixture(&format!(
|
let server = Project::with_fixture(&format!(
|
||||||
|
@ -480,6 +514,10 @@ fn main() {{}}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn preserves_dos_line_endings() {
|
fn preserves_dos_line_endings() {
|
||||||
|
if skip_slow_tests() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let server = Project::with_fixture(
|
let server = Project::with_fixture(
|
||||||
&"
|
&"
|
||||||
//- Cargo.toml
|
//- Cargo.toml
|
||||||
|
|
|
@ -356,6 +356,17 @@ pub fn read_text(path: &Path) -> String {
|
||||||
.replace("\r\n", "\n")
|
.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;
|
const REWRITE: bool = false;
|
||||||
|
|
||||||
fn assert_equal_text(expected: &str, actual: &str, path: &Path) {
|
fn assert_equal_text(expected: &str, actual: &str, path: &Path) {
|
||||||
|
|
Loading…
Reference in a new issue