Migrate the remaining run-make/coverage-reports tests over to run-coverage

To make it easier to verify that the output snapshots have been migrated
faithfully, this change adds some temporary helper code that lets us avoid
having to completely re-bless the existing snapshots.

A later change in this PR will then re-bless the tests and remove the temporary
helper code.
This commit is contained in:
Zalathar 2023-06-12 18:07:04 +10:00
parent 9d2564a110
commit a2c0b38897
16 changed files with 40 additions and 22 deletions

View file

@ -524,6 +524,14 @@ impl<'test> TestCx<'test> {
let proc_res = self.run_llvm_tool("llvm-cov", |cmd| {
cmd.args(["show", "--format=text", "--show-line-counts-or-regions"]);
// Temporarily ignore these files so that we can migrate the
// existing output snapshots mostly as-is.
// This code will be removed later in the same PR.
cmd.args([
"--ignore-filename-regex",
"(uses_crate.rs|uses_inline_crate.rs|unused_mod.rs)",
]);
cmd.arg("--Xdemangler");
cmd.arg(self.config.rust_demangler_path.as_ref().unwrap());
@ -690,6 +698,10 @@ impl<'test> TestCx<'test> {
// Sort the file sections (not including the final empty "section").
let except_last = sections.len() - 1;
(&mut sections[..except_last]).sort();
// Temporarily sort the file sections in reverse order so that we can
// migrate the existing output snapshots mostly as-is.
// This code will be removed later in the same PR.
(&mut sections[..except_last]).sort_by(|a, b| b.cmp(a));
// Join the file sections back into a flat list of lines, with
// sections separated by blank lines.