Skip to content

Commit 13b0560

Browse files
committed
rust-lang#107307 Adding additional information to "cargo test --list" output
attempting to fix ordering issue
1 parent 6a13a85 commit 13b0560

File tree

4 files changed

+32
-3
lines changed

4 files changed

+32
-3
lines changed

library/test/src/console.rs

+10-3
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,14 @@ pub fn list_tests_console(opts: &TestOpts, tests: Vec<TestDescAndFn>) -> io::Res
152152
for test in filter_tests(opts, tests).into_iter() {
153153
use crate::TestFn::*;
154154

155-
let TestDescAndFn { desc: TestDesc { name, ignore, location_info, .. }, testfn } = test;
155+
let TestDescAndFn {
156+
desc: TestDesc {
157+
name,
158+
ignore,
159+
#[cfg(not(bootstrap))]
160+
location_info,
161+
..
162+
}, testfn } = test;
156163

157164
let fntype = match testfn {
158165
StaticTestFn(..) | DynTestFn(..) => {
@@ -165,8 +172,8 @@ pub fn list_tests_console(opts: &TestOpts, tests: Vec<TestDescAndFn>) -> io::Res
165172
}
166173
};
167174

168-
writeln!(output, "{name}: {fntype} | {ignore} | {location_info}")?;
169-
st.write_log(|| format!("{fntype} {name} {ignore} {location_info}\n"))?;
175+
writeln!(output, "{name}: {fntype} | {ignore} | <location_info>")?;
176+
st.write_log(|| format!("{fntype} {name} {ignore} <location_info>\n"))?;
170177
}
171178

172179
fn plural(count: u32, s: &str) -> String {

library/test/src/tests.rs

+20
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ fn one_ignored_one_unignored_test() -> Vec<TestDescAndFn> {
6363
name: StaticTestName("1"),
6464
ignore: true,
6565
ignore_message: None,
66+
#[cfg(not(bootstrap))]
6667
location_info: "src\\lib.rs:10:10: 10:20",
6768
should_panic: ShouldPanic::No,
6869
compile_fail: false,
@@ -76,6 +77,7 @@ fn one_ignored_one_unignored_test() -> Vec<TestDescAndFn> {
7677
name: StaticTestName("2"),
7778
ignore: false,
7879
ignore_message: None,
80+
#[cfg(not(bootstrap))]
7981
location_info: "src\\lib.rs:10:10: 10:20",
8082
should_panic: ShouldPanic::No,
8183
compile_fail: false,
@@ -97,6 +99,7 @@ pub fn do_not_run_ignored_tests() {
9799
name: StaticTestName("whatever"),
98100
ignore: true,
99101
ignore_message: None,
102+
#[cfg(not(bootstrap))]
100103
location_info: "src\\lib.rs:10:10: 10:20",
101104
should_panic: ShouldPanic::No,
102105
compile_fail: false,
@@ -121,6 +124,7 @@ pub fn ignored_tests_result_in_ignored() {
121124
name: StaticTestName("whatever"),
122125
ignore: true,
123126
ignore_message: None,
127+
#[cfg(not(bootstrap))]
124128
location_info: "src\\lib.rs:10:10: 10:20",
125129
should_panic: ShouldPanic::No,
126130
compile_fail: false,
@@ -147,6 +151,7 @@ fn test_should_panic() {
147151
name: StaticTestName("whatever"),
148152
ignore: false,
149153
ignore_message: None,
154+
#[cfg(not(bootstrap))]
150155
location_info: "src\\lib.rs:10:10: 10:20",
151156
should_panic: ShouldPanic::Yes,
152157
compile_fail: false,
@@ -173,6 +178,7 @@ fn test_should_panic_good_message() {
173178
name: StaticTestName("whatever"),
174179
ignore: false,
175180
ignore_message: None,
181+
#[cfg(not(bootstrap))]
176182
location_info: "src\\lib.rs:10:10: 10:20",
177183
should_panic: ShouldPanic::YesWithMessage("error message"),
178184
compile_fail: false,
@@ -204,6 +210,7 @@ fn test_should_panic_bad_message() {
204210
name: StaticTestName("whatever"),
205211
ignore: false,
206212
ignore_message: None,
213+
#[cfg(not(bootstrap))]
207214
location_info: "src\\lib.rs:10:10: 10:20",
208215
should_panic: ShouldPanic::YesWithMessage(expected),
209216
compile_fail: false,
@@ -239,6 +246,7 @@ fn test_should_panic_non_string_message_type() {
239246
name: StaticTestName("whatever"),
240247
ignore: false,
241248
ignore_message: None,
249+
#[cfg(not(bootstrap))]
242250
location_info: "src\\lib.rs:10:10: 10:20",
243251
should_panic: ShouldPanic::YesWithMessage(expected),
244252
compile_fail: false,
@@ -268,6 +276,7 @@ fn test_should_panic_but_succeeds() {
268276
name: StaticTestName("whatever"),
269277
ignore: false,
270278
ignore_message: None,
279+
#[cfg(not(bootstrap))]
271280
location_info: "src\\lib.rs:10:10: 10:20",
272281
should_panic,
273282
compile_fail: false,
@@ -297,6 +306,7 @@ fn report_time_test_template(report_time: bool) -> Option<TestExecTime> {
297306
name: StaticTestName("whatever"),
298307
ignore: false,
299308
ignore_message: None,
309+
#[cfg(not(bootstrap))]
300310
location_info: "src\\lib.rs:10:10: 10:20",
301311
should_panic: ShouldPanic::No,
302312
compile_fail: false,
@@ -335,6 +345,7 @@ fn time_test_failure_template(test_type: TestType) -> TestResult {
335345
name: StaticTestName("whatever"),
336346
ignore: false,
337347
ignore_message: None,
348+
#[cfg(not(bootstrap))]
338349
location_info: "src\\lib.rs:10:10: 10:20",
339350
should_panic: ShouldPanic::No,
340351
compile_fail: false,
@@ -375,6 +386,7 @@ fn typed_test_desc(test_type: TestType) -> TestDesc {
375386
name: StaticTestName("whatever"),
376387
ignore: false,
377388
ignore_message: None,
389+
#[cfg(not(bootstrap))]
378390
location_info: "src\\lib.rs:10:10: 10:20",
379391
should_panic: ShouldPanic::No,
380392
compile_fail: false,
@@ -488,6 +500,7 @@ pub fn exclude_should_panic_option() {
488500
name: StaticTestName("3"),
489501
ignore: false,
490502
ignore_message: None,
503+
#[cfg(not(bootstrap))]
491504
location_info: "src\\lib.rs:10:10: 10:20",
492505
should_panic: ShouldPanic::Yes,
493506
compile_fail: false,
@@ -513,6 +526,7 @@ pub fn exact_filter_match() {
513526
name: StaticTestName(name),
514527
ignore: false,
515528
ignore_message: None,
529+
#[cfg(not(bootstrap))]
516530
location_info: "src\\lib.rs:10:10: 10:20",
517531
should_panic: ShouldPanic::No,
518532
compile_fail: false,
@@ -605,6 +619,7 @@ fn sample_tests() -> Vec<TestDescAndFn> {
605619
name: DynTestName((*name).clone()),
606620
ignore: false,
607621
ignore_message: None,
622+
#[cfg(not(bootstrap))]
608623
location_info: "src\\lib.rs:10:10: 10:20",
609624
should_panic: ShouldPanic::No,
610625
compile_fail: false,
@@ -735,6 +750,7 @@ pub fn test_bench_no_iter() {
735750
name: StaticTestName("f"),
736751
ignore: false,
737752
ignore_message: None,
753+
#[cfg(not(bootstrap))]
738754
location_info: "src\\lib.rs:10:10: 10:20",
739755
should_panic: ShouldPanic::No,
740756
compile_fail: false,
@@ -759,6 +775,7 @@ pub fn test_bench_iter() {
759775
name: StaticTestName("f"),
760776
ignore: false,
761777
ignore_message: None,
778+
#[cfg(not(bootstrap))]
762779
location_info: "src\\lib.rs:10:10: 10:20",
763780
should_panic: ShouldPanic::No,
764781
compile_fail: false,
@@ -776,6 +793,7 @@ fn should_sort_failures_before_printing_them() {
776793
name: StaticTestName("a"),
777794
ignore: false,
778795
ignore_message: None,
796+
#[cfg(not(bootstrap))]
779797
location_info: "src\\lib.rs:10:10: 10:20",
780798
should_panic: ShouldPanic::No,
781799
compile_fail: false,
@@ -787,6 +805,7 @@ fn should_sort_failures_before_printing_them() {
787805
name: StaticTestName("b"),
788806
ignore: false,
789807
ignore_message: None,
808+
#[cfg(not(bootstrap))]
790809
location_info: "src\\lib.rs:10:10: 10:20",
791810
should_panic: ShouldPanic::No,
792811
compile_fail: false,
@@ -835,6 +854,7 @@ fn test_dyn_bench_returning_err_fails_when_run_as_test() {
835854
name: StaticTestName("whatever"),
836855
ignore: false,
837856
ignore_message: None,
857+
#[cfg(not(bootstrap))]
838858
location_info: "src\\lib.rs:10:10: 10:20",
839859
should_panic: ShouldPanic::No,
840860
compile_fail: false,

src/librustdoc/doctest.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1063,6 +1063,7 @@ impl Tester for Collector {
10631063
},
10641064
ignore_message: None,
10651065
// compiler failures are test failures
1066+
#[cfg(not(bootstrap))]
10661067
location_info: "src\\lib.rs:10:10: 10:20",
10671068
should_panic: test::ShouldPanic::No,
10681069
compile_fail: config.compile_fail,

src/tools/compiletest/src/header.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1043,6 +1043,7 @@ pub fn make_test_description<R: Read>(
10431043
name,
10441044
ignore,
10451045
ignore_message,
1046+
#[cfg(not(bootstrap))]
10461047
location_info: "src\\lib.rs:10:10: 10:20",
10471048
should_panic,
10481049
compile_fail: false,

0 commit comments

Comments
 (0)