Add needs-run-enabled directive for should-fail tests
I was wary of doing any automatic disabling here, since should-fail is how we test compiletest itself.
This commit is contained in:
parent
e282fd045a
commit
f64c45a7d2
@ -2,6 +2,7 @@
|
||||
|
||||
// == Test [gdb|lldb]-[command|check] are parsed correctly ===
|
||||
// should-fail
|
||||
// needs-run-enabled
|
||||
// compile-flags:-g
|
||||
|
||||
// === GDB TESTS ===================================================================================
|
||||
|
@ -4,6 +4,7 @@
|
||||
// run-fail
|
||||
// revisions: foo bar
|
||||
// should-fail
|
||||
// needs-run-enabled
|
||||
//[foo] error-pattern:bar
|
||||
//[bar] error-pattern:foo
|
||||
|
||||
|
@ -351,6 +351,15 @@ pub struct Config {
|
||||
pub npm: Option<String>,
|
||||
}
|
||||
|
||||
impl Config {
|
||||
pub fn run_enabled(&self) -> bool {
|
||||
self.run.unwrap_or_else(|| {
|
||||
// Auto-detect whether to run based on the platform.
|
||||
!self.target.ends_with("-fuchsia")
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct TestPaths {
|
||||
pub file: PathBuf, // e.g., compile-test/foo/bar/baz.rs
|
||||
|
@ -85,6 +85,10 @@ impl EarlyProps {
|
||||
props.ignore = true;
|
||||
}
|
||||
|
||||
if !config.run_enabled() && config.parse_name_directive(ln, "needs-run-enabled") {
|
||||
props.ignore = true;
|
||||
}
|
||||
|
||||
if !rustc_has_sanitizer_support
|
||||
&& config.parse_name_directive(ln, "needs-sanitizer-support")
|
||||
{
|
||||
|
@ -369,11 +369,7 @@ impl<'test> TestCx<'test> {
|
||||
}
|
||||
|
||||
fn run_if_enabled(&self) -> WillExecute {
|
||||
let enabled = self.config.run.unwrap_or_else(|| {
|
||||
// Auto-detect whether to run based on the platform.
|
||||
!self.config.target.ends_with("-fuchsia")
|
||||
});
|
||||
if enabled { WillExecute::Yes } else { WillExecute::Disabled }
|
||||
if self.config.run_enabled() { WillExecute::Yes } else { WillExecute::Disabled }
|
||||
}
|
||||
|
||||
fn should_run_successfully(&self, pm: Option<PassMode>) -> bool {
|
||||
|
Loading…
x
Reference in New Issue
Block a user