Skip to content

Commit ceed8eb

Browse files
committed
Make bless a flag instead of a subcommand
1 parent 37dee69 commit ceed8eb

File tree

3 files changed

+11
-22
lines changed

3 files changed

+11
-22
lines changed

src/bootstrap/builder.rs

-5
Original file line numberDiff line numberDiff line change
@@ -311,8 +311,6 @@ impl<'a> ShouldRun<'a> {
311311
pub enum Kind {
312312
Build,
313313
Check,
314-
/// Run tests and replace any failing tests' output files (stderr/stout) with the correct ones
315-
Bless,
316314
Test,
317315
Bench,
318316
Dist,
@@ -336,7 +334,6 @@ impl<'a> Builder<'a> {
336334
native::Llvm, tool::Rustfmt, tool::Miri, native::Lld),
337335
Kind::Check => describe!(check::Std, check::Test, check::Rustc, check::CodegenBackend,
338336
check::Rustdoc),
339-
Kind::Bless |
340337
Kind::Test => describe!(test::Tidy, test::Bootstrap, test::Ui, test::RunPass,
341338
test::CompileFail, test::ParseFail, test::RunFail, test::RunPassValgrind,
342339
test::MirOpt, test::Codegen, test::CodegenUnits, test::Incremental, test::Debuginfo,
@@ -370,7 +367,6 @@ impl<'a> Builder<'a> {
370367
let kind = match subcommand {
371368
"build" => Kind::Build,
372369
"doc" => Kind::Doc,
373-
"bless" => Kind::Bless,
374370
"test" => Kind::Test,
375371
"bench" => Kind::Bench,
376372
"dist" => Kind::Dist,
@@ -412,7 +408,6 @@ impl<'a> Builder<'a> {
412408
Subcommand::Build { ref paths } => (Kind::Build, &paths[..]),
413409
Subcommand::Check { ref paths } => (Kind::Check, &paths[..]),
414410
Subcommand::Doc { ref paths } => (Kind::Doc, &paths[..]),
415-
Subcommand::Test { ref paths, bless: true, .. } => (Kind::Bless, &paths[..]),
416411
Subcommand::Test { ref paths, .. } => (Kind::Test, &paths[..]),
417412
Subcommand::Bench { ref paths, .. } => (Kind::Bench, &paths[..]),
418413
Subcommand::Dist { ref paths } => (Kind::Dist, &paths[..]),

src/bootstrap/flags.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`");
144144
let subcommand = args.iter().find(|&s|
145145
(s == "build")
146146
|| (s == "check")
147-
|| (s == "bless")
148147
|| (s == "test")
149148
|| (s == "bench")
150149
|| (s == "doc")
@@ -165,7 +164,6 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`");
165164

166165
// Some subcommands get extra options
167166
match subcommand.as_str() {
168-
"bless" |
169167
"test" => {
170168
opts.optflag("", "no-fail-fast", "Run all tests regardless of failure");
171169
opts.optmulti("", "test-args", "extra arguments", "ARGS");
@@ -177,6 +175,7 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`");
177175
);
178176
opts.optflag("", "no-doc", "do not run doc tests");
179177
opts.optflag("", "doc", "only run doc tests");
178+
opts.optflag("", "bless", "update all stderr/stdout files of failing ui tests");
180179
},
181180
"bench" => { opts.optmulti("", "test-args", "extra arguments", "ARGS"); },
182181
"clean" => { opts.optflag("", "all", "clean all build artifacts"); },
@@ -252,12 +251,6 @@ Arguments:
252251
compilation, so there's no need to pass it separately, though it won't hurt. We also completely
253252
ignore the stage passed, as there's no way to compile in non-stage 0 without actually building
254253
the compiler.");
255-
}
256-
"bless" => {
257-
subcommand_help.push_str("\n
258-
Arguments:
259-
This subcommand works exactly like the `test` subcommand, but also updates stderr/stdout files
260-
before they cause a test failure");
261254
}
262255
"test" => {
263256
subcommand_help.push_str("\n
@@ -268,6 +261,7 @@ Arguments:
268261
./x.py test src/test/run-pass
269262
./x.py test src/libstd --test-args hash_map
270263
./x.py test src/libstd --stage 0
264+
./x.py test src/test/ui --bless
271265
272266
If no arguments are passed then the complete artifacts for that stage are
273267
compiled and tested.
@@ -329,11 +323,10 @@ Arguments:
329323
"check" => {
330324
Subcommand::Check { paths: paths }
331325
}
332-
"bless" |
333326
"test" => {
334327
Subcommand::Test {
335328
paths,
336-
bless: subcommand.as_str() == "bless",
329+
bless: matches.opt_present("bless"),
337330
test_args: matches.opt_strs("test-args"),
338331
rustc_args: matches.opt_strs("rustc-args"),
339332
fail_fast: !matches.opt_present("no-fail-fast"),
@@ -436,6 +429,13 @@ impl Subcommand {
436429
_ => DocTests::Yes,
437430
}
438431
}
432+
433+
pub fn bless(&self) -> bool {
434+
match *self {
435+
Subcommand::Test { bless, .. } => bless,
436+
_ => false,
437+
}
438+
}
439439
}
440440

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

src/bootstrap/test.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ const ADB_TEST_DIR: &str = "/data/tmp/work";
4141
/// The two modes of the test runner; tests or benchmarks.
4242
#[derive(Debug, PartialEq, Eq, Hash, Copy, Clone, PartialOrd, Ord)]
4343
pub enum TestKind {
44-
/// Run `cargo bless`
45-
Bless,
4644
/// Run `cargo test`
4745
Test,
4846
/// Run `cargo bench`
@@ -53,7 +51,6 @@ impl From<Kind> for TestKind {
5351
fn from(kind: Kind) -> Self {
5452
match kind {
5553
Kind::Test => TestKind::Test,
56-
Kind::Bless => TestKind::Bless,
5754
Kind::Bench => TestKind::Bench,
5855
_ => panic!("unexpected kind in crate: {:?}", kind)
5956
}
@@ -64,8 +61,6 @@ impl TestKind {
6461
// Return the cargo subcommand for this test kind
6562
fn subcommand(self) -> &'static str {
6663
match self {
67-
// bless and test are both `test` for folder names and cargo subcommands
68-
TestKind::Bless |
6964
TestKind::Test => "test",
7065
TestKind::Bench => "bench",
7166
}
@@ -75,7 +70,6 @@ impl TestKind {
7570
impl fmt::Display for TestKind {
7671
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
7772
f.write_str(match *self {
78-
TestKind::Bless => "Testing (bless)",
7973
TestKind::Test => "Testing",
8074
TestKind::Bench => "Benchmarking",
8175
})
@@ -967,7 +961,7 @@ impl Step for Compiletest {
967961
cmd.arg("--host").arg(&*compiler.host);
968962
cmd.arg("--llvm-filecheck").arg(builder.llvm_filecheck(builder.config.build));
969963

970-
if builder.kind == Kind::Bless {
964+
if builder.config.cmd.bless() {
971965
cmd.arg("--bless");
972966
}
973967

0 commit comments

Comments
 (0)