Skip to content

Commit

Permalink
Increasing coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
flplv committed Dec 22, 2016
1 parent b552495 commit 98ec802
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
8 changes: 8 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,11 @@ coverage:
- "/usr"
- "dependencies/*"
- "*/UtestPlatform.cpp"

comment:
layout: "header, diff, tree"
behavior: default
require_changes: false # if true: only post the comment if coverage changes
branches: null
flags: null
paths: null
8 changes: 5 additions & 3 deletions reacto_tests/src_host_tests/reusables/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ uint32_t time_now_ms()
{
struct timeval tv;

if (gettimeofday(&tv, NULL) != 0)
{
int r = gettimeofday(&tv, NULL);

if (r != 0) //LCOV_EXCL_LINE
{ //LCOV_EXCL_LINE
log_error("Unable to get time of day: %s", strerror(errno)); //LCOV_EXCL_LINE
return 0; //LCOV_EXCL_LINE
}
} //LCOV_EXCL_LINE

uint32_t msec = (uint32_t)(tv.tv_sec * 1000 + tv.tv_usec / 1000);
return msec;
Expand Down
6 changes: 3 additions & 3 deletions reacto_tests/src_tests/reusables/log_mock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ static size_t get_buffer (size_t n, char ** const ret_buf)
buf = (char *)realloc(buf, size);
}

if (ret_buf)
if (ret_buf) //LCOV_EXCL_LINE
*ret_buf = buf;
return size;
}
Expand All @@ -32,8 +32,8 @@ static const char * format(const char * format, va_list ap)
va_copy(ap2, ap);

int n = vsnprintf(NULL, 0, format, ap);
if (n < 0)
FAIL("Error on vsnprintf"); //LCOV_EXCL_LINE
if (n < 0) //LCOV_EXCL_LINE
FAIL("Error on vsnprintf"); //LCOV_EXCL_LINE

size_t size = get_buffer((size_t)n, &buf);

Expand Down
4 changes: 3 additions & 1 deletion reacto_tests/src_tests/reusables/test_timeout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ TEST(timeout, test)

uint32_t now = time_now_ms();

while (!timeout_check(&tout, 100));
bool r = timeout_check(&tout, 100);
while (!r)
r = timeout_check(&tout, 100);

CHECK_TRUE( (now + 100) <= time_now_ms() );
}
Expand Down

0 comments on commit 98ec802

Please sign in to comment.