Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add compare-mode to x.py
  • Loading branch information
spastorino committed May 30, 2018
1 parent 9df0a41 commit b970fee
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/bootstrap/builder.rs
Expand Up @@ -1457,6 +1457,7 @@ mod __test {
fail_fast: true,
doc_tests: DocTests::No,
bless: false,
compare_mode: None,
};

let build = Build::new(config);
Expand Down
11 changes: 11 additions & 0 deletions src/bootstrap/flags.rs
Expand Up @@ -61,6 +61,7 @@ pub enum Subcommand {
paths: Vec<PathBuf>,
/// Whether to automatically update stderr/stdout files
bless: bool,
compare_mode: Option<String>,
test_args: Vec<String>,
rustc_args: Vec<String>,
fail_fast: bool,
Expand Down Expand Up @@ -176,6 +177,7 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`");
opts.optflag("", "no-doc", "do not run doc tests");
opts.optflag("", "doc", "only run doc tests");
opts.optflag("", "bless", "update all stderr/stdout files of failing ui tests");
opts.optopt("", "compare-mode", "mode describing what file the actual ui output will be compared to", "COMPARE MODE");
},
"bench" => { opts.optmulti("", "test-args", "extra arguments", "ARGS"); },
"clean" => { opts.optflag("", "all", "clean all build artifacts"); },
Expand Down Expand Up @@ -262,6 +264,7 @@ Arguments:
./x.py test src/libstd --test-args hash_map
./x.py test src/libstd --stage 0
./x.py test src/test/ui --bless
./x.py test src/test/ui --compare-mode nll
If no arguments are passed then the complete artifacts for that stage are
compiled and tested.
Expand Down Expand Up @@ -327,6 +330,7 @@ Arguments:
Subcommand::Test {
paths,
bless: matches.opt_present("bless"),
compare_mode: matches.opt_str("compare-mode"),
test_args: matches.opt_strs("test-args"),
rustc_args: matches.opt_strs("rustc-args"),
fail_fast: !matches.opt_present("no-fail-fast"),
Expand Down Expand Up @@ -436,6 +440,13 @@ impl Subcommand {
_ => false,
}
}

pub fn compare_mode(&self) -> Option<&str> {
match *self {
Subcommand::Test { ref compare_mode, .. } => compare_mode.as_ref().map(|s| &s[..]),
_ => None,
}
}
}

fn split(s: Vec<String>) -> Vec<String> {
Expand Down
3 changes: 2 additions & 1 deletion src/bootstrap/test.rs
Expand Up @@ -887,7 +887,6 @@ impl Step for Compiletest {
let target = self.target;
let mode = self.mode;
let suite = self.suite;
let compare_mode = self.compare_mode;

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

let compare_mode = builder.config.cmd.compare_mode().or(self.compare_mode);

if let Some(ref nodejs) = builder.config.nodejs {
cmd.arg("--nodejs").arg(nodejs);
}
Expand Down

0 comments on commit b970fee

Please sign in to comment.