Skip to content

Commit 5958447

Browse files
committed
Improve suggestion for UI test
- Suggest `src/test/ui` instead of the name of the source directory - Suggest `--test-args` if present Example output: ``` note: failed while building bootstrap::test::Compiletest help: to replicate this failure, run `./x.py test src/test/ui --stage 1` ```
1 parent bc48601 commit 5958447

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/bootstrap/builder.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1574,6 +1574,7 @@ impl<'a> Builder<'a> {
15741574
path: step.path(self),
15751575
// FIXME: top_stage might be higher than the stage of the step
15761576
stage: self.top_stage,
1577+
test_args: self.config.cmd.test_args().into_iter().map(String::from).collect(),
15771578
};
15781579
// NOTE: don't hold onto this guard, it will cause a deadlock if the current step calls `ensure` recursively.
15791580
let old_instructions = CURRENT_INSTRUCTIONS
@@ -1614,6 +1615,7 @@ struct ReplicationStep {
16141615
name: &'static str,
16151616
path: PathBuf,
16161617
stage: u32,
1618+
test_args: Vec<String>,
16171619
}
16181620

16191621
lazy_static! {
@@ -1638,13 +1640,17 @@ pub(crate) extern "C" fn print_replication_steps() {
16381640
let _ = stdout.set_color(&blue);
16391641
let _ = write!(stdout, "help");
16401642
let _ = stdout.reset();
1641-
let _ = writeln!(
1643+
let _ = write!(
16421644
stdout,
1643-
": to replicate this failure, run `./x.py {} {} --stage {}`",
1645+
": to replicate this failure, run `./x.py {} {} --stage {}",
16441646
step.cmd,
16451647
step.path.display(),
16461648
step.stage,
16471649
);
1650+
for arg in step.test_args {
1651+
let _ = write!(stdout, " --test-args \"{}\"", arg);
1652+
}
1653+
let _ = writeln!(stdout, "`");
16481654
}
16491655
}
16501656

src/bootstrap/test.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,6 +1151,11 @@ impl Step for Compiletest {
11511151
run.never()
11521152
}
11531153

1154+
fn path(&self, _builder: &Builder<'_>) -> PathBuf {
1155+
// FIXME: it would be nice to suggest exactly the tests that fail, but that info isn't known without first running compiletest.
1156+
self.path.into()
1157+
}
1158+
11541159
/// Executes the `compiletest` tool to run a suite of tests.
11551160
///
11561161
/// Compiles all tests with `compiler` for `target` with the specified

0 commit comments

Comments
 (0)