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:
parent
9d2564a110
commit
a2c0b38897
16 changed files with 40 additions and 22 deletions
|
@ -524,6 +524,14 @@ impl<'test> TestCx<'test> {
|
||||||
let proc_res = self.run_llvm_tool("llvm-cov", |cmd| {
|
let proc_res = self.run_llvm_tool("llvm-cov", |cmd| {
|
||||||
cmd.args(["show", "--format=text", "--show-line-counts-or-regions"]);
|
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("--Xdemangler");
|
||||||
cmd.arg(self.config.rust_demangler_path.as_ref().unwrap());
|
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").
|
// Sort the file sections (not including the final empty "section").
|
||||||
let except_last = sections.len() - 1;
|
let except_last = sections.len() - 1;
|
||||||
(&mut sections[..except_last]).sort();
|
(&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
|
// Join the file sections back into a flat list of lines, with
|
||||||
// sections separated by blank lines.
|
// sections separated by blank lines.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
../coverage/doctest.rs:
|
$DIR/doctest.rs:
|
||||||
1| |//! This test ensures that code from doctests is properly re-mapped.
|
1| |//! This test ensures that code from doctests is properly re-mapped.
|
||||||
2| |//! See <https://github.com/rust-lang/rust/issues/79417> for more info.
|
2| |//! See <https://github.com/rust-lang/rust/issues/79417> for more info.
|
||||||
3| |//!
|
3| |//!
|
||||||
|
@ -67,7 +67,7 @@
|
||||||
63| |//! doctest_main()
|
63| |//! doctest_main()
|
||||||
64| |//! }
|
64| |//! }
|
||||||
65| |//! ```
|
65| |//! ```
|
||||||
66| |
|
66| |// aux-build:doctest_crate.rs
|
||||||
67| |/// doctest attached to fn testing external code:
|
67| |/// doctest attached to fn testing external code:
|
||||||
68| |/// ```
|
68| |/// ```
|
||||||
69| 1|/// extern crate doctest_crate;
|
69| 1|/// extern crate doctest_crate;
|
||||||
|
@ -102,7 +102,7 @@
|
||||||
98| |// what affect it might have on diagnostic messages from the compiler, and whether anyone would care
|
98| |// what affect it might have on diagnostic messages from the compiler, and whether anyone would care
|
||||||
99| |// if the indentation changed. I don't know if there is a more viable solution.
|
99| |// if the indentation changed. I don't know if there is a more viable solution.
|
||||||
|
|
||||||
../coverage/lib/doctest_crate.rs:
|
$DIR/auxiliary/doctest_crate.rs:
|
||||||
1| |/// A function run only from within doctests
|
1| |/// A function run only from within doctests
|
||||||
2| 3|pub fn fn_run_in_doctests(conditional: usize) {
|
2| 3|pub fn fn_run_in_doctests(conditional: usize) {
|
||||||
3| 3| match conditional {
|
3| 3| match conditional {
|
|
@ -63,7 +63,7 @@
|
||||||
//! doctest_main()
|
//! doctest_main()
|
||||||
//! }
|
//! }
|
||||||
//! ```
|
//! ```
|
||||||
|
// aux-build:doctest_crate.rs
|
||||||
/// doctest attached to fn testing external code:
|
/// doctest attached to fn testing external code:
|
||||||
/// ```
|
/// ```
|
||||||
/// extern crate doctest_crate;
|
/// extern crate doctest_crate;
|
|
@ -1,6 +1,6 @@
|
||||||
#![allow(unused_assignments, unused_variables)]
|
#![allow(unused_assignments, unused_variables)]
|
||||||
// compile-flags: -C opt-level=3 # validates coverage now works with optimizations
|
// compile-flags: -C opt-level=3
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug; // ^^ validates coverage now works with optimizations
|
||||||
|
|
||||||
pub fn used_function() {
|
pub fn used_function() {
|
||||||
// Initialize test constants in a way that cannot be determined at compile time, to ensure
|
// Initialize test constants in a way that cannot be determined at compile time, to ensure
|
|
@ -1,7 +1,7 @@
|
||||||
#![allow(unused_assignments, unused_variables)]
|
#![allow(unused_assignments, unused_variables)]
|
||||||
|
|
||||||
// compile-flags: -C opt-level=3 # validates coverage now works with optimizations
|
// compile-flags: -C opt-level=3
|
||||||
|
// ^^ validates coverage now works with optimizations
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
|
||||||
pub fn used_function() {
|
pub fn used_function() {
|
|
@ -1,6 +1,6 @@
|
||||||
../coverage/issue-85461.rs:
|
$DIR/issue-85461.rs:
|
||||||
1| |// Regression test for #85461: MSVC sometimes fail to link with dead code and #[inline(always)]
|
1| |// Regression test for #85461: MSVC sometimes fail to link with dead code and #[inline(always)]
|
||||||
2| |
|
2| |// aux-build:inline_always_with_dead_code.rs
|
||||||
3| |extern crate inline_always_with_dead_code;
|
3| |extern crate inline_always_with_dead_code;
|
||||||
4| |
|
4| |
|
||||||
5| |use inline_always_with_dead_code::{bar, baz};
|
5| |use inline_always_with_dead_code::{bar, baz};
|
||||||
|
@ -10,7 +10,7 @@
|
||||||
9| 1| baz::call_me();
|
9| 1| baz::call_me();
|
||||||
10| 1|}
|
10| 1|}
|
||||||
|
|
||||||
../coverage/lib/inline_always_with_dead_code.rs:
|
$DIR/auxiliary/inline_always_with_dead_code.rs:
|
||||||
1| |// compile-flags: -Cinstrument-coverage -Ccodegen-units=4 -Copt-level=0
|
1| |// compile-flags: -Cinstrument-coverage -Ccodegen-units=4 -Copt-level=0
|
||||||
2| |
|
2| |
|
||||||
3| |#![allow(dead_code)]
|
3| |#![allow(dead_code)]
|
|
@ -1,5 +1,5 @@
|
||||||
// Regression test for #85461: MSVC sometimes fail to link with dead code and #[inline(always)]
|
// Regression test for #85461: MSVC sometimes fail to link with dead code and #[inline(always)]
|
||||||
|
// aux-build:inline_always_with_dead_code.rs
|
||||||
extern crate inline_always_with_dead_code;
|
extern crate inline_always_with_dead_code;
|
||||||
|
|
||||||
use inline_always_with_dead_code::{bar, baz};
|
use inline_always_with_dead_code::{bar, baz};
|
|
@ -1,4 +1,4 @@
|
||||||
#[path = "lib/unused_mod_helper.rs"]
|
#[path = "auxiliary/unused_mod_helper.rs"]
|
||||||
mod unused_module;
|
mod unused_module;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
|
@ -1,6 +1,6 @@
|
||||||
1| |#![allow(unused_assignments, unused_variables)]
|
1| |#![allow(unused_assignments, unused_variables)]
|
||||||
2| |// compile-flags: -C opt-level=3 # validates coverage now works with optimizations
|
2| |// compile-flags: -C opt-level=3
|
||||||
3| |use std::fmt::Debug;
|
3| |use std::fmt::Debug; // ^^ validates coverage now works with optimizations
|
||||||
4| |
|
4| |
|
||||||
5| 1|pub fn used_function() {
|
5| 1|pub fn used_function() {
|
||||||
6| 1| // Initialize test constants in a way that cannot be determined at compile time, to ensure
|
6| 1| // Initialize test constants in a way that cannot be determined at compile time, to ensure
|
|
@ -1,8 +1,12 @@
|
||||||
// FIXME #110395
|
// FIXME #110395
|
||||||
// ignore-llvm-cov-show-diffs
|
// ignore-linux
|
||||||
|
|
||||||
|
// Validates coverage now works with optimizations
|
||||||
|
// compile-flags: -C opt-level=3
|
||||||
|
|
||||||
#![allow(unused_assignments, unused_variables)]
|
#![allow(unused_assignments, unused_variables)]
|
||||||
// compile-flags: -C opt-level=3 # validates coverage now works with optimizations
|
|
||||||
|
// aux-build:used_crate.rs
|
||||||
extern crate used_crate;
|
extern crate used_crate;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
|
@ -1,7 +1,7 @@
|
||||||
1| |#![allow(unused_assignments, unused_variables)]
|
1| |#![allow(unused_assignments, unused_variables)]
|
||||||
2| |
|
2| |
|
||||||
3| |// compile-flags: -C opt-level=3 # validates coverage now works with optimizations
|
3| |// compile-flags: -C opt-level=3
|
||||||
4| |
|
4| |// ^^ validates coverage now works with optimizations
|
||||||
5| |use std::fmt::Debug;
|
5| |use std::fmt::Debug;
|
||||||
6| |
|
6| |
|
||||||
7| 1|pub fn used_function() {
|
7| 1|pub fn used_function() {
|
|
@ -1,10 +1,12 @@
|
||||||
// FIXME #110395
|
// FIXME #110395
|
||||||
// ignore-llvm-cov-show-diffs
|
// ignore-linux
|
||||||
|
|
||||||
|
// Validates coverage now works with optimizations
|
||||||
|
// compile-flags: -C opt-level=3
|
||||||
|
|
||||||
#![allow(unused_assignments, unused_variables)]
|
#![allow(unused_assignments, unused_variables)]
|
||||||
|
|
||||||
// compile-flags: -C opt-level=3 # validates coverage now works with optimizations
|
// aux-build:used_inline_crate.rs
|
||||||
|
|
||||||
extern crate used_inline_crate;
|
extern crate used_inline_crate;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
Loading…
Add table
Add a link
Reference in a new issue