Skip to content

Commit 3d5e301

Browse files
LegNeatoFirestar99
andauthored
Support more test names in difftest (#313)
* Support more test names in difftest These all now work. Previously, the path ones did not work: - cargo difftest -- difftests::arch::workgroup_memory (original format) - cargo difftest -- arch/workgroup_memory (path-like format) - cargo difftest -- arch (directory filter) * remove unnecessary `difftests::` prepend --------- Co-authored-by: Firestar99 <firestar99@sydow.cloud>
1 parent f583740 commit 3d5e301

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/difftests/bin/src/main.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,27 @@ fn main() -> Result<()> {
111111
})
112112
.collect();
113113

114+
// If filters are provided that look like paths (contain '/'), convert them to test names
115+
let opts = if opts.filters.iter().any(|f| f.contains('/')) {
116+
let mut new_opts = opts;
117+
new_opts.filters = new_opts
118+
.filters
119+
.into_iter()
120+
.map(|filter| {
121+
if filter.contains('/') {
122+
// Convert path-like filter to test name format
123+
let path_filter = filter.replace('/', "::");
124+
format!("{}", path_filter)
125+
} else {
126+
filter
127+
}
128+
})
129+
.collect();
130+
new_opts
131+
} else {
132+
opts
133+
};
134+
114135
let passed = run_tests_console(&opts, tests).expect("Failed to run tests");
115136

116137
process::exit(if passed { 0 } else { 1 });

0 commit comments

Comments
 (0)