1
Fork 0

Fix up run-coverage and coverage-map/status-quo tests

This commit is contained in:
Andy Caldwell 2023-09-05 23:42:57 +01:00
parent 726a7b9439
commit 0ca6c38cc2
No known key found for this signature in database
GPG key ID: D4204541AC1D228D
9 changed files with 45 additions and 45 deletions

View file

@ -1,5 +1,5 @@
// compile-flags: --edition=2018 // compile-flags: --edition=2018
#![feature(no_coverage)] #![feature(coverage_attribute)]
macro_rules! bail { macro_rules! bail {
($msg:literal $(,)?) => { ($msg:literal $(,)?) => {

View file

@ -1,5 +1,5 @@
// compile-flags: --edition=2018 // compile-flags: --edition=2018
#![feature(no_coverage)] #![feature(coverage_attribute)]
macro_rules! bail { macro_rules! bail {
($msg:literal $(,)?) => { ($msg:literal $(,)?) => {
@ -39,7 +39,7 @@ pub async fn test() -> Result<(), String> {
Ok(()) Ok(())
} }
#[no_coverage] #[coverage(off)]
fn main() { fn main() {
executor::block_on(test()).unwrap(); executor::block_on(test()).unwrap();
} }
@ -51,18 +51,18 @@ mod executor {
task::{Context, Poll, RawWaker, RawWakerVTable, Waker}, task::{Context, Poll, RawWaker, RawWakerVTable, Waker},
}; };
#[no_coverage] #[coverage(off)]
pub fn block_on<F: Future>(mut future: F) -> F::Output { pub fn block_on<F: Future>(mut future: F) -> F::Output {
let mut future = unsafe { Pin::new_unchecked(&mut future) }; let mut future = unsafe { Pin::new_unchecked(&mut future) };
use std::hint::unreachable_unchecked; use std::hint::unreachable_unchecked;
static VTABLE: RawWakerVTable = RawWakerVTable::new( static VTABLE: RawWakerVTable = RawWakerVTable::new(
#[no_coverage] #[coverage(off)]
|_| unsafe { unreachable_unchecked() }, // clone |_| unsafe { unreachable_unchecked() }, // clone
#[no_coverage] #[coverage(off)]
|_| unsafe { unreachable_unchecked() }, // wake |_| unsafe { unreachable_unchecked() }, // wake
#[no_coverage] #[coverage(off)]
|_| unsafe { unreachable_unchecked() }, // wake_by_ref |_| unsafe { unreachable_unchecked() }, // wake_by_ref
#[no_coverage] #[coverage(off)]
|_| (), |_| (),
); );
let waker = unsafe { Waker::from_raw(RawWaker::new(core::ptr::null(), &VTABLE)) }; let waker = unsafe { Waker::from_raw(RawWaker::new(core::ptr::null(), &VTABLE)) };

View file

@ -1,17 +1,17 @@
// Enables `no_coverage` on the entire crate // Enables `coverage(off)` on the entire crate
#![feature(no_coverage)] #![feature(coverage_attribute)]
#[no_coverage] #[coverage(off)]
fn do_not_add_coverage_1() { fn do_not_add_coverage_1() {
println!("called but not covered"); println!("called but not covered");
} }
fn do_not_add_coverage_2() { fn do_not_add_coverage_2() {
#![no_coverage] #![coverage(off)]
println!("called but not covered"); println!("called but not covered");
} }
#[no_coverage] #[coverage(off)]
#[allow(dead_code)] #[allow(dead_code)]
fn do_not_add_coverage_not_called() { fn do_not_add_coverage_not_called() {
println!("not called and not covered"); println!("not called and not covered");
@ -33,7 +33,7 @@ fn add_coverage_not_called() {
// FIXME: These test-cases illustrate confusing results of nested functions. // FIXME: These test-cases illustrate confusing results of nested functions.
// See https://github.com/rust-lang/rust/issues/93319 // See https://github.com/rust-lang/rust/issues/93319
mod nested_fns { mod nested_fns {
#[no_coverage] #[coverage(off)]
pub fn outer_not_covered(is_true: bool) { pub fn outer_not_covered(is_true: bool) {
fn inner(is_true: bool) { fn inner(is_true: bool) {
if is_true { if is_true {
@ -50,7 +50,7 @@ mod nested_fns {
println!("called and covered"); println!("called and covered");
inner_not_covered(is_true); inner_not_covered(is_true);
#[no_coverage] #[coverage(off)]
fn inner_not_covered(is_true: bool) { fn inner_not_covered(is_true: bool) {
if is_true { if is_true {
println!("called but not covered"); println!("called but not covered");

View file

@ -1,5 +1,5 @@
LL| |// compile-flags: --edition=2018 LL| |// compile-flags: --edition=2018
LL| |#![feature(no_coverage)] LL| |#![feature(coverage_attribute)]
LL| | LL| |
LL| |macro_rules! bail { LL| |macro_rules! bail {
LL| | ($msg:literal $(,)?) => { LL| | ($msg:literal $(,)?) => {

View file

@ -1,5 +1,5 @@
// compile-flags: --edition=2018 // compile-flags: --edition=2018
#![feature(no_coverage)] #![feature(coverage_attribute)]
macro_rules! bail { macro_rules! bail {
($msg:literal $(,)?) => { ($msg:literal $(,)?) => {

View file

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

View file

@ -1,5 +1,5 @@
// compile-flags: --edition=2018 // compile-flags: --edition=2018
#![feature(no_coverage)] #![feature(coverage_attribute)]
macro_rules! bail { macro_rules! bail {
($msg:literal $(,)?) => { ($msg:literal $(,)?) => {
@ -39,7 +39,7 @@ pub async fn test() -> Result<(), String> {
Ok(()) Ok(())
} }
#[no_coverage] #[coverage(off)]
fn main() { fn main() {
executor::block_on(test()).unwrap(); executor::block_on(test()).unwrap();
} }
@ -51,18 +51,18 @@ mod executor {
task::{Context, Poll, RawWaker, RawWakerVTable, Waker}, task::{Context, Poll, RawWaker, RawWakerVTable, Waker},
}; };
#[no_coverage] #[coverage(off)]
pub fn block_on<F: Future>(mut future: F) -> F::Output { pub fn block_on<F: Future>(mut future: F) -> F::Output {
let mut future = unsafe { Pin::new_unchecked(&mut future) }; let mut future = unsafe { Pin::new_unchecked(&mut future) };
use std::hint::unreachable_unchecked; use std::hint::unreachable_unchecked;
static VTABLE: RawWakerVTable = RawWakerVTable::new( static VTABLE: RawWakerVTable = RawWakerVTable::new(
#[no_coverage] #[coverage(off)]
|_| unsafe { unreachable_unchecked() }, // clone |_| unsafe { unreachable_unchecked() }, // clone
#[no_coverage] #[coverage(off)]
|_| unsafe { unreachable_unchecked() }, // wake |_| unsafe { unreachable_unchecked() }, // wake
#[no_coverage] #[coverage(off)]
|_| unsafe { unreachable_unchecked() }, // wake_by_ref |_| unsafe { unreachable_unchecked() }, // wake_by_ref
#[no_coverage] #[coverage(off)]
|_| (), |_| (),
); );
let waker = unsafe { Waker::from_raw(RawWaker::new(core::ptr::null(), &VTABLE)) }; let waker = unsafe { Waker::from_raw(RawWaker::new(core::ptr::null(), &VTABLE)) };

View file

@ -1,17 +1,17 @@
LL| |// Enables `no_coverage` on the entire crate LL| |// Enables `coverage(off)` on the entire crate
LL| |#![feature(no_coverage)] LL| |#![feature(coverage_attribute)]
LL| | LL| |
LL| |#[no_coverage] LL| |#[coverage(off)]
LL| |fn do_not_add_coverage_1() { LL| |fn do_not_add_coverage_1() {
LL| | println!("called but not covered"); LL| | println!("called but not covered");
LL| |} LL| |}
LL| | LL| |
LL| |fn do_not_add_coverage_2() { LL| |fn do_not_add_coverage_2() {
LL| | #![no_coverage] LL| | #![coverage(off)]
LL| | println!("called but not covered"); LL| | println!("called but not covered");
LL| |} LL| |}
LL| | LL| |
LL| |#[no_coverage] LL| |#[coverage(off)]
LL| |#[allow(dead_code)] LL| |#[allow(dead_code)]
LL| |fn do_not_add_coverage_not_called() { LL| |fn do_not_add_coverage_not_called() {
LL| | println!("not called and not covered"); LL| | println!("not called and not covered");
@ -33,7 +33,7 @@
LL| |// FIXME: These test-cases illustrate confusing results of nested functions. LL| |// FIXME: These test-cases illustrate confusing results of nested functions.
LL| |// See https://github.com/rust-lang/rust/issues/93319 LL| |// See https://github.com/rust-lang/rust/issues/93319
LL| |mod nested_fns { LL| |mod nested_fns {
LL| | #[no_coverage] LL| | #[coverage(off)]
LL| | pub fn outer_not_covered(is_true: bool) { LL| | pub fn outer_not_covered(is_true: bool) {
LL| 1| fn inner(is_true: bool) { LL| 1| fn inner(is_true: bool) {
LL| 1| if is_true { LL| 1| if is_true {
@ -50,7 +50,7 @@
LL| 1| println!("called and covered"); LL| 1| println!("called and covered");
LL| 1| inner_not_covered(is_true); LL| 1| inner_not_covered(is_true);
LL| 1| LL| 1|
LL| 1| #[no_coverage] LL| 1| #[coverage(off)]
LL| 1| fn inner_not_covered(is_true: bool) { LL| 1| fn inner_not_covered(is_true: bool) {
LL| 1| if is_true { LL| 1| if is_true {
LL| 1| println!("called but not covered"); LL| 1| println!("called but not covered");

View file

@ -1,17 +1,17 @@
// Enables `no_coverage` on the entire crate // Enables `coverage(off)` on the entire crate
#![feature(no_coverage)] #![feature(coverage_attribute)]
#[no_coverage] #[coverage(off)]
fn do_not_add_coverage_1() { fn do_not_add_coverage_1() {
println!("called but not covered"); println!("called but not covered");
} }
fn do_not_add_coverage_2() { fn do_not_add_coverage_2() {
#![no_coverage] #![coverage(off)]
println!("called but not covered"); println!("called but not covered");
} }
#[no_coverage] #[coverage(off)]
#[allow(dead_code)] #[allow(dead_code)]
fn do_not_add_coverage_not_called() { fn do_not_add_coverage_not_called() {
println!("not called and not covered"); println!("not called and not covered");
@ -33,7 +33,7 @@ fn add_coverage_not_called() {
// FIXME: These test-cases illustrate confusing results of nested functions. // FIXME: These test-cases illustrate confusing results of nested functions.
// See https://github.com/rust-lang/rust/issues/93319 // See https://github.com/rust-lang/rust/issues/93319
mod nested_fns { mod nested_fns {
#[no_coverage] #[coverage(off)]
pub fn outer_not_covered(is_true: bool) { pub fn outer_not_covered(is_true: bool) {
fn inner(is_true: bool) { fn inner(is_true: bool) {
if is_true { if is_true {
@ -50,7 +50,7 @@ mod nested_fns {
println!("called and covered"); println!("called and covered");
inner_not_covered(is_true); inner_not_covered(is_true);
#[no_coverage] #[coverage(off)]
fn inner_not_covered(is_true: bool) { fn inner_not_covered(is_true: bool) {
if is_true { if is_true {
println!("called but not covered"); println!("called but not covered");