aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/ci.yaml8
-rw-r--r--crates/ra_lsp_server/tests/heavy_tests/main.rs38
-rw-r--r--crates/test_utils/src/lib.rs11
3 files changed, 54 insertions, 3 deletions
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 5bc41533c..cb397ae14 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -14,6 +14,7 @@ jobs:
14 env: 14 env:
15 RUSTFLAGS: -D warnings 15 RUSTFLAGS: -D warnings
16 CARGO_INCREMENTAL: 0 16 CARGO_INCREMENTAL: 0
17 RUN_SLOW_TESTS: 1
17 steps: 18 steps:
18 19
19 - name: Checkout repository 20 - name: Checkout repository
@@ -46,9 +47,10 @@ jobs:
46 47
47 - name: Prepare build directory for cache 48 - name: Prepare build directory for cache
48 run: | 49 run: |
49 find ./target/debug -maxdepth 1 -type f -delete && \ 50 find ./target/debug -maxdepth 1 -type f -delete \
50 rm -fr ./target/debug/{deps,.fingerprint}/{*ra_*,*heavy_test*,*gen_lsp*,*thread_worker*} && \ 51 && rm -fr ./target/debug/{deps,.fingerprint}/{*ra_*,*heavy_test*,*gen_lsp*,*thread_worker*} \
51 rm -f ./target/.rustc_info.json 52 && rm -f ./target/.rustc_info.json \
53 && rm ./target/.slow_tests_cookie
52 54
53 type-script: 55 type-script:
54 name: TypeScript 56 name: TypeScript
diff --git a/crates/ra_lsp_server/tests/heavy_tests/main.rs b/crates/ra_lsp_server/tests/heavy_tests/main.rs
index fec50bd25..cfbf16ea5 100644
--- a/crates/ra_lsp_server/tests/heavy_tests/main.rs
+++ b/crates/ra_lsp_server/tests/heavy_tests/main.rs
@@ -12,6 +12,7 @@ use ra_lsp_server::req::{
12}; 12};
13use serde_json::json; 13use serde_json::json;
14use tempfile::TempDir; 14use tempfile::TempDir;
15use test_utils::skip_slow_tests;
15 16
16use crate::support::{project, Project}; 17use crate::support::{project, Project};
17 18
@@ -20,6 +21,10 @@ const PROFILE: &'static str = "";
20 21
21#[test] 22#[test]
22fn completes_items_from_standard_library() { 23fn completes_items_from_standard_library() {
24 if skip_slow_tests() {
25 return;
26 }
27
23 let project_start = Instant::now(); 28 let project_start = Instant::now();
24 let server = Project::with_fixture( 29 let server = Project::with_fixture(
25 r#" 30 r#"
@@ -50,6 +55,10 @@ use std::collections::Spam;
50 55
51#[test] 56#[test]
52fn test_runnables_no_project() { 57fn test_runnables_no_project() {
58 if skip_slow_tests() {
59 return;
60 }
61
53 let server = project( 62 let server = project(
54 r" 63 r"
55//- lib.rs 64//- lib.rs
@@ -99,6 +108,10 @@ fn foo() {
99 108
100#[test] 109#[test]
101fn test_runnables_project() { 110fn test_runnables_project() {
111 if skip_slow_tests() {
112 return;
113 }
114
102 let code = r#" 115 let code = r#"
103//- foo/Cargo.toml 116//- foo/Cargo.toml
104[package] 117[package]
@@ -170,6 +183,10 @@ fn main() {}
170 183
171#[test] 184#[test]
172fn test_format_document() { 185fn test_format_document() {
186 if skip_slow_tests() {
187 return;
188 }
189
173 let server = project( 190 let server = project(
174 r#" 191 r#"
175//- Cargo.toml 192//- Cargo.toml
@@ -222,6 +239,10 @@ pub use std::collections::HashMap;
222 239
223#[test] 240#[test]
224fn test_format_document_2018() { 241fn test_format_document_2018() {
242 if skip_slow_tests() {
243 return;
244 }
245
225 let server = project( 246 let server = project(
226 r#" 247 r#"
227//- Cargo.toml 248//- Cargo.toml
@@ -277,8 +298,13 @@ pub use std::collections::HashMap;
277 ]), 298 ]),
278 ); 299 );
279} 300}
301
280#[test] 302#[test]
281fn test_missing_module_code_action() { 303fn test_missing_module_code_action() {
304 if skip_slow_tests() {
305 return;
306 }
307
282 let server = project( 308 let server = project(
283 r#" 309 r#"
284//- Cargo.toml 310//- Cargo.toml
@@ -337,6 +363,10 @@ fn main() {}
337 363
338#[test] 364#[test]
339fn test_missing_module_code_action_in_json_project() { 365fn test_missing_module_code_action_in_json_project() {
366 if skip_slow_tests() {
367 return;
368 }
369
340 let tmp_dir = TempDir::new().unwrap(); 370 let tmp_dir = TempDir::new().unwrap();
341 371
342 let path = tmp_dir.path(); 372 let path = tmp_dir.path();
@@ -412,6 +442,10 @@ fn main() {{}}
412 442
413#[test] 443#[test]
414fn diagnostics_dont_block_typing() { 444fn diagnostics_dont_block_typing() {
445 if skip_slow_tests() {
446 return;
447 }
448
415 let librs: String = (0..10).map(|i| format!("mod m{};", i)).collect(); 449 let librs: String = (0..10).map(|i| format!("mod m{};", i)).collect();
416 let libs: String = (0..10).map(|i| format!("//- src/m{}.rs\nfn foo() {{}}\n\n", i)).collect(); 450 let libs: String = (0..10).map(|i| format!("//- src/m{}.rs\nfn foo() {{}}\n\n", i)).collect();
417 let server = Project::with_fixture(&format!( 451 let server = Project::with_fixture(&format!(
@@ -480,6 +514,10 @@ fn main() {{}}
480 514
481#[test] 515#[test]
482fn preserves_dos_line_endings() { 516fn preserves_dos_line_endings() {
517 if skip_slow_tests() {
518 return;
519 }
520
483 let server = Project::with_fixture( 521 let server = Project::with_fixture(
484 &" 522 &"
485//- Cargo.toml 523//- Cargo.toml
diff --git a/crates/test_utils/src/lib.rs b/crates/test_utils/src/lib.rs
index 1244ea8cf..657ddf2a6 100644
--- a/crates/test_utils/src/lib.rs
+++ b/crates/test_utils/src/lib.rs
@@ -356,6 +356,17 @@ pub fn read_text(path: &Path) -> String {
356 .replace("\r\n", "\n") 356 .replace("\r\n", "\n")
357} 357}
358 358
359pub fn skip_slow_tests() -> bool {
360 let should_skip = std::env::var("CI").is_err() && std::env::var("RUN_SLOW_TESTS").is_err();
361 if should_skip {
362 eprintln!("ignoring slow test")
363 } else {
364 let path = project_dir().join("./target/.slow_tests_cookie");
365 fs::write(&path, ".").unwrap();
366 }
367 should_skip
368}
369
359const REWRITE: bool = false; 370const REWRITE: bool = false;
360 371
361fn assert_equal_text(expected: &str, actual: &str, path: &Path) { 372fn assert_equal_text(expected: &str, actual: &str, path: &Path) {