From c4e2d2373bed23f56ab8b96fc028ffb1c5c56001 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Mon, 4 Nov 2019 19:37:47 -0600 Subject: hscript: Mark code correctly for LCOV --- hscript/disk.cc | 8 ++++---- hscript/disk_lvm.cc | 8 +++++--- hscript/meta.cc | 12 +++++++----- hscript/network.cc | 8 +++++--- 4 files changed, 21 insertions(+), 15 deletions(-) (limited to 'hscript') diff --git a/hscript/disk.cc b/hscript/disk.cc index cef1a1e..07eca06 100644 --- a/hscript/disk.cc +++ b/hscript/disk.cc @@ -151,7 +151,7 @@ bool DiskId::execute(ScriptOptions options) const { udev_unref(udev); #endif /* HAS_INSTALL_ENV */ - return match; + return match; /* LCOV_EXCL_LINE */ } @@ -256,7 +256,7 @@ bool DiskLabel::execute(ScriptOptions options) const { } return (res == 1); #else - return false; + return false; /* LCOV_EXCL_LINE */ #endif /* HAS_INSTALL_ENV */ } @@ -579,7 +579,7 @@ bool Partition::execute(ScriptOptions opts) const { ped_disk_destroy(disk); #endif /* HAS_INSTALL_ENV */ - return true; + return true; /* LCOV_EXCL_LINE */ } @@ -701,7 +701,7 @@ bool Filesystem::execute(ScriptOptions opts) const { return false; } #endif /* HAS_INSTALL_ENV */ - return true; + return true; /* LCOV_EXCL_LINE */ } diff --git a/hscript/disk_lvm.cc b/hscript/disk_lvm.cc index 70e1ba2..f558515 100644 --- a/hscript/disk_lvm.cc +++ b/hscript/disk_lvm.cc @@ -59,7 +59,7 @@ bool LVMPhysical::execute(ScriptOptions opts) const { return false; } #endif /* HAS_INSTALL_ENV */ - return true; + return true; /* LCOV_EXCL_LINE */ } @@ -152,6 +152,7 @@ bool LVMGroup::validate(ScriptOptions) const { return true; } +/* LCOV_EXCL_START */ bool LVMGroup::test_pv(ScriptOptions) const { #ifdef HAS_INSTALL_ENV const char *fstype = blkid_get_tag_value(nullptr, "TYPE", @@ -166,6 +167,7 @@ bool LVMGroup::test_pv(ScriptOptions) const { return true; #endif /* HAS_INSTALL_ENV */ } +/* LCOV_EXCL_STOP */ #ifdef HAS_INSTALL_ENV /*! Determine if a named Volume Group currently exists on a LVM PV. @@ -237,7 +239,7 @@ bool LVMGroup::execute(ScriptOptions opts) const { return false; } #endif /* HAS_INSTALL_ENV */ - return true; + return true; /* LCOV_EXCL_LINE */ } @@ -325,5 +327,5 @@ bool LVMVolume::execute(ScriptOptions opts) const { return false; } #endif /* HAS_INSTALL_ENV */ - return true; + return true; /* LCOV_EXCL_LINE */ } diff --git a/hscript/meta.cc b/hscript/meta.cc index b184a96..73e699a 100644 --- a/hscript/meta.cc +++ b/hscript/meta.cc @@ -308,7 +308,7 @@ bool Language::execute(ScriptOptions opts) const { return false; } #endif /* HAS_INSTALL_ENV */ - return true; + return true; /* LCOV_EXCL_LINE */ } @@ -374,7 +374,7 @@ BACKSPACE=guess" keyconf << conf; #endif /* HAS_INSTALL_ENV */ - return true; + return true; /* LCOV_EXCL_LINE */ } @@ -406,10 +406,12 @@ Key *Firmware::parseFromData(const std::string &data, int lineno, int *errors, return new Firmware(lineno, value); } +/* LCOV_EXCL_START */ bool Firmware::execute(ScriptOptions) const { /* By itself, this does nothing. */ return true; } +/* LCOV_EXCL_END */ Key *Timezone::parseFromData(const std::string &data, int lineno, int *errors, @@ -479,7 +481,7 @@ bool Timezone::execute(ScriptOptions opts) const { return true; } #else - return false; + return false; /* LCOV_EXCL_LINE */ #endif } @@ -525,7 +527,7 @@ bool Repository::execute(ScriptOptions opts) const { return true; #else - return false; + return false; /* LCOV_EXCL_LINE */ #endif /* HAS_INSTALL_ENV */ } @@ -589,5 +591,5 @@ bool SigningKey::execute(ScriptOptions opts) const { return download_file(_value, target); } #endif /* HAS_INSTALL_ENV */ - return true; + return true; /* LCOV_EXCL_LINE */ } diff --git a/hscript/network.cc b/hscript/network.cc index 28e382b..49cebb5 100644 --- a/hscript/network.cc +++ b/hscript/network.cc @@ -262,7 +262,7 @@ bool NetAddress::validate(ScriptOptions opts) const { return false; } #endif - return true; + return true; /* LCOV_EXCL_LINE */ } bool NetAddress::execute(ScriptOptions) const { @@ -355,6 +355,7 @@ bool Nameserver::execute(ScriptOptions opts) const { return true; } +#ifdef HAS_INSTALL_ENV std::ofstream resolvconf("/target/etc/resolv.conf", std::ios_base::app); if(!resolvconf) { output_error("installfile:" + std::to_string(line), @@ -362,7 +363,8 @@ bool Nameserver::execute(ScriptOptions opts) const { return false; } resolvconf << "nameserver " << _value << std::endl; - return true; +#endif /* HAS_INSTALL_ENV */ + return true; /* LCOV_EXCL_LINE */ } @@ -488,7 +490,7 @@ bool NetSSID::validate(ScriptOptions options) const { ::close(my_sock); return true; #else - return false; + return false; /* LCOV_EXCL_LINE */ #endif } -- cgit v1.2.3-70-g09d2