summaryrefslogtreecommitdiffstats
path: root/tests/run-make/coverage
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
commit9835e2ae736235810b4ea1c162ca5e65c547e770 (patch)
tree3fcebf40ed70e581d776a8a4c65923e8ec20e026 /tests/run-make/coverage
parentReleasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff)
downloadrustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz
rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/run-make/coverage')
-rw-r--r--tests/run-make/coverage/sort_groups.rs23
-rw-r--r--tests/run-make/coverage/test_harness.rs10
-rw-r--r--tests/run-make/coverage/uses_crate.rs3
-rw-r--r--tests/run-make/coverage/uses_inline_crate.rs3
4 files changed, 39 insertions, 0 deletions
diff --git a/tests/run-make/coverage/sort_groups.rs b/tests/run-make/coverage/sort_groups.rs
new file mode 100644
index 000000000..f89f9f3ec
--- /dev/null
+++ b/tests/run-make/coverage/sort_groups.rs
@@ -0,0 +1,23 @@
+// compile-flags: --edition=2021
+
+// Demonstrate that `sort_subviews.py` can sort instantiation groups into a
+// predictable order, while preserving their heterogeneous contents.
+
+fn main() {
+ let cond = std::env::args().len() > 1;
+ generic_fn::<()>(cond);
+ generic_fn::<&'static str>(!cond);
+ if false {
+ generic_fn::<char>(cond);
+ }
+ generic_fn::<i32>(cond);
+ other_fn();
+}
+
+fn generic_fn<T>(cond: bool) {
+ if cond {
+ println!("{}", std::any::type_name::<T>());
+ }
+}
+
+fn other_fn() {}
diff --git a/tests/run-make/coverage/test_harness.rs b/tests/run-make/coverage/test_harness.rs
new file mode 100644
index 000000000..12a755734
--- /dev/null
+++ b/tests/run-make/coverage/test_harness.rs
@@ -0,0 +1,10 @@
+// Verify that the entry point injected by the test harness doesn't cause
+// weird artifacts in the coverage report (e.g. issue #10749).
+
+// compile-flags: --test
+
+#[allow(dead_code)]
+fn unused() {}
+
+#[test]
+fn my_test() {}
diff --git a/tests/run-make/coverage/uses_crate.rs b/tests/run-make/coverage/uses_crate.rs
index 20cb05fe5..1ee8037a1 100644
--- a/tests/run-make/coverage/uses_crate.rs
+++ b/tests/run-make/coverage/uses_crate.rs
@@ -1,3 +1,6 @@
+// FIXME #110395
+// ignore-llvm-cov-show-diffs
+
#![allow(unused_assignments, unused_variables)]
// compile-flags: -C opt-level=3 # validates coverage now works with optimizations
extern crate used_crate;
diff --git a/tests/run-make/coverage/uses_inline_crate.rs b/tests/run-make/coverage/uses_inline_crate.rs
index a7fe8532b..f7aff3c3f 100644
--- a/tests/run-make/coverage/uses_inline_crate.rs
+++ b/tests/run-make/coverage/uses_inline_crate.rs
@@ -1,3 +1,6 @@
+// FIXME #110395
+// ignore-llvm-cov-show-diffs
+
#![allow(unused_assignments, unused_variables)]
// compile-flags: -C opt-level=3 # validates coverage now works with optimizations