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
14 changes: 12 additions & 2 deletions lib/lcovutil.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1093,6 +1093,7 @@ my %rc_common = (
"lcov_branch_coverage" => \$lcovutil::br_coverage,
"ignore_errors" => \@rc_ignore,
"max_message_count" => \$lcovutil::suppressAfter,
"message_log" => \$lcovutil::message_log,
'expected_message_count' => \@rc_expected_msg_counts,
'stop_on_error' => \$lcovutil::stop_on_error,
'treat_warning_as_error' => \$lcovutil::treat_warning_as_error,
Expand Down Expand Up @@ -1305,13 +1306,22 @@ sub read_config($$)
'config file inclusion loop detected: "' .
join('" -> "', @include_stack) .
'" -> "' . $filename . '"');
return 0;
# this line is unreachable as we can't ignore the 'usage' error
# because it is generated when we parse the config-file options
# but the '--ignore-errors' option isn't parsed until later, after
# the GetOptions call.
# This could be fixed by doing some early processing on the command
# line (similar to how config file options are handled) - but that
# seems like overkill. Just force the user to fix the issues.
return 0; # LCOV_UNREACHABLE_LINE
}

if (!open(HANDLE, "<", $filename)) {
lcovutil::ignorable_error($lcovutil::ERROR_USAGE,
"cannot read configuration file '$filename': $!");
return 0; # didn't set anything
# similarly, this line is also unreachable for the same reasons as
# described above.
return 0; # didn't set anything LCOV_UNREACHABLE_LINE
}
$included_config_files{abs_path($filename)} = 1;
push(@include_stack, $filename);
Expand Down
14 changes: 14 additions & 0 deletions man/lcovrc.5
Original file line number Diff line number Diff line change
Expand Up @@ -1147,6 +1147,20 @@ This option is used by genhtml, lcov, and geninfo.

.PP

.BR message_log " ="
.IR filename
.IP
Specify location to store error and warning messages (in addition to writing to STDERR).
If not specified, then the default location is used.
.br

.br
This attribute is equivalent to the
.I \-\-msg\-log
command line option. The command line option takes precedence if both are specified.

.PP

.BR stop_on_error " = "
.IR 0|1
.IP
Expand Down
46 changes: 44 additions & 2 deletions tests/gendiffcov/errs/msgtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set +x

source ../../common.tst

rm -f test.cpp *.gcno *.gcda a.out *.info *.log *.json diff.txt loop*.rc markers.err*
rm -f test.cpp *.gcno *.gcda a.out *.info *.log *.json diff.txt loop*.rc markers.err* readThis.rc testing.rc
rm -rf select criteria annotate empty unused_src scriptErr scriptFixed epoch inconsistent highlight etc mycache cacheFail expect subset context labels sortTables

clean_cover
Expand Down Expand Up @@ -172,6 +172,12 @@ if [ 0 != $? ] ; then
fi
echo lcov $LCOV_OPTS --summary initial.info --prune --ignore usage
$COVER $LCOV_TOOL $LCOV_OPTS --summary initial.info --prune --ignore usgae 2>&1 | tee prune_warn.log
if [ 0 != $? ] ; then
echo "ERROR: lcov prune faled"
if [ 0 == $KEEP_GOING ] ; then
exit 1
fi
fi

echo lcov $LCOV_OPTS --capture -d . -o build.info --build-dir x/y
$COVER $LCOV_TOOL $LCOV_OPTS --capture -d . -o build.info --build-dir x/y 2>&1 | tee build_dir_err.log
Expand Down Expand Up @@ -207,7 +213,13 @@ fi


echo lcov $LCOV_OPTS --summary initial.info --config-file noSuchFile --ignore usage
$COVER $LCOV_TOOL $LCOV_OPTS --summary initial.info --config-file noSuchFile --ignore usgae 2>&1 | tee err_missing.log
$COVER $LCOV_TOOL $LCOV_OPTS --summary initial.info --config-file noSuchFile 2>&1 | tee err_missing.log
if [ 0 == ${PIPESTATUS[0]} ] ; then
echo "ERROR: didn't exit after self missing config file error"
if [ 0 == $KEEP_GOING ] ; then
exit 1
fi
fi
grep "cannot read configuration file 'noSuchFile'" err_missing.log
if [ 0 != $? ] ; then
echo "ERROR: missing config file message"
Expand All @@ -216,10 +228,34 @@ if [ 0 != $? ] ; then
fi
fi

# read a config file which is there...
echo "message_log = message_file.log" > testing.rc
echo "config_file = testing.rc" > readThis.rc
echo lcov $LCOV_OPTS --summary initial.info --config-file readThis.rc
$COVER $LCOV_TOOL $LCOV_OPTS --summary initial.info --config-file readThis.rc
if [ ! == ${PIPESTATUS[0]} ] ; then
echo "ERROR: didn't read config file"
if [ 0 == $KEEP_GOING ] ; then
exit 1
fi
fi
if [ !-f message_file.log] ; then
echo "ERROR: didn't honor message_log"
if [ 0 == $KEEP_GOING ] ; then
exit 1
fi
fi

# loop in config file inclusion
echo "config_file = loop1.rc" > loop1.rc
echo lcov $LCOV_OPTS --summary initial.info --config-file loop1.rc --ignore usage
$COVER $LCOV_TOOL $LCOV_OPTS --summary initial.info --config-file loop1.rc --ignore usage 2>&1 | tee err_selfloop.log
if [ 0 == ${PIPESTATUS[0]} ] ; then
echo "ERROR: skipped self loop error - which isn't supposed to be possible right now"
if [ 0 == $KEEP_GOING ] ; then
exit 1
fi
fi
grep "config file inclusion loop" err_selfloop.log
if [ 0 != $? ] ; then
echo "ERROR: missing config file message"
Expand All @@ -232,6 +268,12 @@ echo "config_file = loop3.rc" > loop2.rc
echo 'config_file = $ENV{PWD}/loop2.rc' > loop3.rc
echo lcov $LCOV_OPTS --summary initial.info --config-file loop2.rc --ignore usage
$COVER $LCOV_TOOL $LCOV_OPTS --summary initial.info --config-file loop2.rc --ignore usage 2>&1 | tee err_loop.log
if [ 0 == ${PIPESTATUS[0]} ] ; then
echo "ERROR: skipped self loop error2 - which isn't supposed to be possible"
if [ 0 == $KEEP_GOING ] ; then
exit 1
fi
fi
grep "config file inclusion loop" err_loop.log
if [ 0 != $? ] ; then
echo "ERROR: missing config file message"
Expand Down