Skip to content

Commit ec9c14f

Browse files
committed
Allow filtering depending on the comments on a test
1 parent 82a1dcc commit ec9c14f

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

src/config.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,12 @@ impl Config {
117117
fn clone_inner(&self) -> Box<dyn Flag> {
118118
Box::new(NeedsAsmSupport)
119119
}
120-
fn test_condition(&self, config: &Config) -> bool {
120+
fn test_condition(
121+
&self,
122+
config: &Config,
123+
_comments: &Comments,
124+
_revision: &str,
125+
) -> bool {
121126
let target = config.target.as_ref().unwrap();
122127
static ASM_SUPPORTED_ARCHS: &[&str] = &[
123128
"x86", "x86_64", "arm", "aarch64", "riscv32",
@@ -411,9 +416,12 @@ impl Config {
411416
return self.run_only_ignored;
412417
}
413418
if comments.for_revision(revision).any(|r| {
414-
r.custom
415-
.values()
416-
.any(|flags| flags.content.iter().any(|flag| flag.test_condition(self)))
419+
r.custom.values().any(|flags| {
420+
flags
421+
.content
422+
.iter()
423+
.any(|flag| flag.test_condition(self, comments, revision))
424+
})
417425
}) {
418426
return self.run_only_ignored;
419427
}

src/custom_flags.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ use std::{
55
process::{Command, Output},
66
};
77

8-
use crate::{build_manager::BuildManager, per_test_config::TestConfig, Config, Errored};
8+
use crate::{
9+
build_manager::BuildManager, parser::Comments, per_test_config::TestConfig, Config, Errored,
10+
};
911

1012
#[cfg(feature = "rustc")]
1113
pub mod edition;
@@ -29,7 +31,7 @@ pub trait Flag: Send + Sync + UnwindSafe + RefUnwindSafe + std::fmt::Debug {
2931
}
3032

3133
/// Whether this flag causes a test to be filtered out
32-
fn test_condition(&self, _config: &Config) -> bool {
34+
fn test_condition(&self, _config: &Config, _comments: &Comments, _revision: &str) -> bool {
3335
false
3436
}
3537

0 commit comments

Comments
 (0)