Skip to content

Commit b970fee

Browse files
committed
Add compare-mode to x.py
1 parent 9df0a41 commit b970fee

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

src/bootstrap/builder.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1457,6 +1457,7 @@ mod __test {
14571457
fail_fast: true,
14581458
doc_tests: DocTests::No,
14591459
bless: false,
1460+
compare_mode: None,
14601461
};
14611462

14621463
let build = Build::new(config);

src/bootstrap/flags.rs

+11
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ pub enum Subcommand {
6161
paths: Vec<PathBuf>,
6262
/// Whether to automatically update stderr/stdout files
6363
bless: bool,
64+
compare_mode: Option<String>,
6465
test_args: Vec<String>,
6566
rustc_args: Vec<String>,
6667
fail_fast: bool,
@@ -176,6 +177,7 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`");
176177
opts.optflag("", "no-doc", "do not run doc tests");
177178
opts.optflag("", "doc", "only run doc tests");
178179
opts.optflag("", "bless", "update all stderr/stdout files of failing ui tests");
180+
opts.optopt("", "compare-mode", "mode describing what file the actual ui output will be compared to", "COMPARE MODE");
179181
},
180182
"bench" => { opts.optmulti("", "test-args", "extra arguments", "ARGS"); },
181183
"clean" => { opts.optflag("", "all", "clean all build artifacts"); },
@@ -262,6 +264,7 @@ Arguments:
262264
./x.py test src/libstd --test-args hash_map
263265
./x.py test src/libstd --stage 0
264266
./x.py test src/test/ui --bless
267+
./x.py test src/test/ui --compare-mode nll
265268
266269
If no arguments are passed then the complete artifacts for that stage are
267270
compiled and tested.
@@ -327,6 +330,7 @@ Arguments:
327330
Subcommand::Test {
328331
paths,
329332
bless: matches.opt_present("bless"),
333+
compare_mode: matches.opt_str("compare-mode"),
330334
test_args: matches.opt_strs("test-args"),
331335
rustc_args: matches.opt_strs("rustc-args"),
332336
fail_fast: !matches.opt_present("no-fail-fast"),
@@ -436,6 +440,13 @@ impl Subcommand {
436440
_ => false,
437441
}
438442
}
443+
444+
pub fn compare_mode(&self) -> Option<&str> {
445+
match *self {
446+
Subcommand::Test { ref compare_mode, .. } => compare_mode.as_ref().map(|s| &s[..]),
447+
_ => None,
448+
}
449+
}
439450
}
440451

441452
fn split(s: Vec<String>) -> Vec<String> {

src/bootstrap/test.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,6 @@ impl Step for Compiletest {
887887
let target = self.target;
888888
let mode = self.mode;
889889
let suite = self.suite;
890-
let compare_mode = self.compare_mode;
891890

892891
// Path for test suite
893892
let suite_path = self.path.unwrap_or("");
@@ -965,6 +964,8 @@ impl Step for Compiletest {
965964
cmd.arg("--bless");
966965
}
967966

967+
let compare_mode = builder.config.cmd.compare_mode().or(self.compare_mode);
968+
968969
if let Some(ref nodejs) = builder.config.nodejs {
969970
cmd.arg("--nodejs").arg(nodejs);
970971
}

0 commit comments

Comments
 (0)