Skip to content

Commit feba2ed

Browse files
authored
Merge pull request #2144 from Kobzol/test-workspace
Add a test for existence of `[workspace]` in compile benchmarks
2 parents 9cae27a + 6daba8d commit feba2ed

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

collector/compile-benchmarks/cranelift-codegen-0.119.0/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,3 +250,5 @@ check-cfg = [
250250
"cfg(pulley_tail_calls)",
251251
"cfg(pulley_assume_llvm_makes_tail_calls)",
252252
]
253+
254+
[workspace]

collector/compile-benchmarks/diesel-2.2.10/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,3 +272,5 @@ version = "1.0.3"
272272

273273
[dev-dependencies.tempfile]
274274
version = "3.10.1"
275+
276+
[workspace]

collector/compile-benchmarks/image-0.25.6/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,3 +233,5 @@ serde = ["dep:serde"]
233233
tga = []
234234
tiff = ["dep:tiff"]
235235
webp = ["dep:image-webp"]
236+
237+
[workspace]

collector/src/compile/benchmark/mod.rs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -620,13 +620,22 @@ mod tests {
620620
#[test]
621621
fn check_compile_benchmarks() {
622622
// Check that we can deserialize all perf-config.json files in the compile benchmark
623-
// directory.
623+
// directory and that they have [workspace] in their Cargo.toml.
624624
let root = env!("CARGO_MANIFEST_DIR");
625-
let benchmarks = get_compile_benchmarks(
626-
&Path::new(root).join("compile-benchmarks"),
627-
CompileBenchmarkFilter::All,
628-
)
629-
.unwrap();
625+
let benchmark_dir = Path::new(root).join("compile-benchmarks");
626+
let benchmarks =
627+
get_compile_benchmarks(&benchmark_dir, CompileBenchmarkFilter::All).unwrap();
630628
assert!(!benchmarks.is_empty());
629+
630+
for benchmark in benchmarks {
631+
let dir = benchmark_dir.join(&benchmark.name.0);
632+
let cargo_toml = std::fs::read_to_string(&dir.join("Cargo.toml"))
633+
.expect(&format!("Cannot read Cargo.toml of {}", benchmark.name));
634+
assert!(
635+
cargo_toml.contains("[workspace]"),
636+
"{} does not contain [workspace] in its Cargo.toml",
637+
benchmark.name
638+
);
639+
}
631640
}
632641
}

0 commit comments

Comments
 (0)