Skip to content

Commit

Permalink
Fix up run-coverage and coverage-map/status-quo tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bossmc committed Sep 8, 2023
1 parent 726a7b9 commit 0ca6c38
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 45 deletions.
2 changes: 1 addition & 1 deletion tests/coverage-map/status-quo/closure_macro.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// compile-flags: --edition=2018
#![feature(no_coverage)]
#![feature(coverage_attribute)]

macro_rules! bail {
($msg:literal $(,)?) => {
Expand Down
14 changes: 7 additions & 7 deletions tests/coverage-map/status-quo/closure_macro_async.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// compile-flags: --edition=2018
#![feature(no_coverage)]
#![feature(coverage_attribute)]

macro_rules! bail {
($msg:literal $(,)?) => {
Expand Down Expand Up @@ -39,7 +39,7 @@ pub async fn test() -> Result<(), String> {
Ok(())
}

#[no_coverage]
#[coverage(off)]
fn main() {
executor::block_on(test()).unwrap();
}
Expand All @@ -51,18 +51,18 @@ mod executor {
task::{Context, Poll, RawWaker, RawWakerVTable, Waker},
};

#[no_coverage]
#[coverage(off)]
pub fn block_on<F: Future>(mut future: F) -> F::Output {
let mut future = unsafe { Pin::new_unchecked(&mut future) };
use std::hint::unreachable_unchecked;
static VTABLE: RawWakerVTable = RawWakerVTable::new(
#[no_coverage]
#[coverage(off)]
|_| unsafe { unreachable_unchecked() }, // clone
#[no_coverage]
#[coverage(off)]
|_| unsafe { unreachable_unchecked() }, // wake
#[no_coverage]
#[coverage(off)]
|_| unsafe { unreachable_unchecked() }, // wake_by_ref
#[no_coverage]
#[coverage(off)]
|_| (),
);
let waker = unsafe { Waker::from_raw(RawWaker::new(core::ptr::null(), &VTABLE)) };
Expand Down
14 changes: 7 additions & 7 deletions tests/coverage-map/status-quo/no_cov_crate.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// Enables `no_coverage` on the entire crate
#![feature(no_coverage)]
// Enables `coverage(off)` on the entire crate
#![feature(coverage_attribute)]

#[no_coverage]
#[coverage(off)]
fn do_not_add_coverage_1() {
println!("called but not covered");
}

fn do_not_add_coverage_2() {
#![no_coverage]
#![coverage(off)]
println!("called but not covered");
}

#[no_coverage]
#[coverage(off)]
#[allow(dead_code)]
fn do_not_add_coverage_not_called() {
println!("not called and not covered");
Expand All @@ -33,7 +33,7 @@ fn add_coverage_not_called() {
// FIXME: These test-cases illustrate confusing results of nested functions.
// See https://github.com/rust-lang/rust/issues/93319
mod nested_fns {
#[no_coverage]
#[coverage(off)]
pub fn outer_not_covered(is_true: bool) {
fn inner(is_true: bool) {
if is_true {
Expand All @@ -50,7 +50,7 @@ mod nested_fns {
println!("called and covered");
inner_not_covered(is_true);

#[no_coverage]
#[coverage(off)]
fn inner_not_covered(is_true: bool) {
if is_true {
println!("called but not covered");
Expand Down
2 changes: 1 addition & 1 deletion tests/run-coverage/closure_macro.coverage
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
LL| |// compile-flags: --edition=2018
LL| |#![feature(no_coverage)]
LL| |#![feature(coverage_attribute)]
LL| |
LL| |macro_rules! bail {
LL| | ($msg:literal $(,)?) => {
Expand Down
2 changes: 1 addition & 1 deletion tests/run-coverage/closure_macro.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// compile-flags: --edition=2018
#![feature(no_coverage)]
#![feature(coverage_attribute)]

macro_rules! bail {
($msg:literal $(,)?) => {
Expand Down
14 changes: 7 additions & 7 deletions tests/run-coverage/closure_macro_async.coverage
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
LL| |// compile-flags: --edition=2018
LL| |#![feature(no_coverage)]
LL| |#![feature(coverage_attribute)]
LL| |
LL| |macro_rules! bail {
LL| | ($msg:literal $(,)?) => {
Expand Down Expand Up @@ -40,7 +40,7 @@
LL| 1| Ok(())
LL| 1|}
LL| |
LL| |#[no_coverage]
LL| |#[coverage(off)]
LL| |fn main() {
LL| | executor::block_on(test()).unwrap();
LL| |}
Expand All @@ -52,18 +52,18 @@
LL| | task::{Context, Poll, RawWaker, RawWakerVTable, Waker},
LL| | };
LL| |
LL| | #[no_coverage]
LL| | #[coverage(off)]
LL| | pub fn block_on<F: Future>(mut future: F) -> F::Output {
LL| | let mut future = unsafe { Pin::new_unchecked(&mut future) };
LL| | use std::hint::unreachable_unchecked;
LL| | static VTABLE: RawWakerVTable = RawWakerVTable::new(
LL| | #[no_coverage]
LL| | #[coverage(off)]
LL| | |_| unsafe { unreachable_unchecked() }, // clone
LL| | #[no_coverage]
LL| | #[coverage(off)]
LL| | |_| unsafe { unreachable_unchecked() }, // wake
LL| | #[no_coverage]
LL| | #[coverage(off)]
LL| | |_| unsafe { unreachable_unchecked() }, // wake_by_ref
LL| | #[no_coverage]
LL| | #[coverage(off)]
LL| | |_| (),
LL| | );
LL| | let waker = unsafe { Waker::from_raw(RawWaker::new(core::ptr::null(), &VTABLE)) };
Expand Down
14 changes: 7 additions & 7 deletions tests/run-coverage/closure_macro_async.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// compile-flags: --edition=2018
#![feature(no_coverage)]
#![feature(coverage_attribute)]

macro_rules! bail {
($msg:literal $(,)?) => {
Expand Down Expand Up @@ -39,7 +39,7 @@ pub async fn test() -> Result<(), String> {
Ok(())
}

#[no_coverage]
#[coverage(off)]
fn main() {
executor::block_on(test()).unwrap();
}
Expand All @@ -51,18 +51,18 @@ mod executor {
task::{Context, Poll, RawWaker, RawWakerVTable, Waker},
};

#[no_coverage]
#[coverage(off)]
pub fn block_on<F: Future>(mut future: F) -> F::Output {
let mut future = unsafe { Pin::new_unchecked(&mut future) };
use std::hint::unreachable_unchecked;
static VTABLE: RawWakerVTable = RawWakerVTable::new(
#[no_coverage]
#[coverage(off)]
|_| unsafe { unreachable_unchecked() }, // clone
#[no_coverage]
#[coverage(off)]
|_| unsafe { unreachable_unchecked() }, // wake
#[no_coverage]
#[coverage(off)]
|_| unsafe { unreachable_unchecked() }, // wake_by_ref
#[no_coverage]
#[coverage(off)]
|_| (),
);
let waker = unsafe { Waker::from_raw(RawWaker::new(core::ptr::null(), &VTABLE)) };
Expand Down
14 changes: 7 additions & 7 deletions tests/run-coverage/no_cov_crate.coverage
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
LL| |// Enables `no_coverage` on the entire crate
LL| |#![feature(no_coverage)]
LL| |// Enables `coverage(off)` on the entire crate
LL| |#![feature(coverage_attribute)]
LL| |
LL| |#[no_coverage]
LL| |#[coverage(off)]
LL| |fn do_not_add_coverage_1() {
LL| | println!("called but not covered");
LL| |}
LL| |
LL| |fn do_not_add_coverage_2() {
LL| | #![no_coverage]
LL| | #![coverage(off)]
LL| | println!("called but not covered");
LL| |}
LL| |
LL| |#[no_coverage]
LL| |#[coverage(off)]
LL| |#[allow(dead_code)]
LL| |fn do_not_add_coverage_not_called() {
LL| | println!("not called and not covered");
Expand All @@ -33,7 +33,7 @@
LL| |// FIXME: These test-cases illustrate confusing results of nested functions.
LL| |// See https://github.com/rust-lang/rust/issues/93319
LL| |mod nested_fns {
LL| | #[no_coverage]
LL| | #[coverage(off)]
LL| | pub fn outer_not_covered(is_true: bool) {
LL| 1| fn inner(is_true: bool) {
LL| 1| if is_true {
Expand All @@ -50,7 +50,7 @@
LL| 1| println!("called and covered");
LL| 1| inner_not_covered(is_true);
LL| 1|
LL| 1| #[no_coverage]
LL| 1| #[coverage(off)]
LL| 1| fn inner_not_covered(is_true: bool) {
LL| 1| if is_true {
LL| 1| println!("called but not covered");
Expand Down
14 changes: 7 additions & 7 deletions tests/run-coverage/no_cov_crate.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// Enables `no_coverage` on the entire crate
#![feature(no_coverage)]
// Enables `coverage(off)` on the entire crate
#![feature(coverage_attribute)]

#[no_coverage]
#[coverage(off)]
fn do_not_add_coverage_1() {
println!("called but not covered");
}

fn do_not_add_coverage_2() {
#![no_coverage]
#![coverage(off)]
println!("called but not covered");
}

#[no_coverage]
#[coverage(off)]
#[allow(dead_code)]
fn do_not_add_coverage_not_called() {
println!("not called and not covered");
Expand All @@ -33,7 +33,7 @@ fn add_coverage_not_called() {
// FIXME: These test-cases illustrate confusing results of nested functions.
// See https://github.com/rust-lang/rust/issues/93319
mod nested_fns {
#[no_coverage]
#[coverage(off)]
pub fn outer_not_covered(is_true: bool) {
fn inner(is_true: bool) {
if is_true {
Expand All @@ -50,7 +50,7 @@ mod nested_fns {
println!("called and covered");
inner_not_covered(is_true);

#[no_coverage]
#[coverage(off)]
fn inner_not_covered(is_true: bool) {
if is_true {
println!("called but not covered");
Expand Down

0 comments on commit 0ca6c38

Please sign in to comment.