diff options
author | Wolfgang Hommel <wolfgang.hommel@lrz.de> | 2013-10-01 13:12:34 +0200 |
---|---|---|
committer | Wolfgang Hommel <wolfgang.hommel@lrz.de> | 2013-10-01 13:12:34 +0200 |
commit | 8c1ba7899dff3917ebf595a1181eed1c4a415b7b (patch) | |
tree | 429b980e2db033d3a1e03581bf928a0c29ef579d /test | |
parent | c59e8165396a1d1a1ef6293dc8b48dc1e1430846 (diff) | |
download | faketime-ng-8c1ba7899dff3917ebf595a1181eed1c4a415b7b.tar.gz |
improved output readability for timer tests
Diffstat (limited to 'test')
-rw-r--r-- | test/timetest.c | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/test/timetest.c b/test/timetest.c index 48e02b7..b30afef 100644 --- a/test/timetest.c +++ b/test/timetest.c @@ -33,6 +33,8 @@ #ifndef __APPLE__ #include <signal.h> +#define VERBOSE 0 + static void handler(int sig, siginfo_t *si, void *uc) { @@ -148,18 +150,29 @@ int main (int argc, char **argv) { clock_gettime(CLOCK_REALTIME, &ts); printf("clock_gettime(): Current date and time: %s", ctime(&ts.tv_sec)); - printf("timer_getoverrun(timerid1), must be 3: %d\n", - timer_getoverrun(timerid1)); + int timer_getoverrun_timerid1 = timer_getoverrun(timerid1); + if (timer_getoverrun_timerid1 != 3) { + printf("timer_getoverrun(timerid1) FAILED, must be 3 but got: %d\n", timer_getoverrun_timerid1); + } + timer_gettime(timerid1, &its); - printf("timer_gettime(timerid1, &its); its = {{%ld, %ld,}, {%ld, %ld}}}\n", - its.it_interval.tv_sec, its.it_interval.tv_nsec, - its.it_value.tv_sec, its.it_value.tv_nsec); - printf("timer_getoverrun(timerid2), must be 0: %d\n", - timer_getoverrun(timerid2)); + if (VERBOSE == 1) { + printf("timer_gettime(timerid1, &its); its = {{%ld, %ld}, {%ld, %ld}}}\n", + its.it_interval.tv_sec, its.it_interval.tv_nsec, + its.it_value.tv_sec, its.it_value.tv_nsec); + } + + int timer_getoverrun_timerid2 = timer_getoverrun(timerid2); + if (timer_getoverrun_timerid2 != 0) { + printf("timer_getoverrun(timerid2) FAILED, must be 0 but got: %d\n", timer_getoverrun_timerid2); + } + timer_gettime(timerid2, &its); - printf("timer_gettime(timerid2, &its); its = {{%ld, %ld,}, {%ld, %ld}}}\n", - its.it_interval.tv_sec, its.it_interval.tv_nsec, - its.it_value.tv_sec, its.it_value.tv_nsec); + if (VERBOSE == 1) { + printf("timer_gettime(timerid2, &its); its = {{%ld, %ld}, {%ld, %ld}}}\n", + its.it_interval.tv_sec, its.it_interval.tv_nsec, + its.it_value.tv_sec, its.it_value.tv_nsec); + } #endif #ifdef FAKE_STAT |