Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ jobs:

- name: Get LCov
run: |
wget https://github.com/linux-test-project/lcov/releases/download/v1.16/lcov-1.16.tar.gz
tar -xzf lcov-1.16.tar.gz
cd lcov-1.16
sudo make install
sudo apt-get install ca-certificates lcov
#wget https://github.com/linux-test-project/lcov/releases/download/v1.16/lcov-1.16.tar.gz
#tar -xzf lcov-1.16.tar.gz
#cd lcov-1.16
#sudo make install

- name: Configure
run: |
Expand All @@ -50,8 +51,8 @@ jobs:

- name: Prepare coverage
run: |
lcov --directory . --capture --output-file coverage.info
lcov --remove coverage.info '*/tests/*' '*/examples/*' '/usr/*' '*/book/*' '*/fuzz/*' --output-file coverage.info
lcov --ignore-errors gcov,mismatch --directory . --capture --output-file coverage.info
lcov --remove coverage.info '*/tests/*' '/usr/*' --output-file coverage.info
lcov --list coverage.info
working-directory: build

Expand Down
23 changes: 20 additions & 3 deletions cmake/CodeCoverage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,8 @@ function(setup_target_for_coverage_lcov)
${Coverage_LCOV_ARGS}
--gcov-tool
${GCOV_PATH}
--ignore-errors
mismatch
-directory
.
-b
Expand All @@ -281,6 +283,8 @@ function(setup_target_for_coverage_lcov)
${Coverage_LCOV_ARGS}
--gcov-tool
${GCOV_PATH}
--ignore-errors
mismatch
-c
-i
-d
Expand All @@ -302,6 +306,8 @@ function(setup_target_for_coverage_lcov)
-b
${BASEDIR}
--capture
--ignore-errors
mismatch,gcov
--output-file
${Coverage_NAME}.capture)
# add baseline counters
Expand All @@ -314,6 +320,8 @@ function(setup_target_for_coverage_lcov)
${Coverage_NAME}.base
-a
${Coverage_NAME}.capture
--ignore-errors
mismatch,gcov
--output-file
${Coverage_NAME}.total)
# filter collected data to final coverage report
Expand All @@ -322,14 +330,23 @@ function(setup_target_for_coverage_lcov)
${Coverage_LCOV_ARGS}
--gcov-tool
${GCOV_PATH}
--ignore-errors
mismatch,mismatch,gcov
--remove
${Coverage_NAME}.total
${LCOV_EXCLUDES}
--output-file
${Coverage_NAME}.info)
# Generate HTML output
set(LCOV_GEN_HTML_CMD ${GENHTML_PATH} ${GENHTML_EXTRA_ARGS} ${Coverage_GENHTML_ARGS} -o
${Coverage_NAME} ${Coverage_NAME}.info)
set(LCOV_GEN_HTML_CMD
${GENHTML_PATH}
${GENHTML_EXTRA_ARGS}
--ignore-errors
mismatch,mismatch
${Coverage_GENHTML_ARGS}
-o
${Coverage_NAME}
${Coverage_NAME}.info)
if(${Coverage_SONARQUBE})
# Generate SonarQube output
set(GCOVR_XML_CMD
Expand All @@ -347,7 +364,7 @@ function(setup_target_for_coverage_lcov)
COMMENT "SonarQube code coverage info report saved in ${Coverage_NAME}_sonarqube.xml.")
endif()

if(CODE_COVERAGE_VERBOSE)
if(CODE_COVERAGE_VERBOSE OR 1)
message(STATUS "Executed command report")
message(STATUS "Command to clean up lcov: ")
string(REPLACE ";" " " LCOV_CLEAN_CMD_SPACED "${LCOV_CLEAN_CMD}")
Expand Down
2 changes: 1 addition & 1 deletion include/CLI/TypeTools.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1385,7 +1385,7 @@ bool lexical_assign(const std::string &input, AssignTo &output) {
}

return lexical_cast(input, output);
}
} // LCOV_EXCL_LINE

/// Assign a value through lexical cast operations
template <typename AssignTo,
Expand Down
7 changes: 4 additions & 3 deletions include/CLI/impl/App_inl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1367,6 +1367,9 @@ CLI11_INLINE void App::_process_requirements() {
}

CLI11_INLINE void App::_process() {
// help takes precedence over other potential errors and config and environment shouldn't be processed if help
// throws
_process_help_flags();
try {
// the config file might generate a FileError but that should not be processed until later in the process
// to allow for help, version and other errors to generate first.
Expand All @@ -1375,15 +1378,13 @@ CLI11_INLINE void App::_process() {
// process env shouldn't throw but no reason to process it if config generated an error
_process_env();
} catch(const CLI::FileError &) {
// callbacks and help_flags can generate exceptions which should take priority
// callbacks can generate exceptions which should take priority
// over the config file error if one exists.
_process_callbacks();
_process_help_flags();
throw;
}

_process_callbacks();
_process_help_flags();

_process_requirements();
}
Expand Down
28 changes: 28 additions & 0 deletions tests/ConfigFileTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2097,6 +2097,34 @@ TEST_CASE_METHOD(TApp, "IniSubcommandConfigurableInQuotesAliasWithEquals", "[con
CHECK(app.got_subcommand(subcom));
}

TEST_CASE_METHOD(TApp, "IniSubcommandConfigurableHelp", "[config]") {

TempFile tmpini{"TestIniTmp.ini"};

app.set_config("--config", tmpini);

{
std::ofstream out{tmpini};
out << "[default]" << '\n';
out << "val=1" << '\n';
out << "[subcom]" << '\n';
out << "val=2" << '\n';
}

int one{0}, two{0};
app.add_option("--val", one);
app.add_option("--helptest", two);
auto *subcom = app.add_subcommand("subcom");
subcom->configurable();
subcom->add_option("--val", two);

args = {"--help"};
CHECK_THROWS_AS(run(), CLI::CallForHelp);

auto helpres = app.help();
CHECK_THAT(helpres, Contains("--helptest"));
}

TEST_CASE_METHOD(TApp, "IniSubcommandConfigurableInQuotesAliasWithComment", "[config]") {

TempFile tmpini{"TestIniTmp.ini"};
Expand Down
4 changes: 2 additions & 2 deletions tests/HelpersTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ TEST_CASE("StringTools: binaryEscapseConversion2", "[helpers]") {
CHECK(rstring == testString);
}

TEST_CASE("StringTools: binaryEscapseConversion_withX", "[helpers]") {
TEST_CASE("StringTools: binaryEscapeConversion_withX", "[helpers]") {
std::string testString("hippy\\x35mm\\XF3_helpX26fox19");
testString.push_back(0);
testString.push_back(0);
Expand All @@ -317,7 +317,7 @@ TEST_CASE("StringTools: binaryEscapseConversion_withX", "[helpers]") {
CHECK(rstring == testString);
}

TEST_CASE("StringTools: binaryEscapseConversion_withBrackets", "[helpers]") {
TEST_CASE("StringTools: binaryEscapeConversion_withBrackets", "[helpers]") {

std::string vstr = R"raw('B"([\xb0\x0a\xb0/\xb0\xb0\xb0\xb0\xb0\xb0\xb0\xb0\xb0\xb0\xb0\xb0\xb0])"')raw";
std::string testString("[");
Expand Down
Loading