Skip to content

Commit 83a0722

Browse files
test(cts): allow comma-separated backend list in fails-if(…)
1 parent 5cbab61 commit 83a0722

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

xtask/src/cts.rs

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const CTS_DEFAULT_TEST_LIST: &str = "cts_runner/test.lst";
5353
#[derive(Default)]
5454
struct TestLine {
5555
pub selector: OsString,
56-
pub fails_if: Option<String>,
56+
pub fails_if: Vec<String>,
5757
}
5858

5959
pub fn run_cts(
@@ -98,9 +98,11 @@ pub fn run_cts(
9898
for file in list_files {
9999
tests.extend(shell.read_file(file)?.lines().filter_map(|line| {
100100
static TEST_LINE_REGEX: LazyLock<Regex> = LazyLock::new(|| {
101-
RegexBuilder::new(r#"(?:fails-if\s*\(\s*(?<fails_if>\w+)\s*\)\s+)?(?<selector>.*)"#)
102-
.build()
103-
.unwrap()
101+
RegexBuilder::new(
102+
r#"(?:fails-if\s*\(\s*(?<fails_if>\w+(?:,\w+)*?)\s*\)\s+)?(?<selector>.*)"#,
103+
)
104+
.build()
105+
.unwrap()
104106
});
105107

106108
let trimmed = line.trim();
@@ -110,7 +112,15 @@ pub fn run_cts(
110112
.expect("Invalid test line: {trimmed}");
111113
(!trimmed.is_empty() && !is_comment).then(|| TestLine {
112114
selector: OsString::from(&captures["selector"]),
113-
fails_if: captures.name("fails_if").map(|m| m.as_str().to_string()),
115+
fails_if: captures
116+
.name("fails_if")
117+
.map(|m| {
118+
m.as_str()
119+
.split_terminator(',')
120+
.map(|m| m.to_string())
121+
.collect()
122+
})
123+
.unwrap_or_default(),
114124
})
115125
}))
116126
}
@@ -237,16 +247,15 @@ pub fn run_cts(
237247

238248
log::info!("Running CTS");
239249
for test in &tests {
240-
match (&test.fails_if, &running_on_backend) {
241-
(Some(backend), Some(running_on_backend)) if backend == running_on_backend => {
250+
if let Some(running_on_backend) = &running_on_backend {
251+
if test.fails_if.contains(running_on_backend) {
242252
log::info!(
243253
"Skipping {} on {} backend",
244254
test.selector.to_string_lossy(),
245255
running_on_backend,
246256
);
247257
continue;
248258
}
249-
_ => {}
250259
}
251260

252261
log::info!("Running {}", test.selector.to_string_lossy());

0 commit comments

Comments
 (0)