Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test rust-analyzer in CI #99444

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,7 @@ impl<'a> Builder<'a> {
test::Cargotest,
test::Cargo,
test::Rls,
test::RustAnalyzer,
test::ErrorIndex,
test::Distcheck,
test::RunMakeFullDeps,
Expand Down
54 changes: 54 additions & 0 deletions src/bootstrap/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,60 @@ impl Step for Rls {
}
}

#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct RustAnalyzer {
stage: u32,
host: TargetSelection,
}

impl Step for RustAnalyzer {
type Output = ();
const ONLY_HOSTS: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.path("src/tools/rust-analyzer")
}

fn make_run(run: RunConfig<'_>) {
run.builder.ensure(Self { stage: run.builder.top_stage, host: run.target });
}

/// Runs `cargo test` for rust-analyzer.
fn run(self, builder: &Builder<'_>) {
let stage = self.stage;
let host = self.host;
let compiler = builder.compiler(stage, host);

let build_result = builder.ensure(tool::RustAnalyzer {
compiler,
target: self.host,
extra_features: Vec::new(),
});
if build_result.is_none() {
eprintln!("failed to test rust-analyzer: could not build");
return;
}

let mut cargo = tool::prepare_tool_cargo(
builder,
compiler,
Mode::ToolRustc,
host,
"test",
"src/tools/rust-analyzer",
SourceType::Submodule,
&[],
);

cargo.add_rustc_lib_path(builder, compiler);
cargo.arg("--").args(builder.config.cmd.test_args());

if try_run(builder, &mut cargo.into()) {
builder.save_toolstate("rust-analyzer", ToolState::TestPass);
}
}
}

#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct Rustfmt {
stage: u32,
Expand Down
1 change: 1 addition & 0 deletions src/ci/docker/host-x86_64/x86_64-gnu-tools/checktools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ python3 "$X_PY" test --stage 2 --no-fail-fast \
src/doc/embedded-book \
src/doc/edition-guide \
src/tools/rls \
src/tools/rust-analyzer \
src/tools/miri \

set -e
Expand Down