@@ -465,35 +465,60 @@ impl Step for RustAnalyzer {
465465
466466 /// Runs `cargo test` for rust-analyzer
467467 fn run ( self , builder : & Builder < ' _ > ) {
468- let host = self . compilers . target ( ) ;
468+ let build_compiler = self . compilers . build_compiler ( ) ;
469+ let target = self . compilers . target ( ) ;
469470
470- let workspace_path = "src/tools/rust-analyzer" ;
471- // until the whole RA test suite runs on `i686`, we only run
472- // `proc-macro-srv` tests
473- let crate_path = "src/tools/rust-analyzer/crates/proc-macro-srv" ;
474471 let mut cargo = tool:: prepare_tool_cargo (
475472 builder,
476- self . compilers . build_compiler ( ) ,
473+ build_compiler,
477474 Mode :: ToolRustcPrivate ,
478- host ,
475+ target ,
479476 Kind :: Test ,
480- crate_path ,
477+ "src/tools/rust-analyzer" ,
481478 SourceType :: InTree ,
482479 & [ "in-rust-tree" . to_owned ( ) ] ,
483480 ) ;
484481 cargo. allow_features ( tool:: RustAnalyzer :: ALLOW_FEATURES ) ;
485482
486- let dir = builder. src . join ( workspace_path) ;
487- // needed by rust-analyzer to find its own text fixtures, cf.
488- // https://github.com/rust-analyzer/expect-test/issues/33
489- cargo. env ( "CARGO_WORKSPACE_DIR" , & dir) ;
483+ // N.B. it turns out _setting_ `CARGO_WORKSPACE_DIR` actually somehow breaks `expect-test`,
484+ // even though previously we actually needed to set that hack to allow `expect-test` to
485+ // correctly discover the r-a workspace instead of the outer r-l/r workspace.
490486
491- // RA's test suite tries to write to the source directory, that can't
492- // work in Rust CI
487+ // FIXME: RA's test suite tries to write to the source directory, that can't work in Rust CI
488+ // without properly wiring up the writable test dir.
493489 cargo. env ( "SKIP_SLOW_TESTS" , "1" ) ;
494490
491+ // NOTE: we need to skip `src/tools/rust-analyzer/xtask` as they seem to exercise rustup /
492+ // stable rustfmt.
493+ //
494+ // NOTE: you can only skip a specific workspace package via `--exclude=...` if you *also*
495+ // specify `--workspace`.
496+ cargo. arg ( "--workspace" ) ;
497+ cargo. arg ( "--exclude=xtask" ) ;
498+
499+ let mut skip_tests = vec ! [ ] ;
500+
501+ // NOTE: the following test skips is a bit cheeky in that it assumes there are no
502+ // identically named tests across different r-a packages, where we want to run the
503+ // identically named test in one package but not another. If we want to support that use
504+ // case, we'd have to run the r-a tests in two batches (with one excluding the package that
505+ // we *don't* want to run the test for, and the other batch including).
506+
507+ // Across all platforms.
508+ skip_tests. extend_from_slice ( & [
509+ // FIXME: this test wants to find a `rustc`. We need to provide it with a path to staged
510+ // in-tree `rustc`, but setting `RUSTC` env var requires some reworking of bootstrap.
511+ "tests::smoke_test_real_sysroot_cargo" ,
512+ // NOTE: part of `smol-str` test suite; this tries to access a stable rustfmt from the
513+ // environment, which is not something we want to do.
514+ "check_code_formatting" ,
515+ ] ) ;
516+
517+ let skip_tests = skip_tests. iter ( ) . map ( |name| format ! ( "--skip={name}" ) ) . collect :: < Vec < _ > > ( ) ;
518+ let skip_tests = skip_tests. iter ( ) . map ( |s| s. as_str ( ) ) . collect :: < Vec < _ > > ( ) ;
519+
495520 cargo. add_rustc_lib_path ( builder) ;
496- run_cargo_test ( cargo, & [ ] , & [ ] , "rust-analyzer" , host , builder) ;
521+ run_cargo_test ( cargo, skip_tests . as_slice ( ) , & [ ] , "rust-analyzer" , target , builder) ;
497522 }
498523
499524 fn metadata ( & self ) -> Option < StepMetadata > {
0 commit comments