Skip to content

Commit

Permalink
make: Fix coverage target when using lcov 2.0 (cowsql#119)
Browse files Browse the repository at this point in the history
The lcov 2.0 release has some backward-incompatible changes, make it
ignore warnings for now.
  • Loading branch information
freeekanayaka authored Dec 28, 2023
2 parents 6577440 + daf31c4 commit fd63a69
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
3 changes: 3 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,9 @@ include $(top_srcdir)/aminclude_static.am
CODE_COVERAGE_DIRECTORY=./src
CODE_COVERAGE_OUTPUT_DIRECTORY=coverage
CODE_COVERAGE_OUTPUT_FILE=coverage.info
if LCOV_VERSION_2
CODE_COVERAGE_LCOV_SHOPTS_DEFAULT=--ignore-errors unused
endif
CODE_COVERAGE_IGNORE_PATTERN="/usr/include/*"
CODE_COVERAGE_BRANCH_COVERAGE=1
CODE_COVERAGE_LCOV_OPTIONS=$(CODE_COVERAGE_LCOV_OPTIONS_DEFAULT) --rc lcov_excl_br_line="assert\("
Expand Down
8 changes: 8 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ AM_CONDITIONAL(SANITIZE_ENABLED, test x"$enable_sanitize" = x"yes")
# Whether to enable code coverage.
AX_CODE_COVERAGE

# Check if lcov >= 2.0
AS_IF([test x"$enable_code_coverage" = xyes],
[AX_COMPARE_VERSION($(lcov --version|cut -f 4 -d " " | cut -f 1 -d -), [ge], [2.0],
[have_lcov_2=yes], [have_lcov_2=no])
],
[have_lcov_2=no])
AM_CONDITIONAL(LCOV_VERSION_2, test x"$have_lcov_2" = x"yes")

# Checks for header files.
AC_CHECK_HEADERS([stdlib.h string.h stdio.h assert.h unistd.h linux/io_uring.h linux/aio_abi.h])

Expand Down
4 changes: 3 additions & 1 deletion src/raft.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ int raft_step(struct raft *r,
struct raft_event *event,
struct raft_update *update)
{
const char *state_name;
int rv;

assert(event != NULL);
Expand Down Expand Up @@ -478,7 +479,8 @@ int raft_step(struct raft *r,
event->snapshot.trailing);
break;
case RAFT_TIMEOUT:
infof("timeout as %s", raft_state_name(r->state));
state_name = raft_state_name(r->state);
infof("timeout as %s", state_name);
rv = Tick(r);
break;
case RAFT_SUBMIT:
Expand Down
12 changes: 8 additions & 4 deletions src/uv_snapshot.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,17 @@ static int uvSnapshotIsOrphanInternal(const char *dir,
bool meta,
bool *orphan)
{
int rv;
*orphan = false;

raft_term term;
raft_index index;
raft_time timestamp;
if (!uvSnapshotParseFilename(filename, meta, &term, &index, &timestamp)) {
bool is_snapshot_filename;
int rv;

*orphan = false;

is_snapshot_filename =
uvSnapshotParseFilename(filename, meta, &term, &index, &timestamp);
if (!is_snapshot_filename) {
return 0;
}

Expand Down

0 comments on commit fd63a69

Please sign in to comment.