Skip to content

Commit

Permalink
add bootstrap cfg
Browse files Browse the repository at this point in the history
  • Loading branch information
ABouttefeux committed May 9, 2021
1 parent 6e99cb3 commit f6b8b78
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 3 deletions.
2 changes: 1 addition & 1 deletion library/test/src/formatters/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ impl<T: Write> PrettyFormatter<T> {

fn write_test_name(&mut self, desc: &TestDesc) -> io::Result<()> {
let name = desc.padded_name(self.max_name_len, desc.name.padding());
self.write_plain(&format!("test {} - {} ... ", name, desc.test_mode_string()))?;
self.write_plain(&format!("test {} - {} ... ", name, desc.test_mode()))?;

Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion library/test/src/formatters/terse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ impl<T: Write> TerseFormatter<T> {

fn write_test_name(&mut self, desc: &TestDesc) -> io::Result<()> {
let name = desc.padded_name(self.max_name_len, desc.name.padding());
self.write_plain(&format!("test {} - {} ... ", name, desc.test_mode_string()))?;
self.write_plain(&format!("test {} - {} ... ", name, desc.test_mode()))?;

Ok(())
}
Expand Down
38 changes: 38 additions & 0 deletions library/test/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ fn one_ignored_one_unignored_test() -> Vec<TestDescAndFn> {
ignore: true,
should_panic: ShouldPanic::No,
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type: TestType::Unknown,
},
Expand All @@ -73,7 +75,9 @@ fn one_ignored_one_unignored_test() -> Vec<TestDescAndFn> {
ignore: false,
should_panic: ShouldPanic::No,
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type: TestType::Unknown,
},
Expand All @@ -93,7 +97,9 @@ pub fn do_not_run_ignored_tests() {
ignore: true,
should_panic: ShouldPanic::No,
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type: TestType::Unknown,
},
Expand All @@ -114,7 +120,9 @@ pub fn ignored_tests_result_in_ignored() {
ignore: true,
should_panic: ShouldPanic::No,
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type: TestType::Unknown,
},
Expand All @@ -139,7 +147,9 @@ fn test_should_panic() {
ignore: false,
should_panic: ShouldPanic::Yes,
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type: TestType::Unknown,
},
Expand All @@ -164,7 +174,9 @@ fn test_should_panic_good_message() {
ignore: false,
should_panic: ShouldPanic::YesWithMessage("error message"),
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type: TestType::Unknown,
},
Expand Down Expand Up @@ -194,7 +206,9 @@ fn test_should_panic_bad_message() {
ignore: false,
should_panic: ShouldPanic::YesWithMessage(expected),
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type: TestType::Unknown,
},
Expand Down Expand Up @@ -228,7 +242,9 @@ fn test_should_panic_non_string_message_type() {
ignore: false,
should_panic: ShouldPanic::YesWithMessage(expected),
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type: TestType::Unknown,
},
Expand All @@ -254,7 +270,9 @@ fn test_should_panic_but_succeeds() {
ignore: false,
should_panic,
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type: TestType::Unknown,
},
Expand Down Expand Up @@ -288,7 +306,9 @@ fn report_time_test_template(report_time: bool) -> Option<TestExecTime> {
ignore: false,
should_panic: ShouldPanic::No,
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type: TestType::Unknown,
},
Expand Down Expand Up @@ -323,7 +343,9 @@ fn time_test_failure_template(test_type: TestType) -> TestResult {
ignore: false,
should_panic: ShouldPanic::No,
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type,
},
Expand Down Expand Up @@ -362,7 +384,9 @@ fn typed_test_desc(test_type: TestType) -> TestDesc {
ignore: false,
should_panic: ShouldPanic::No,
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type,
}
Expand Down Expand Up @@ -475,7 +499,9 @@ pub fn exclude_should_panic_option() {
ignore: false,
should_panic: ShouldPanic::Yes,
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type: TestType::Unknown,
},
Expand All @@ -499,7 +525,9 @@ pub fn exact_filter_match() {
ignore: false,
should_panic: ShouldPanic::No,
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type: TestType::Unknown,
},
Expand Down Expand Up @@ -593,7 +621,9 @@ pub fn sort_tests() {
ignore: false,
should_panic: ShouldPanic::No,
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type: TestType::Unknown,
},
Expand Down Expand Up @@ -672,7 +702,9 @@ pub fn test_bench_no_iter() {
ignore: false,
should_panic: ShouldPanic::No,
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type: TestType::Unknown,
};
Expand All @@ -694,7 +726,9 @@ pub fn test_bench_iter() {
ignore: false,
should_panic: ShouldPanic::No,
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type: TestType::Unknown,
};
Expand All @@ -710,7 +744,9 @@ fn should_sort_failures_before_printing_them() {
ignore: false,
should_panic: ShouldPanic::No,
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type: TestType::Unknown,
};
Expand All @@ -720,7 +756,9 @@ fn should_sort_failures_before_printing_them() {
ignore: false,
should_panic: ShouldPanic::No,
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type: TestType::Unknown,
};
Expand Down
10 changes: 9 additions & 1 deletion library/test/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ pub struct TestDesc {
pub ignore: bool,
pub should_panic: options::ShouldPanic,
pub allow_fail: bool,
#[cfg(not(bootstrap))]
pub compile_fail: bool,
#[cfg(not(bootstrap))]
pub no_run: bool,
pub test_type: TestType,
}
Expand All @@ -143,7 +145,8 @@ impl TestDesc {
}
}

pub fn test_mode_string(&self) -> &'static str {
#[cfg(not(bootstrap))]
pub fn test_mode(&self) -> &'static str {
if self.ignore {
return &"ignore";
}
Expand All @@ -164,6 +167,11 @@ impl TestDesc {
}
&"run"
}

#[cfg(bootstrap)]
pub fn test_mode(&self) -> &'static str {
&""
}
}

#[derive(Debug)]
Expand Down
2 changes: 2 additions & 0 deletions src/librustdoc/doctest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,9 @@ impl Tester for Collector {
// compiler failures are test failures
should_panic: testing::ShouldPanic::No,
allow_fail: config.allow_fail,
#[cfg(not(bootstrap))]
compile_fail: config.compile_fail,
#[cfg(not(bootstrap))]
no_run,
test_type: testing::TestType::DocTest,
},
Expand Down
2 changes: 2 additions & 0 deletions src/tools/compiletest/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,9 @@ fn make_test(config: &Config, testpaths: &TestPaths, inputs: &Stamp) -> Vec<test
ignore,
should_panic,
allow_fail: false,
#[cfg(not(bootstrap))]
compile_fail: false,
#[cfg(not(bootstrap))]
no_run: false,
test_type: test::TestType::Unknown,
},
Expand Down

0 comments on commit f6b8b78

Please sign in to comment.