Skip to content

Commit edd051c

Browse files
committed
Re-bless the newly-migrated tests
1 parent a2c0b38 commit edd051c

File tree

6 files changed

+79
-35
lines changed

6 files changed

+79
-35
lines changed

src/tools/compiletest/src/runtest.rs

-12
Original file line numberDiff line numberDiff line change
@@ -524,14 +524,6 @@ impl<'test> TestCx<'test> {
524524
let proc_res = self.run_llvm_tool("llvm-cov", |cmd| {
525525
cmd.args(["show", "--format=text", "--show-line-counts-or-regions"]);
526526

527-
// Temporarily ignore these files so that we can migrate the
528-
// existing output snapshots mostly as-is.
529-
// This code will be removed later in the same PR.
530-
cmd.args([
531-
"--ignore-filename-regex",
532-
"(uses_crate.rs|uses_inline_crate.rs|unused_mod.rs)",
533-
]);
534-
535527
cmd.arg("--Xdemangler");
536528
cmd.arg(self.config.rust_demangler_path.as_ref().unwrap());
537529

@@ -698,10 +690,6 @@ impl<'test> TestCx<'test> {
698690
// Sort the file sections (not including the final empty "section").
699691
let except_last = sections.len() - 1;
700692
(&mut sections[..except_last]).sort();
701-
// Temporarily sort the file sections in reverse order so that we can
702-
// migrate the existing output snapshots mostly as-is.
703-
// This code will be removed later in the same PR.
704-
(&mut sections[..except_last]).sort_by(|a, b| b.cmp(a));
705693

706694
// Join the file sections back into a flat list of lines, with
707695
// sections separated by blank lines.

tests/run-coverage-rustdoc/doctest.coverage

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
$DIR/auxiliary/doctest_crate.rs:
2+
1| |/// A function run only from within doctests
3+
2| 3|pub fn fn_run_in_doctests(conditional: usize) {
4+
3| 3| match conditional {
5+
4| 1| 1 => assert_eq!(1, 1), // this is run,
6+
5| 1| 2 => assert_eq!(1, 1), // this,
7+
6| 1| 3 => assert_eq!(1, 1), // and this too
8+
7| 0| _ => assert_eq!(1, 2), // however this is not
9+
8| | }
10+
9| 3|}
11+
112
$DIR/doctest.rs:
213
1| |//! This test ensures that code from doctests is properly re-mapped.
314
2| |//! See <https://github.com/rust-lang/rust/issues/79417> for more info.
@@ -102,14 +113,3 @@ $DIR/doctest.rs:
102113
98| |// what affect it might have on diagnostic messages from the compiler, and whether anyone would care
103114
99| |// if the indentation changed. I don't know if there is a more viable solution.
104115

105-
$DIR/auxiliary/doctest_crate.rs:
106-
1| |/// A function run only from within doctests
107-
2| 3|pub fn fn_run_in_doctests(conditional: usize) {
108-
3| 3| match conditional {
109-
4| 1| 1 => assert_eq!(1, 1), // this is run,
110-
5| 1| 2 => assert_eq!(1, 1), // this,
111-
6| 1| 3 => assert_eq!(1, 1), // and this too
112-
7| 0| _ => assert_eq!(1, 2), // however this is not
113-
8| | }
114-
9| 3|}
115-

tests/run-coverage/issue-85461.coverage

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

25+
$DIR/issue-85461.rs:
26+
1| |// Regression test for #85461: MSVC sometimes fail to link with dead code and #[inline(always)]
27+
2| |// aux-build:inline_always_with_dead_code.rs
28+
3| |extern crate inline_always_with_dead_code;
29+
4| |
30+
5| |use inline_always_with_dead_code::{bar, baz};
31+
6| |
32+
7| 1|fn main() {
33+
8| 1| bar::call_me();
34+
9| 1| baz::call_me();
35+
10| 1|}
36+
+9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1+
$DIR/auxiliary/unused_mod_helper.rs:
12
1| 0|pub fn never_called_function() {
23
2| 0| println!("I am never called");
34
3| 0|}
45

6+
$DIR/unused_mod.rs:
7+
1| |#[path = "auxiliary/unused_mod_helper.rs"]
8+
2| |mod unused_module;
9+
3| |
10+
4| 1|fn main() {
11+
5| 1| println!("hello world!");
12+
6| 1|}
13+

tests/run-coverage/uses_crate.coverage

+22
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
$DIR/auxiliary/used_crate.rs:
12
1| |#![allow(unused_assignments, unused_variables)]
23
2| |// compile-flags: -C opt-level=3
34
3| |use std::fmt::Debug; // ^^ validates coverage now works with optimizations
@@ -146,3 +147,24 @@
146147
99| |// functions" list, which would then omit coverage results for
147148
100| |// `unused_generic_function<T>()`, below.
148149

150+
$DIR/uses_crate.rs:
151+
1| |// FIXME #110395
152+
2| |// ignore-linux
153+
3| |
154+
4| |// Validates coverage now works with optimizations
155+
5| |// compile-flags: -C opt-level=3
156+
6| |
157+
7| |#![allow(unused_assignments, unused_variables)]
158+
8| |
159+
9| |// aux-build:used_crate.rs
160+
10| |extern crate used_crate;
161+
11| |
162+
12| 1|fn main() {
163+
13| 1| used_crate::used_function();
164+
14| 1| let some_vec = vec![1, 2, 3, 4];
165+
15| 1| used_crate::used_only_from_bin_crate_generic_function(&some_vec);
166+
16| 1| used_crate::used_only_from_bin_crate_generic_function("used from bin uses_crate.rs");
167+
17| 1| used_crate::used_from_bin_crate_and_lib_crate_generic_function(some_vec);
168+
18| 1| used_crate::used_with_same_type_from_bin_crate_and_lib_crate_generic_function("interesting?");
169+
19| 1|}
170+

tests/run-coverage/uses_inline_crate.coverage

+25
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
$DIR/auxiliary/used_inline_crate.rs:
12
1| |#![allow(unused_assignments, unused_variables)]
23
2| |
34
3| |// compile-flags: -C opt-level=3
@@ -137,3 +138,27 @@
137138
89| 2| used_only_from_this_lib_crate_generic_function("used ONLY from library used_crate.rs");
138139
90| 2|}
139140

141+
$DIR/uses_inline_crate.rs:
142+
1| |// FIXME #110395
143+
2| |// ignore-linux
144+
3| |
145+
4| |// Validates coverage now works with optimizations
146+
5| |// compile-flags: -C opt-level=3
147+
6| |
148+
7| |#![allow(unused_assignments, unused_variables)]
149+
8| |
150+
9| |// aux-build:used_inline_crate.rs
151+
10| |extern crate used_inline_crate;
152+
11| |
153+
12| 1|fn main() {
154+
13| 1| used_inline_crate::used_function();
155+
14| 1| used_inline_crate::used_inline_function();
156+
15| 1| let some_vec = vec![1, 2, 3, 4];
157+
16| 1| used_inline_crate::used_only_from_bin_crate_generic_function(&some_vec);
158+
17| 1| used_inline_crate::used_only_from_bin_crate_generic_function("used from bin uses_crate.rs");
159+
18| 1| used_inline_crate::used_from_bin_crate_and_lib_crate_generic_function(some_vec);
160+
19| 1| used_inline_crate::used_with_same_type_from_bin_crate_and_lib_crate_generic_function(
161+
20| 1| "interesting?",
162+
21| 1| );
163+
22| 1|}
164+

0 commit comments

Comments
 (0)