Skip to content

Commit

Permalink
Fixed cargo tarpaulin decorators to use new format for v0.13.4+ so gi…
Browse files Browse the repository at this point in the history
…thub build does not fail
  • Loading branch information
gsleap committed Jun 26, 2020
1 parent 48f0af2 commit 1a231c5
Show file tree
Hide file tree
Showing 17 changed files with 41 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ csv = "1.1.*"
float-cmp = "0.7.*"
structopt = "0.3.*"
tempdir = "0.3.*"
cbindgen = "*"
cargo-tarpaulin = "*"

[[bench]]
name = "bench"
Expand Down
6 changes: 3 additions & 3 deletions examples/mwalib-data-dump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -45,7 +45,7 @@ struct Opt {
dump_filename: String,
}

#[cfg_attr(tarpaulin, skip)]
#[cfg(not(tarpaulin_include))]
fn dump_data(
metafits: String,
files: Vec<String>,
Expand Down Expand Up @@ -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();

Expand Down
4 changes: 2 additions & 2 deletions examples/mwalib-print-obs-context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -22,7 +22,7 @@ struct Opt {
files: Vec<String>,
}

#[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)?;
Expand Down
4 changes: 2 additions & 2 deletions examples/mwalib-sum-first-fine-channel-gpubox-hdus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -25,7 +25,7 @@ struct Opt {
files: Vec<String>,
}

#[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();
Expand Down
8 changes: 4 additions & 4 deletions examples/mwalib-sum-gpubox-hdus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -28,7 +28,7 @@ struct Opt {
files: Vec<String>,
}

#[cfg_attr(tarpaulin, skip)]
#[cfg(not(tarpaulin_include))]
fn sum_direct(files: Vec<String>) -> Result<(), anyhow::Error> {
println!("Summing directly from HDUs...");
let mut sum: f64 = 0.0;
Expand All @@ -51,7 +51,7 @@ fn sum_direct(files: Vec<String>) -> Result<(), anyhow::Error> {
Ok(())
}

#[cfg_attr(tarpaulin, skip)]
#[cfg(not(tarpaulin_include))]
fn sum_mwalib(metafits: String, files: Vec<String>) -> Result<(), anyhow::Error> {
println!("Summing via mwalib using read_by_baseline()...");
let mut context = mwalibContext::new(&metafits, &files)?;
Expand Down Expand Up @@ -85,7 +85,7 @@ fn sum_mwalib(metafits: String, files: Vec<String>) -> 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 {
Expand Down
2 changes: 1 addition & 1 deletion src/antenna.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/baseline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,)
Expand Down
2 changes: 1 addition & 1 deletion src/coarse_channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down
4 changes: 2 additions & 2 deletions src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down
12 changes: 6 additions & 6 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,35 +19,35 @@ pub enum ErrorKind {
Fitsio(fitsio::errors::Error),
}

#[cfg_attr(tarpaulin, skip)]
#[cfg(not(tarpaulin_include))]
impl From<num::ParseIntError> for ErrorKind {
fn from(err: num::ParseIntError) -> ErrorKind {
ErrorKind::ParseInt(err)
}
}

#[cfg_attr(tarpaulin, skip)]
#[cfg(not(tarpaulin_include))]
impl From<num::ParseFloatError> for ErrorKind {
fn from(err: num::ParseFloatError) -> ErrorKind {
ErrorKind::ParseFloat(err)
}
}

#[cfg_attr(tarpaulin, skip)]
#[cfg(not(tarpaulin_include))]
impl From<io::Error> for ErrorKind {
fn from(err: io::Error) -> ErrorKind {
ErrorKind::IO(err)
}
}

#[cfg_attr(tarpaulin, skip)]
#[cfg(not(tarpaulin_include))]
impl From<anyhow::Error> for ErrorKind {
fn from(err: anyhow::Error) -> ErrorKind {
ErrorKind::Anyhow(err)
}
}

#[cfg_attr(tarpaulin, skip)]
#[cfg(not(tarpaulin_include))]
impl From<fitsio::errors::Error> for ErrorKind {
fn from(err: fitsio::errors::Error) -> ErrorKind {
ErrorKind::Fitsio(err)
Expand All @@ -56,7 +56,7 @@ impl From<fitsio::errors::Error> 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 {
Expand Down
20 changes: 10 additions & 10 deletions src/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/gpubox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand All @@ -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!(
Expand Down
2 changes: 1 addition & 1 deletion src/rfinput.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/timestep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.,)
Expand Down
2 changes: 1 addition & 1 deletion src/visibility_pol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,)
Expand Down

0 comments on commit 1a231c5

Please sign in to comment.