diff options
author | Martin Pitt <martin.pitt@ubuntu.com> | 2016-02-29 15:16:11 +0100 |
---|---|---|
committer | Martin Pitt <martin.pitt@ubuntu.com> | 2016-02-29 15:19:30 +0100 |
commit | d69d951b11e80dbcc7f62938951832638119bdd9 (patch) | |
tree | fd2a0a788c457edc22646cadb5bdab1f71b6d782 | |
parent | cb971cc0317e6767a3394f721eac6efa99f51fed (diff) |
test-clock: fix assertions
Use assert_se() to ensure that they don't get optimized away.
-rw-r--r-- | src/test/test-clock.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/test/test-clock.c b/src/test/test-clock.c index b049d97ce7..0949793e5f 100644 --- a/src/test/test-clock.c +++ b/src/test/test-clock.c @@ -56,10 +56,10 @@ static void test_clock_is_localtime(void) { assert_se(clock_is_localtime("/nonexisting/adjtime") == 0); fd = mkostemp_safe(adjtime, O_WRONLY|O_CLOEXEC); - assert(fd > 0); + assert_se(fd >= 0); log_info("adjtime test file: %s", adjtime); f = fdopen(fd, "w"); - assert(f); + assert_se(f); for (size_t i = 0; i < ELEMENTSOF(scenarios); ++i) { log_info("scenario #%zu:, expected result %i", i, scenarios[i].expected_result); @@ -82,10 +82,10 @@ static void test_clock_is_localtime_system(void) { log_info("/etc/adjtime exists, clock_is_localtime() == %i", r); /* if /etc/adjtime exists we expect some answer, no error or * crash */ - assert(r == 0 || r == 1); + assert_se(r == 0 || r == 1); } else /* default is UTC if there is no /etc/adjtime */ - assert(r == 0); + assert_se(r == 0); } int main(int argc, char *argv[]) { |