Skip to content

Commit 0b8c9fb

Browse files
author
yuhaixin.hx
committed
add allow_fail field in TestDesc to pass check
1 parent 6562069 commit 0b8c9fb

File tree

4 files changed

+44
-0
lines changed

4 files changed

+44
-0
lines changed

library/test/src/tests.rs

+38
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ fn one_ignored_one_unignored_test() -> Vec<TestDescAndFn> {
6565
compile_fail: false,
6666
no_run: false,
6767
test_type: TestType::Unknown,
68+
#[cfg(bootstrap)]
69+
allow_fail: false,
6870
},
6971
testfn: DynTestFn(Box::new(move || {})),
7072
},
@@ -76,6 +78,8 @@ fn one_ignored_one_unignored_test() -> Vec<TestDescAndFn> {
7678
compile_fail: false,
7779
no_run: false,
7880
test_type: TestType::Unknown,
81+
#[cfg(bootstrap)]
82+
allow_fail: false,
7983
},
8084
testfn: DynTestFn(Box::new(move || {})),
8185
},
@@ -95,6 +99,8 @@ pub fn do_not_run_ignored_tests() {
9599
compile_fail: false,
96100
no_run: false,
97101
test_type: TestType::Unknown,
102+
#[cfg(bootstrap)]
103+
allow_fail: false,
98104
},
99105
testfn: DynTestFn(Box::new(f)),
100106
};
@@ -115,6 +121,8 @@ pub fn ignored_tests_result_in_ignored() {
115121
compile_fail: false,
116122
no_run: false,
117123
test_type: TestType::Unknown,
124+
#[cfg(bootstrap)]
125+
allow_fail: false,
118126
},
119127
testfn: DynTestFn(Box::new(f)),
120128
};
@@ -139,6 +147,8 @@ fn test_should_panic() {
139147
compile_fail: false,
140148
no_run: false,
141149
test_type: TestType::Unknown,
150+
#[cfg(bootstrap)]
151+
allow_fail: false,
142152
},
143153
testfn: DynTestFn(Box::new(f)),
144154
};
@@ -163,6 +173,8 @@ fn test_should_panic_good_message() {
163173
compile_fail: false,
164174
no_run: false,
165175
test_type: TestType::Unknown,
176+
#[cfg(bootstrap)]
177+
allow_fail: false,
166178
},
167179
testfn: DynTestFn(Box::new(f)),
168180
};
@@ -192,6 +204,8 @@ fn test_should_panic_bad_message() {
192204
compile_fail: false,
193205
no_run: false,
194206
test_type: TestType::Unknown,
207+
#[cfg(bootstrap)]
208+
allow_fail: false,
195209
},
196210
testfn: DynTestFn(Box::new(f)),
197211
};
@@ -225,6 +239,8 @@ fn test_should_panic_non_string_message_type() {
225239
compile_fail: false,
226240
no_run: false,
227241
test_type: TestType::Unknown,
242+
#[cfg(bootstrap)]
243+
allow_fail: false,
228244
},
229245
testfn: DynTestFn(Box::new(f)),
230246
};
@@ -250,6 +266,8 @@ fn test_should_panic_but_succeeds() {
250266
compile_fail: false,
251267
no_run: false,
252268
test_type: TestType::Unknown,
269+
#[cfg(bootstrap)]
270+
allow_fail: false,
253271
},
254272
testfn: DynTestFn(Box::new(f)),
255273
};
@@ -283,6 +301,8 @@ fn report_time_test_template(report_time: bool) -> Option<TestExecTime> {
283301
compile_fail: false,
284302
no_run: false,
285303
test_type: TestType::Unknown,
304+
#[cfg(bootstrap)]
305+
allow_fail: false,
286306
},
287307
testfn: DynTestFn(Box::new(f)),
288308
};
@@ -317,6 +337,8 @@ fn time_test_failure_template(test_type: TestType) -> TestResult {
317337
compile_fail: false,
318338
no_run: false,
319339
test_type,
340+
#[cfg(bootstrap)]
341+
allow_fail: false,
320342
},
321343
testfn: DynTestFn(Box::new(f)),
322344
};
@@ -355,6 +377,8 @@ fn typed_test_desc(test_type: TestType) -> TestDesc {
355377
compile_fail: false,
356378
no_run: false,
357379
test_type,
380+
#[cfg(bootstrap)]
381+
allow_fail: false,
358382
}
359383
}
360384

@@ -467,6 +491,8 @@ pub fn exclude_should_panic_option() {
467491
compile_fail: false,
468492
no_run: false,
469493
test_type: TestType::Unknown,
494+
#[cfg(bootstrap)]
495+
allow_fail: false,
470496
},
471497
testfn: DynTestFn(Box::new(move || {})),
472498
});
@@ -490,6 +516,8 @@ pub fn exact_filter_match() {
490516
compile_fail: false,
491517
no_run: false,
492518
test_type: TestType::Unknown,
519+
#[cfg(bootstrap)]
520+
allow_fail: false,
493521
},
494522
testfn: DynTestFn(Box::new(move || {})),
495523
})
@@ -578,6 +606,8 @@ fn sample_tests() -> Vec<TestDescAndFn> {
578606
compile_fail: false,
579607
no_run: false,
580608
test_type: TestType::Unknown,
609+
#[cfg(bootstrap)]
610+
allow_fail: false,
581611
},
582612
testfn: DynTestFn(Box::new(testfn)),
583613
};
@@ -728,6 +758,8 @@ pub fn test_bench_no_iter() {
728758
compile_fail: false,
729759
no_run: false,
730760
test_type: TestType::Unknown,
761+
#[cfg(bootstrap)]
762+
allow_fail: false,
731763
};
732764

733765
crate::bench::benchmark(TestId(0), desc, tx, true, f);
@@ -749,6 +781,8 @@ pub fn test_bench_iter() {
749781
compile_fail: false,
750782
no_run: false,
751783
test_type: TestType::Unknown,
784+
#[cfg(bootstrap)]
785+
allow_fail: false,
752786
};
753787

754788
crate::bench::benchmark(TestId(0), desc, tx, true, f);
@@ -764,6 +798,8 @@ fn should_sort_failures_before_printing_them() {
764798
compile_fail: false,
765799
no_run: false,
766800
test_type: TestType::Unknown,
801+
#[cfg(bootstrap)]
802+
allow_fail: false,
767803
};
768804

769805
let test_b = TestDesc {
@@ -773,6 +809,8 @@ fn should_sort_failures_before_printing_them() {
773809
compile_fail: false,
774810
no_run: false,
775811
test_type: TestType::Unknown,
812+
#[cfg(bootstrap)]
813+
allow_fail: false,
776814
};
777815

778816
let mut out = PrettyFormatter::new(OutputLocation::Raw(Vec::new()), false, 10, false, None);

library/test/src/types.rs

+2
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ pub struct TestDesc {
121121
pub compile_fail: bool,
122122
pub no_run: bool,
123123
pub test_type: TestType,
124+
#[cfg(bootstrap)]
125+
pub allow_fail: bool,
124126
}
125127

126128
impl TestDesc {

src/librustdoc/doctest.rs

+2
Original file line numberDiff line numberDiff line change
@@ -954,6 +954,8 @@ impl Tester for Collector {
954954
compile_fail: config.compile_fail,
955955
no_run,
956956
test_type: test::TestType::DocTest,
957+
#[cfg(bootstrap)]
958+
allow_fail: false,
957959
},
958960
testfn: test::DynTestFn(box move || {
959961
let report_unused_externs = |uext| {

src/tools/compiletest/src/header.rs

+2
Original file line numberDiff line numberDiff line change
@@ -925,6 +925,8 @@ pub fn make_test_description<R: Read>(
925925
compile_fail: false,
926926
no_run: false,
927927
test_type: test::TestType::Unknown,
928+
#[cfg(bootstrap)]
929+
allow_fail: false,
928930
}
929931
}
930932

0 commit comments

Comments
 (0)