Skip to content

Commit bbfdd24

Browse files
committed
bootstrap: run full rust-analyzer tests
1 parent 1cb8c3c commit bbfdd24

File tree

2 files changed

+36
-15
lines changed

2 files changed

+36
-15
lines changed

src/bootstrap/src/core/build_steps/test.rs

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -446,35 +446,54 @@ 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();
452+
453+
let test_compiler = self.compilers.target();
450454

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";
455455
let mut cargo = tool::prepare_tool_cargo(
456456
builder,
457-
self.compilers.build_compiler(),
457+
build_compiler,
458458
Mode::ToolRustcPrivate,
459-
host,
459+
target,
460460
Kind::Test,
461-
crate_path,
461+
"src/tools/rust-analyzer",
462462
SourceType::InTree,
463463
&["in-rust-tree".to_owned()],
464464
);
465465
cargo.allow_features(tool::RustAnalyzer::ALLOW_FEATURES);
466466

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);
467+
// N.B. it turns out _setting_ `CARGO_WORKSPACE_DIR` actually somehow breaks `expect-test`,
468+
// even though previously we actually needed to set that hack to allow `expect-test` to
469+
// correctly discover the r-a workspace instead of the outer r-l/r workspace.
471470

472-
// RA's test suite tries to write to the source directory, that can't
473-
// work in Rust CI
471+
// FIXME: RA's test suite tries to write to the source directory, that can't work in Rust CI
472+
// without properly wiring up the writable test dir.
474473
cargo.env("SKIP_SLOW_TESTS", "1");
475474

475+
// NOTE: we need to skip `src/tools/rust-analyzer/xtask` as they seem to exercise rustup /
476+
// stable rustfmt.
477+
//
478+
// NOTE: you can only skip a specific workspace package via `--skip=...` if you *also*
479+
// specify `--workspace`.
480+
cargo.arg("--workspace");
481+
cargo.arg("--exclude=xtask");
482+
483+
let mut skip_tests = vec![];
484+
485+
// Across all platforms
486+
skip_tests.extend_from_slice(&[
487+
// FIXME: this test wants to find a `rustc`. We need to provide it with a path to staged
488+
// in-tree `rustc`, but setting `RUSTC` env var requires some reworking of bootstrap.
489+
"tests::smoke_test_real_sysroot_cargo",
490+
]);
491+
492+
let skip_tests = skip_tests.iter().map(|name| format!("--skip={name}")).collect::<Vec<_>>();
493+
let skip_tests = skip_tests.iter().map(|s| s.as_str()).collect::<Vec<_>>();
494+
476495
cargo.add_rustc_lib_path(builder);
477-
run_cargo_test(cargo, &[], &[], "rust-analyzer", host, builder);
496+
run_cargo_test(cargo, skip_tests.as_slice(), &[], "rust-analyzer", test_compiler, builder);
478497
}
479498

480499
fn metadata(&self) -> Option<StepMetadata> {

src/bootstrap/src/core/builder/tests.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2112,6 +2112,7 @@ mod snapshot {
21122112
[build] rustc 0 <host> -> Linkchecker 1 <host>
21132113
[test] link-check <host>
21142114
[test] tier-check <host>
2115+
[build] rustc 0 <host> -> rust-analyzer 1 <host>
21152116
[test] rustc 0 <host> -> rust-analyzer 1 <host>
21162117
[build] rustc 0 <host> -> RustdocTheme 1 <host>
21172118
[test] rustdoc-theme 1 <host>
@@ -2296,6 +2297,7 @@ mod snapshot {
22962297
[build] rustc 0 <host> -> Linkchecker 1 <host>
22972298
[test] link-check <host>
22982299
[test] tier-check <host>
2300+
[build] rustc 1 <host> -> rust-analyzer 2 <host>
22992301
[test] rustc 1 <host> -> rust-analyzer 2 <host>
23002302
[doc] rustc (book) <host>
23012303
[test] rustc 1 <host> -> lint-docs 2 <host>

0 commit comments

Comments
 (0)