Skip to content

Commit d2840fa

Browse files
committed
implement check step for compiletest separately
Signed-off-by: onur-ozkan <[email protected]>
1 parent c830665 commit d2840fa

File tree

3 files changed

+67
-6
lines changed

3 files changed

+67
-6
lines changed

src/bootstrap/src/core/build_steps/check.rs

+63-4
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,69 @@ impl Step for RustAnalyzer {
369369
}
370370
}
371371

372+
/// Compiletest is implicitly "checked" when it gets built in order to run tests,
373+
/// so this is mainly for people working on compiletest to run locally.
374+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
375+
pub struct Compiletest {
376+
pub target: TargetSelection,
377+
}
378+
379+
impl Step for Compiletest {
380+
type Output = ();
381+
const ONLY_HOSTS: bool = true;
382+
const DEFAULT: bool = false;
383+
384+
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
385+
run.path("src/tools/compiletest")
386+
}
387+
388+
fn make_run(run: RunConfig<'_>) {
389+
run.builder.ensure(Compiletest { target: run.target });
390+
}
391+
392+
fn run(self, builder: &Builder<'_>) {
393+
let mode = if builder.config.compiletest_use_stage0_libtest {
394+
Mode::ToolBootstrap
395+
} else {
396+
Mode::ToolStd
397+
};
398+
399+
let compiler = builder.compiler(
400+
if mode == Mode::ToolBootstrap { 0 } else { builder.top_stage },
401+
builder.config.build,
402+
);
403+
404+
if mode != Mode::ToolBootstrap {
405+
builder.ensure(Rustc::new(self.target, builder));
406+
}
407+
408+
let mut cargo = prepare_tool_cargo(
409+
builder,
410+
compiler,
411+
mode,
412+
self.target,
413+
builder.kind,
414+
"src/tools/compiletest",
415+
SourceType::InTree,
416+
&[],
417+
);
418+
419+
cargo.allow_features("test");
420+
421+
// For ./x.py clippy, don't run with --all-targets because
422+
// linting tests and benchmarks can produce very noisy results
423+
if builder.kind != Kind::Clippy {
424+
cargo.arg("--all-targets");
425+
}
426+
427+
let stamp = BuildStamp::new(&builder.cargo_out(compiler, mode, self.target))
428+
.with_prefix("compiletest-check");
429+
430+
let _guard = builder.msg_check("compiletest artifacts", self.target);
431+
run_cargo(builder, cargo, builder.config.free_args.clone(), &stamp, vec![], true, false);
432+
}
433+
}
434+
372435
macro_rules! tool_check_step {
373436
(
374437
$name:ident {
@@ -464,7 +527,3 @@ tool_check_step!(Bootstrap { path: "src/bootstrap", default: false });
464527
// `run-make-support` will be built as part of suitable run-make compiletest test steps, but support
465528
// check to make it easier to work on.
466529
tool_check_step!(RunMakeSupport { path: "src/tools/run-make-support", default: false });
467-
468-
// Compiletest is implicitly "checked" when it gets built in order to run tests,
469-
// so this is mainly for people working on compiletest to run locally.
470-
tool_check_step!(Compiletest { path: "src/tools/compiletest", default: false });

src/bootstrap/src/core/build_steps/compile.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -2398,7 +2398,9 @@ pub fn run_cargo(
23982398
// Ok now we need to actually find all the files listed in `toplevel`. We've
23992399
// got a list of prefix/extensions and we basically just need to find the
24002400
// most recent file in the `deps` folder corresponding to each one.
2401-
let contents = t!(target_deps_dir.read_dir())
2401+
let contents = target_deps_dir
2402+
.read_dir()
2403+
.unwrap_or_else(|e| panic!("Couldn't read {}: {}", target_deps_dir.display(), e))
24022404
.map(|e| t!(e))
24032405
.map(|e| (e.path(), e.file_name().into_string().unwrap(), t!(e.metadata())))
24042406
.collect::<Vec<_>>();

src/llvm-project

Submodule llvm-project updated 106 files

0 commit comments

Comments
 (0)