Commit d958f19e authored by Adrien Oliva's avatar Adrien Oliva

test(coverage): Improve test coverage

Add test for stdout and sterr comparison in LOGDESTINATION environment
variable.

GTLAB #2
parent 0072e05d
Pipeline #215 passed with stages
in 1 minute and 15 seconds
......@@ -23,13 +23,13 @@ lcov-coverage-clean:
lcov --compat-libtool --directory "$(top_srcdir)/src" --zerocounters --output-file "coverage-report.info"
lcov-coverage-filter:
lcov --rc lcov_branch_coverage=1 --compat-libtool --directory "$$(readlink -f "$(top_builddir)/")" --capture --output-file "coverage-report.info"
lcov --rc lcov_branch_coverage=1 --extract "coverage-report.info" "$$(readlink -f "$(top_srcdir)")/*" --output-file "coverage-report2.info"
lcov --rc lcov_branch_coverage=1 --remove "coverage-report2.info" "*utests*" "*demo*" --output-file "coverage-report.info"
lcov --rc lcov_branch_coverage=0 --compat-libtool --directory "$$(readlink -f "$(top_builddir)/")" --capture --output-file "coverage-report.info"
lcov --rc lcov_branch_coverage=0 --extract "coverage-report.info" "$$(readlink -f "$(top_srcdir)")/*" --output-file "coverage-report2.info"
lcov --rc lcov_branch_coverage=0 --remove "coverage-report2.info" "*utests*" "*demo*" --output-file "coverage-report.info"
if GENHTML
GENHTML_EXTRA = --rc lcov_branch_coverage=1 --highlight --legend --demangle-cpp
GENHTML_EXTRA = --rc lcov_branch_coverage=0 --highlight --legend --demangle-cpp
if PERLGD
GENHTML_EXTRA += --frames
endif # PERLGD
......
......@@ -429,4 +429,59 @@ TEST(customout, file_levelgreater)
);
};
TEST_GROUP(stdoutlog)
{
void setup()
{
setenv("CSER_LOGDESTINATION", "stdout", 1);
setenv("CSER_LOGLEVEL", "9", 1);
}
void teardown()
{
unsetenv("CSER_LOGDESTINATION");
unsetenv("CSER_LOGLEVEL");
}
};
TEST(stdoutlog, alllogs)
{
FLOG() << "Fatal";
ALOG() << "Alert";
CLOG() << "Crit";
ELOG() << "Error";
WLOG() << "Warning";
NLOG() << "Notice";
ILOG() << "Info";
DLOG() << "Debug";
TLOG() << "Trace";
};
TEST_GROUP(stderrlog)
{
void setup()
{
setenv("CSER_LOGDESTINATION", "stderr", 1);
setenv("CSER_LOGLEVEL", "9", 1);
}
void teardown()
{
unsetenv("CSER_LOGDESTINATION");
unsetenv("CSER_LOGLEVEL");
}
};
TEST(stderrlog, alllogs)
{
FLOG() << "Fatal";
ALOG() << "Alert";
CLOG() << "Crit";
ELOG() << "Error";
WLOG() << "Warning";
NLOG() << "Notice";
ILOG() << "Info";
DLOG() << "Debug";
TLOG() << "Trace";
};
#endif /* end of include guard: UT_LIBYAPLOG_H_SHF9IC0C */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment