Skip to content

Commit

Permalink
add allow_fail field in TestDesc to pass check
Browse files Browse the repository at this point in the history
  • Loading branch information
yuhaixin.hx committed Jan 28, 2022
1 parent 6562069 commit 0b8c9fb
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 0 deletions.
38 changes: 38 additions & 0 deletions library/test/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ fn one_ignored_one_unignored_test() -> Vec<TestDescAndFn> {
compile_fail: false,
no_run: false,
test_type: TestType::Unknown,
#[cfg(bootstrap)]
allow_fail: false,
},
testfn: DynTestFn(Box::new(move || {})),
},
Expand All @@ -76,6 +78,8 @@ fn one_ignored_one_unignored_test() -> Vec<TestDescAndFn> {
compile_fail: false,
no_run: false,
test_type: TestType::Unknown,
#[cfg(bootstrap)]
allow_fail: false,
},
testfn: DynTestFn(Box::new(move || {})),
},
Expand All @@ -95,6 +99,8 @@ pub fn do_not_run_ignored_tests() {
compile_fail: false,
no_run: false,
test_type: TestType::Unknown,
#[cfg(bootstrap)]
allow_fail: false,
},
testfn: DynTestFn(Box::new(f)),
};
Expand All @@ -115,6 +121,8 @@ pub fn ignored_tests_result_in_ignored() {
compile_fail: false,
no_run: false,
test_type: TestType::Unknown,
#[cfg(bootstrap)]
allow_fail: false,
},
testfn: DynTestFn(Box::new(f)),
};
Expand All @@ -139,6 +147,8 @@ fn test_should_panic() {
compile_fail: false,
no_run: false,
test_type: TestType::Unknown,
#[cfg(bootstrap)]
allow_fail: false,
},
testfn: DynTestFn(Box::new(f)),
};
Expand All @@ -163,6 +173,8 @@ fn test_should_panic_good_message() {
compile_fail: false,
no_run: false,
test_type: TestType::Unknown,
#[cfg(bootstrap)]
allow_fail: false,
},
testfn: DynTestFn(Box::new(f)),
};
Expand Down Expand Up @@ -192,6 +204,8 @@ fn test_should_panic_bad_message() {
compile_fail: false,
no_run: false,
test_type: TestType::Unknown,
#[cfg(bootstrap)]
allow_fail: false,
},
testfn: DynTestFn(Box::new(f)),
};
Expand Down Expand Up @@ -225,6 +239,8 @@ fn test_should_panic_non_string_message_type() {
compile_fail: false,
no_run: false,
test_type: TestType::Unknown,
#[cfg(bootstrap)]
allow_fail: false,
},
testfn: DynTestFn(Box::new(f)),
};
Expand All @@ -250,6 +266,8 @@ fn test_should_panic_but_succeeds() {
compile_fail: false,
no_run: false,
test_type: TestType::Unknown,
#[cfg(bootstrap)]
allow_fail: false,
},
testfn: DynTestFn(Box::new(f)),
};
Expand Down Expand Up @@ -283,6 +301,8 @@ fn report_time_test_template(report_time: bool) -> Option<TestExecTime> {
compile_fail: false,
no_run: false,
test_type: TestType::Unknown,
#[cfg(bootstrap)]
allow_fail: false,
},
testfn: DynTestFn(Box::new(f)),
};
Expand Down Expand Up @@ -317,6 +337,8 @@ fn time_test_failure_template(test_type: TestType) -> TestResult {
compile_fail: false,
no_run: false,
test_type,
#[cfg(bootstrap)]
allow_fail: false,
},
testfn: DynTestFn(Box::new(f)),
};
Expand Down Expand Up @@ -355,6 +377,8 @@ fn typed_test_desc(test_type: TestType) -> TestDesc {
compile_fail: false,
no_run: false,
test_type,
#[cfg(bootstrap)]
allow_fail: false,
}
}

Expand Down Expand Up @@ -467,6 +491,8 @@ pub fn exclude_should_panic_option() {
compile_fail: false,
no_run: false,
test_type: TestType::Unknown,
#[cfg(bootstrap)]
allow_fail: false,
},
testfn: DynTestFn(Box::new(move || {})),
});
Expand All @@ -490,6 +516,8 @@ pub fn exact_filter_match() {
compile_fail: false,
no_run: false,
test_type: TestType::Unknown,
#[cfg(bootstrap)]
allow_fail: false,
},
testfn: DynTestFn(Box::new(move || {})),
})
Expand Down Expand Up @@ -578,6 +606,8 @@ fn sample_tests() -> Vec<TestDescAndFn> {
compile_fail: false,
no_run: false,
test_type: TestType::Unknown,
#[cfg(bootstrap)]
allow_fail: false,
},
testfn: DynTestFn(Box::new(testfn)),
};
Expand Down Expand Up @@ -728,6 +758,8 @@ pub fn test_bench_no_iter() {
compile_fail: false,
no_run: false,
test_type: TestType::Unknown,
#[cfg(bootstrap)]
allow_fail: false,
};

crate::bench::benchmark(TestId(0), desc, tx, true, f);
Expand All @@ -749,6 +781,8 @@ pub fn test_bench_iter() {
compile_fail: false,
no_run: false,
test_type: TestType::Unknown,
#[cfg(bootstrap)]
allow_fail: false,
};

crate::bench::benchmark(TestId(0), desc, tx, true, f);
Expand All @@ -764,6 +798,8 @@ fn should_sort_failures_before_printing_them() {
compile_fail: false,
no_run: false,
test_type: TestType::Unknown,
#[cfg(bootstrap)]
allow_fail: false,
};

let test_b = TestDesc {
Expand All @@ -773,6 +809,8 @@ fn should_sort_failures_before_printing_them() {
compile_fail: false,
no_run: false,
test_type: TestType::Unknown,
#[cfg(bootstrap)]
allow_fail: false,
};

let mut out = PrettyFormatter::new(OutputLocation::Raw(Vec::new()), false, 10, false, None);
Expand Down
2 changes: 2 additions & 0 deletions library/test/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ pub struct TestDesc {
pub compile_fail: bool,
pub no_run: bool,
pub test_type: TestType,
#[cfg(bootstrap)]
pub allow_fail: bool,
}

impl TestDesc {
Expand Down
2 changes: 2 additions & 0 deletions src/librustdoc/doctest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -954,6 +954,8 @@ impl Tester for Collector {
compile_fail: config.compile_fail,
no_run,
test_type: test::TestType::DocTest,
#[cfg(bootstrap)]
allow_fail: false,
},
testfn: test::DynTestFn(box move || {
let report_unused_externs = |uext| {
Expand Down
2 changes: 2 additions & 0 deletions src/tools/compiletest/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,8 @@ pub fn make_test_description<R: Read>(
compile_fail: false,
no_run: false,
test_type: test::TestType::Unknown,
#[cfg(bootstrap)]
allow_fail: false,
}
}

Expand Down

0 comments on commit 0b8c9fb

Please sign in to comment.