Re-bless the newly-migrated tests

This commit is contained in:
Zalathar 2023-06-12 18:07:04 +10:00
parent a2c0b38897
commit edd051c31e
6 changed files with 79 additions and 35 deletions

View File

@ -524,14 +524,6 @@ 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());
@ -698,10 +690,6 @@ 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.

View File

@ -1,3 +1,14 @@
$DIR/auxiliary/doctest_crate.rs:
1| |/// A function run only from within doctests
2| 3|pub fn fn_run_in_doctests(conditional: usize) {
3| 3| match conditional {
4| 1| 1 => assert_eq!(1, 1), // this is run,
5| 1| 2 => assert_eq!(1, 1), // this,
6| 1| 3 => assert_eq!(1, 1), // and this too
7| 0| _ => assert_eq!(1, 2), // however this is not
8| | }
9| 3|}
$DIR/doctest.rs:
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.
@ -102,14 +113,3 @@ $DIR/doctest.rs:
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.
$DIR/auxiliary/doctest_crate.rs:
1| |/// A function run only from within doctests
2| 3|pub fn fn_run_in_doctests(conditional: usize) {
3| 3| match conditional {
4| 1| 1 => assert_eq!(1, 1), // this is run,
5| 1| 2 => assert_eq!(1, 1), // this,
6| 1| 3 => assert_eq!(1, 1), // and this too
7| 0| _ => assert_eq!(1, 2), // however this is not
8| | }
9| 3|}

View File

@ -1,15 +1,3 @@
$DIR/issue-85461.rs:
1| |// Regression test for #85461: MSVC sometimes fail to link with dead code and #[inline(always)]
2| |// aux-build:inline_always_with_dead_code.rs
3| |extern crate inline_always_with_dead_code;
4| |
5| |use inline_always_with_dead_code::{bar, baz};
6| |
7| 1|fn main() {
8| 1| bar::call_me();
9| 1| baz::call_me();
10| 1|}
$DIR/auxiliary/inline_always_with_dead_code.rs:
1| |// compile-flags: -Cinstrument-coverage -Ccodegen-units=4 -Copt-level=0
2| |
@ -34,3 +22,15 @@ $DIR/auxiliary/inline_always_with_dead_code.rs:
21| 1| }
22| |}
$DIR/issue-85461.rs:
1| |// Regression test for #85461: MSVC sometimes fail to link with dead code and #[inline(always)]
2| |// aux-build:inline_always_with_dead_code.rs
3| |extern crate inline_always_with_dead_code;
4| |
5| |use inline_always_with_dead_code::{bar, baz};
6| |
7| 1|fn main() {
8| 1| bar::call_me();
9| 1| baz::call_me();
10| 1|}

View File

@ -1,4 +1,13 @@
$DIR/auxiliary/unused_mod_helper.rs:
1| 0|pub fn never_called_function() {
2| 0| println!("I am never called");
3| 0|}
$DIR/unused_mod.rs:
1| |#[path = "auxiliary/unused_mod_helper.rs"]
2| |mod unused_module;
3| |
4| 1|fn main() {
5| 1| println!("hello world!");
6| 1|}

View File

@ -1,3 +1,4 @@
$DIR/auxiliary/used_crate.rs:
1| |#![allow(unused_assignments, unused_variables)]
2| |// compile-flags: -C opt-level=3
3| |use std::fmt::Debug; // ^^ validates coverage now works with optimizations
@ -146,3 +147,24 @@
99| |// functions" list, which would then omit coverage results for
100| |// `unused_generic_function<T>()`, below.
$DIR/uses_crate.rs:
1| |// FIXME #110395
2| |// ignore-linux
3| |
4| |// Validates coverage now works with optimizations
5| |// compile-flags: -C opt-level=3
6| |
7| |#![allow(unused_assignments, unused_variables)]
8| |
9| |// aux-build:used_crate.rs
10| |extern crate used_crate;
11| |
12| 1|fn main() {
13| 1| used_crate::used_function();
14| 1| let some_vec = vec![1, 2, 3, 4];
15| 1| used_crate::used_only_from_bin_crate_generic_function(&some_vec);
16| 1| used_crate::used_only_from_bin_crate_generic_function("used from bin uses_crate.rs");
17| 1| used_crate::used_from_bin_crate_and_lib_crate_generic_function(some_vec);
18| 1| used_crate::used_with_same_type_from_bin_crate_and_lib_crate_generic_function("interesting?");
19| 1|}

View File

@ -1,3 +1,4 @@
$DIR/auxiliary/used_inline_crate.rs:
1| |#![allow(unused_assignments, unused_variables)]
2| |
3| |// compile-flags: -C opt-level=3
@ -137,3 +138,27 @@
89| 2| used_only_from_this_lib_crate_generic_function("used ONLY from library used_crate.rs");
90| 2|}
$DIR/uses_inline_crate.rs:
1| |// FIXME #110395
2| |// ignore-linux
3| |
4| |// Validates coverage now works with optimizations
5| |// compile-flags: -C opt-level=3
6| |
7| |#![allow(unused_assignments, unused_variables)]
8| |
9| |// aux-build:used_inline_crate.rs
10| |extern crate used_inline_crate;
11| |
12| 1|fn main() {
13| 1| used_inline_crate::used_function();
14| 1| used_inline_crate::used_inline_function();
15| 1| let some_vec = vec![1, 2, 3, 4];
16| 1| used_inline_crate::used_only_from_bin_crate_generic_function(&some_vec);
17| 1| used_inline_crate::used_only_from_bin_crate_generic_function("used from bin uses_crate.rs");
18| 1| used_inline_crate::used_from_bin_crate_and_lib_crate_generic_function(some_vec);
19| 1| used_inline_crate::used_with_same_type_from_bin_crate_and_lib_crate_generic_function(
20| 1| "interesting?",
21| 1| );
22| 1|}