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