From 1a231c57c21852006030b7f9067e3dc36eea1898 Mon Sep 17 00:00:00 2001 From: Greg Sleap Date: Fri, 26 Jun 2020 10:44:23 +0800 Subject: [PATCH] Fixed cargo tarpaulin decorators to use new format for v0.13.4+ so github build does not fail --- .github/workflows/run_tests.yml | 2 +- Cargo.toml | 2 ++ examples/mwalib-data-dump.rs | 6 +++--- examples/mwalib-print-obs-context.rs | 4 ++-- ...alib-sum-first-fine-channel-gpubox-hdus.rs | 4 ++-- examples/mwalib-sum-gpubox-hdus.rs | 8 ++++---- src/antenna.rs | 2 +- src/baseline.rs | 2 +- src/coarse_channel.rs | 2 +- src/context.rs | 4 ++-- src/convert.rs | 2 +- src/error.rs | 12 +++++------ src/ffi.rs | 20 +++++++++---------- src/gpubox.rs | 4 ++-- src/rfinput.rs | 2 +- src/timestep.rs | 2 +- src/visibility_pol.rs | 2 +- 17 files changed, 41 insertions(+), 39 deletions(-) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 4fb9297..a497c17 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -37,7 +37,7 @@ jobs: sudo ldconfig; - name: Run cargo-tarpaulin - run: cargo tarpaulin -v --ignore-tests --timeout=360 --out=Lcov --output-dir=./coverage/ + run: cargo tarpaulin --verbose --force-clean --ignore-tests --timeout=360 --out=Lcov --output-dir=./coverage/ - name: codecov run: bash <(curl -s https://codecov.io/bash) diff --git a/Cargo.toml b/Cargo.toml index be31fd4..6ea8580 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,6 +34,8 @@ csv = "1.1.*" float-cmp = "0.7.*" structopt = "0.3.*" tempdir = "0.3.*" +cbindgen = "*" +cargo-tarpaulin = "*" [[bench]] name = "bench" diff --git a/examples/mwalib-data-dump.rs b/examples/mwalib-data-dump.rs index ffa8f02..4b8713b 100644 --- a/examples/mwalib-data-dump.rs +++ b/examples/mwalib-data-dump.rs @@ -9,7 +9,7 @@ use std::fs::File; use std::io::Write; use structopt::StructOpt; -#[cfg_attr(tarpaulin, skip)] +#[cfg(not(tarpaulin_include))] #[derive(StructOpt, Debug)] #[structopt(name = "mwalib-data-dump", author)] struct Opt { @@ -45,7 +45,7 @@ struct Opt { dump_filename: String, } -#[cfg_attr(tarpaulin, skip)] +#[cfg(not(tarpaulin_include))] fn dump_data( metafits: String, files: Vec, @@ -139,7 +139,7 @@ fn dump_data( Ok(()) } -#[cfg_attr(tarpaulin, skip)] +#[cfg(not(tarpaulin_include))] fn main() -> Result<(), anyhow::Error> { let opts = Opt::from_args(); diff --git a/examples/mwalib-print-obs-context.rs b/examples/mwalib-print-obs-context.rs index ab2ef81..0cc683c 100644 --- a/examples/mwalib-print-obs-context.rs +++ b/examples/mwalib-print-obs-context.rs @@ -9,7 +9,7 @@ use structopt::StructOpt; use mwalib::*; -#[cfg_attr(tarpaulin, skip)] +#[cfg(not(tarpaulin_include))] #[derive(StructOpt, Debug)] #[structopt(name = "mwalib-print-obs-context", author)] struct Opt { @@ -22,7 +22,7 @@ struct Opt { files: Vec, } -#[cfg_attr(tarpaulin, skip)] +#[cfg(not(tarpaulin_include))] fn main() -> Result<(), anyhow::Error> { let opts = Opt::from_args(); let mut context = mwalibContext::new(&opts.metafits, &opts.files)?; diff --git a/examples/mwalib-sum-first-fine-channel-gpubox-hdus.rs b/examples/mwalib-sum-first-fine-channel-gpubox-hdus.rs index 4e2f2d8..17c6a43 100644 --- a/examples/mwalib-sum-first-fine-channel-gpubox-hdus.rs +++ b/examples/mwalib-sum-first-fine-channel-gpubox-hdus.rs @@ -12,7 +12,7 @@ use structopt::StructOpt; use mwalib::*; -#[cfg_attr(tarpaulin, skip)] +#[cfg(not(tarpaulin_include))] #[derive(StructOpt, Debug)] #[structopt(name = "mwalib-sum-first-fine-channel-gpubox-hdus", author)] struct Opt { @@ -25,7 +25,7 @@ struct Opt { files: Vec, } -#[cfg_attr(tarpaulin, skip)] +#[cfg(not(tarpaulin_include))] #[allow(clippy::needless_range_loop)] // Ignoring this, as it is a false positive fn main() -> Result<(), anyhow::Error> { let opts = Opt::from_args(); diff --git a/examples/mwalib-sum-gpubox-hdus.rs b/examples/mwalib-sum-gpubox-hdus.rs index ce5eeb3..fd8f4bc 100644 --- a/examples/mwalib-sum-gpubox-hdus.rs +++ b/examples/mwalib-sum-gpubox-hdus.rs @@ -9,7 +9,7 @@ use structopt::StructOpt; use mwalib::*; -#[cfg_attr(tarpaulin, skip)] +#[cfg(not(tarpaulin_include))] #[derive(StructOpt, Debug)] #[structopt(name = "mwalib-sum-gpubox-hdus", author)] struct Opt { @@ -28,7 +28,7 @@ struct Opt { files: Vec, } -#[cfg_attr(tarpaulin, skip)] +#[cfg(not(tarpaulin_include))] fn sum_direct(files: Vec) -> Result<(), anyhow::Error> { println!("Summing directly from HDUs..."); let mut sum: f64 = 0.0; @@ -51,7 +51,7 @@ fn sum_direct(files: Vec) -> Result<(), anyhow::Error> { Ok(()) } -#[cfg_attr(tarpaulin, skip)] +#[cfg(not(tarpaulin_include))] fn sum_mwalib(metafits: String, files: Vec) -> Result<(), anyhow::Error> { println!("Summing via mwalib using read_by_baseline()..."); let mut context = mwalibContext::new(&metafits, &files)?; @@ -85,7 +85,7 @@ fn sum_mwalib(metafits: String, files: Vec) -> Result<(), anyhow::Error> Ok(()) } -#[cfg_attr(tarpaulin, skip)] +#[cfg(not(tarpaulin_include))] fn main() -> Result<(), anyhow::Error> { let opts = Opt::from_args(); if opts.direct { diff --git a/src/antenna.rs b/src/antenna.rs index 6a7ccf4..0a76c40 100644 --- a/src/antenna.rs +++ b/src/antenna.rs @@ -84,7 +84,7 @@ impl mwalibAntenna { /// * `fmt::Result` - Result of this method /// /// -#[cfg_attr(tarpaulin, skip)] +#[cfg(not(tarpaulin_include))] impl fmt::Debug for mwalibAntenna { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}", self.tile_name) diff --git a/src/baseline.rs b/src/baseline.rs index d59d9a0..363209a 100644 --- a/src/baseline.rs +++ b/src/baseline.rs @@ -66,7 +66,7 @@ impl mwalibBaseline { /// * `fmt::Result` - Result of this method /// /// -#[cfg_attr(tarpaulin, skip)] +#[cfg(not(tarpaulin_include))] impl fmt::Debug for mwalibBaseline { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{},{}", self.antenna1_index, self.antenna2_index,) diff --git a/src/coarse_channel.rs b/src/coarse_channel.rs index 0c83c65..b6d88a1 100644 --- a/src/coarse_channel.rs +++ b/src/coarse_channel.rs @@ -263,7 +263,7 @@ impl mwalibCoarseChannel { /// * `fmt::Result` - Result of this method /// /// -#[cfg_attr(tarpaulin, skip)] +#[cfg(not(tarpaulin_include))] impl fmt::Debug for mwalibCoarseChannel { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( diff --git a/src/context.rs b/src/context.rs index e41a1b2..c3c558f 100644 --- a/src/context.rs +++ b/src/context.rs @@ -48,7 +48,7 @@ pub enum CorrelatorVersion { /// * `fmt::Result` - Result of this method /// /// -#[cfg_attr(tarpaulin, skip)] +#[cfg(not(tarpaulin_include))] impl fmt::Display for CorrelatorVersion { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!( @@ -837,7 +837,7 @@ impl mwalibContext { /// * `fmt::Result` - Result of this method /// /// -#[cfg_attr(tarpaulin, skip)] +#[cfg(not(tarpaulin_include))] impl fmt::Display for mwalibContext { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { // `size` is the number of floats (self.gpubox_hdu_size) multiplied by 4 diff --git a/src/convert.rs b/src/convert.rs index 7a24bcb..24afd0c 100644 --- a/src/convert.rs +++ b/src/convert.rs @@ -98,7 +98,7 @@ impl mwalibLegacyConversionBaseline { /// * `fmt::Result` - Result of this method /// /// -#[cfg_attr(tarpaulin, skip)] +#[cfg(not(tarpaulin_include))] impl fmt::Debug for mwalibLegacyConversionBaseline { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( diff --git a/src/error.rs b/src/error.rs index f12146a..ed7447f 100644 --- a/src/error.rs +++ b/src/error.rs @@ -19,35 +19,35 @@ pub enum ErrorKind { Fitsio(fitsio::errors::Error), } -#[cfg_attr(tarpaulin, skip)] +#[cfg(not(tarpaulin_include))] impl From for ErrorKind { fn from(err: num::ParseIntError) -> ErrorKind { ErrorKind::ParseInt(err) } } -#[cfg_attr(tarpaulin, skip)] +#[cfg(not(tarpaulin_include))] impl From for ErrorKind { fn from(err: num::ParseFloatError) -> ErrorKind { ErrorKind::ParseFloat(err) } } -#[cfg_attr(tarpaulin, skip)] +#[cfg(not(tarpaulin_include))] impl From for ErrorKind { fn from(err: io::Error) -> ErrorKind { ErrorKind::IO(err) } } -#[cfg_attr(tarpaulin, skip)] +#[cfg(not(tarpaulin_include))] impl From for ErrorKind { fn from(err: anyhow::Error) -> ErrorKind { ErrorKind::Anyhow(err) } } -#[cfg_attr(tarpaulin, skip)] +#[cfg(not(tarpaulin_include))] impl From for ErrorKind { fn from(err: fitsio::errors::Error) -> ErrorKind { ErrorKind::Fitsio(err) @@ -56,7 +56,7 @@ impl From for ErrorKind { impl Error for ErrorKind {} -#[cfg_attr(tarpaulin, skip)] +#[cfg(not(tarpaulin_include))] impl fmt::Display for ErrorKind { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { diff --git a/src/ffi.rs b/src/ffi.rs index 1e05067..d09b7d4 100644 --- a/src/ffi.rs +++ b/src/ffi.rs @@ -90,7 +90,7 @@ fn set_error_message(in_message: &str, error_buffer_ptr: *mut u8, error_buffer_l /// # Safety /// * rust_cstring must not have already been freed and must point to a Rust string. #[no_mangle] -#[cfg_attr(tarpaulin, skip)] +#[cfg(not(tarpaulin_include))] pub unsafe extern "C" fn mwalib_free_rust_cstring(rust_cstring: *mut c_char) { // Don't do anything if the pointer is null. if rust_cstring.is_null() { @@ -164,7 +164,7 @@ pub unsafe extern "C" fn mwalibContext_get( /// * context_ptr must point to a populated mwalibContext object from the mwalibContext_new function. /// * context_ptr must not have already been freed. #[no_mangle] -#[cfg_attr(tarpaulin, skip)] +#[cfg(not(tarpaulin_include))] pub unsafe extern "C" fn mwalibContext_free(context_ptr: *mut mwalibContext) { if context_ptr.is_null() { return; @@ -409,7 +409,7 @@ pub unsafe extern "C" fn mwalibContext_read_by_frequency( /// * float_buffer_ptr must point to a populated float buffer from the mwalibContext_read_by_baseline function. /// * float_buffer_ptr must not have already been freed. #[no_mangle] -#[cfg_attr(tarpaulin, skip)] +#[cfg(not(tarpaulin_include))] pub unsafe extern "C" fn mwalibContext_free_read_buffer( float_buffer_ptr: *mut c_float, float_buffer_len: *const c_longlong, @@ -666,7 +666,7 @@ pub unsafe extern "C" fn mwalibMetadata_get( /// * metadata_ptr must point to a populated mwalibMetadata object from the mwalibMetadata_get function. /// * metadata_ptr must not have already been freed. #[no_mangle] -#[cfg_attr(tarpaulin, skip)] +#[cfg(not(tarpaulin_include))] pub unsafe extern "C" fn mwalibMetadata_free(metadata_ptr: *mut mwalibMetadata) { if metadata_ptr.is_null() { return; @@ -765,7 +765,7 @@ pub unsafe extern "C" fn mwalibBaseline_get( /// * baseline_ptr must point to a populated mwalibBaseline object from the mwalibBaseline_get function. /// * baseline_ptr must not have already been freed. #[no_mangle] -#[cfg_attr(tarpaulin, skip)] +#[cfg(not(tarpaulin_include))] pub unsafe extern "C" fn mwalibBaseline_free(baseline_ptr: *mut mwalibBaseline) { if baseline_ptr.is_null() { return; @@ -902,7 +902,7 @@ pub unsafe extern "C" fn mwalibRFInput_get( /// * rf_input_ptr must point to a populated mwalibRFInput object from the mwalibRFInput_get function. /// * rf_input_ptr must not have already been freed. #[no_mangle] -#[cfg_attr(tarpaulin, skip)] +#[cfg(not(tarpaulin_include))] pub unsafe extern "C" fn mwalibRFInput_free(rf_input_ptr: *mut mwalibRFInput) { if rf_input_ptr.is_null() { return; @@ -1019,7 +1019,7 @@ pub unsafe extern "C" fn mwalibCoarseChannel_get( /// * coarse_channel_ptr must point to a populated mwalibCoarseChannel object from the mwalibCoarseChannel_new function. /// * coarse_channel_ptr must not have already been freed. #[no_mangle] -#[cfg_attr(tarpaulin, skip)] +#[cfg(not(tarpaulin_include))] pub unsafe extern "C" fn mwalibCoarseChannel_free(coarse_channel_ptr: *mut mwalibCoarseChannel) { if coarse_channel_ptr.is_null() { return; @@ -1124,7 +1124,7 @@ pub unsafe extern "C" fn mwalibAntenna_get( /// * antenna_ptr must point to a populated mwalibAntenna object from the mwalibAntenna_get function. /// * antenna_ptr must not have already been freed. #[no_mangle] -#[cfg_attr(tarpaulin, skip)] +#[cfg(not(tarpaulin_include))] pub unsafe extern "C" fn mwalibAntenna_free(antenna_ptr: *mut mwalibAntenna) { if antenna_ptr.is_null() { return; @@ -1223,7 +1223,7 @@ pub unsafe extern "C" fn mwalibTimeStep_get( /// * timestep_ptr must point to a populated mwalibTimeStep object from the mwalibTimeStep_get function. /// * timestep_ptr must not have already been freed. #[no_mangle] -#[cfg_attr(tarpaulin, skip)] +#[cfg(not(tarpaulin_include))] pub unsafe extern "C" fn mwalibTimeStep_free(timestep_ptr: *mut mwalibTimeStep) { if timestep_ptr.is_null() { return; @@ -1321,7 +1321,7 @@ pub unsafe extern "C" fn mwalibVisibilityPol_get( /// * visibility_pol_ptr must point to a populated mwalibVisibilityPol object from the mwalibVisibilityPol_get function. /// * visibility_pol_ptr must not have already been freed. #[no_mangle] -#[cfg_attr(tarpaulin, skip)] +#[cfg(not(tarpaulin_include))] pub unsafe extern "C" fn mwalibVisibilityPol_free(visibility_pol_ptr: *mut mwalibVisibilityPol) { if visibility_pol_ptr.is_null() { return; diff --git a/src/gpubox.rs b/src/gpubox.rs index e4c6aee..393bf13 100644 --- a/src/gpubox.rs +++ b/src/gpubox.rs @@ -40,7 +40,7 @@ impl GPUBoxBatch { } } -#[cfg_attr(tarpaulin, skip)] +#[cfg(not(tarpaulin_include))] impl fmt::Debug for GPUBoxBatch { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( @@ -61,7 +61,7 @@ pub struct GPUBoxFile { pub fptr: FitsFile, } -#[cfg_attr(tarpaulin, skip)] +#[cfg(not(tarpaulin_include))] impl fmt::Debug for GPUBoxFile { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( diff --git a/src/rfinput.rs b/src/rfinput.rs index f82588f..76e4a70 100644 --- a/src/rfinput.rs +++ b/src/rfinput.rs @@ -301,7 +301,7 @@ impl mwalibRFInput { /// * `fmt::Result` - Result of this method /// /// -#[cfg_attr(tarpaulin, skip)] +#[cfg(not(tarpaulin_include))] impl fmt::Debug for mwalibRFInput { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}{}", self.tile_name, self.pol) diff --git a/src/timestep.rs b/src/timestep.rs index c7add64..e0333f2 100644 --- a/src/timestep.rs +++ b/src/timestep.rs @@ -82,7 +82,7 @@ impl mwalibTimeStep { /// * `fmt::Result` - Result of this method /// /// -#[cfg_attr(tarpaulin, skip)] +#[cfg(not(tarpaulin_include))] impl fmt::Debug for mwalibTimeStep { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "unix={:.3}", self.unix_time_ms as f64 / 1000.,) diff --git a/src/visibility_pol.rs b/src/visibility_pol.rs index 5fba8ea..a13a65a 100644 --- a/src/visibility_pol.rs +++ b/src/visibility_pol.rs @@ -57,7 +57,7 @@ impl mwalibVisibilityPol { /// * `fmt::Result` - Result of this method /// /// -#[cfg_attr(tarpaulin, skip)] +#[cfg(not(tarpaulin_include))] impl fmt::Debug for mwalibVisibilityPol { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "pol={}", self.polarisation,)