@@ -445,35 +445,52 @@ impl Step for RustAnalyzer {
445445
446446 /// Runs `cargo test` for rust-analyzer
447447 fn run ( self , builder : & Builder < ' _ > ) {
448- let host = self . compilers . target ( ) ;
448+ let tool_result = builder. ensure ( tool:: RustAnalyzer :: from_compilers ( self . compilers ) ) ;
449+ let build_compiler = tool_result. build_compiler ;
450+ let target = self . compilers . target ( ) ;
449451
450- let workspace_path = "src/tools/rust-analyzer" ;
451- // until the whole RA test suite runs on `i686`, we only run
452- // `proc-macro-srv` tests
453- let crate_path = "src/tools/rust-analyzer/crates/proc-macro-srv" ;
454452 let mut cargo = tool:: prepare_tool_cargo (
455453 builder,
456- self . compilers . build_compiler ( ) ,
454+ build_compiler,
457455 Mode :: ToolRustcPrivate ,
458- host ,
456+ target ,
459457 Kind :: Test ,
460- crate_path ,
458+ "src/tools/rust-analyzer" ,
461459 SourceType :: InTree ,
462460 & [ "in-rust-tree" . to_owned ( ) ] ,
463461 ) ;
464462 cargo. allow_features ( tool:: RustAnalyzer :: ALLOW_FEATURES ) ;
465463
466- let dir = builder. src . join ( workspace_path) ;
467- // needed by rust-analyzer to find its own text fixtures, cf.
468- // https://github.com/rust-analyzer/expect-test/issues/33
469- cargo. env ( "CARGO_WORKSPACE_DIR" , & dir) ;
464+ // N.B. it turns out _setting_ `CARGO_WORKSPACE_DIR` actually somehow breaks `expect-test`,
465+ // even though previously we actually needed to set that hack to allow `expect-test` to
466+ // correctly discover the r-a workspace instead of the outer r-l/r workspace.
470467
471- // RA's test suite tries to write to the source directory, that can't
472- // work in Rust CI
468+ // FIXME: RA's test suite tries to write to the source directory, that can't work in Rust CI
469+ // without properly wiring up the writable test dir.
473470 cargo. env ( "SKIP_SLOW_TESTS" , "1" ) ;
474471
472+ // NOTE: we need to skip `src/tools/rust-analyzer/xtask` as they seem to exercise rustup /
473+ // stable rustfmt.
474+ //
475+ // NOTE: you can only skip a specific workspace package via `--exclude=...` if you *also*
476+ // specify `--workspace`.
477+ cargo. arg ( "--workspace" ) ;
478+ cargo. arg ( "--exclude=xtask" ) ;
479+
480+ let mut skip_tests = vec ! [ ] ;
481+
482+ // Across all platforms
483+ skip_tests. extend_from_slice ( & [
484+ // FIXME: this test wants to find a `rustc`. We need to provide it with a path to staged
485+ // in-tree `rustc`, but setting `RUSTC` env var requires some reworking of bootstrap.
486+ "tests::smoke_test_real_sysroot_cargo" ,
487+ ] ) ;
488+
489+ let skip_tests = skip_tests. iter ( ) . map ( |name| format ! ( "--skip={name}" ) ) . collect :: < Vec < _ > > ( ) ;
490+ let skip_tests = skip_tests. iter ( ) . map ( |s| s. as_str ( ) ) . collect :: < Vec < _ > > ( ) ;
491+
475492 cargo. add_rustc_lib_path ( builder) ;
476- run_cargo_test ( cargo, & [ ] , & [ ] , "rust-analyzer" , host , builder) ;
493+ run_cargo_test ( cargo, skip_tests . as_slice ( ) , & [ ] , "rust-analyzer" , target , builder) ;
477494 }
478495
479496 fn metadata ( & self ) -> Option < StepMetadata > {
0 commit comments