summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Erik Werner <martinerikwerner.aac@gmail.com>2018-05-15 11:21:55 +0200
committerJoel Sherrill <joel@rtems.org>2018-05-30 15:00:15 -0500
commitbaee0dc5a362a3f75343ce3a43779afcb1f4fc57 (patch)
tree3338e839a6bc5bffed3ebb57a30a412ab8679e16
parentbsp/atsam: Remove side effect from gmac functions. (diff)
downloadrtems-baee0dc5a362a3f75343ce3a43779afcb1f4fc57.tar.bz2
Fix and extend error message in posix timer test
_Timespec_Equal_to() does not set errno, hence avoid using perror(), instead use fprintf() to stderr, and extend the error message to provide information about what the error is (measured timer value after re-arming is not equal to the configured interval), and how large of a difference was measured. Signed-off-by: Martin Erik Werner <martin.werner@aacmicrotec.com>
-rw-r--r--testsuites/psxtests/psxtimer01/psxtimer.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/testsuites/psxtests/psxtimer01/psxtimer.c b/testsuites/psxtests/psxtimer01/psxtimer.c
index 032e9f8e6c..6ec049ac54 100644
--- a/testsuites/psxtests/psxtimer01/psxtimer.c
+++ b/testsuites/psxtests/psxtimer01/psxtimer.c
@@ -143,7 +143,12 @@ void * task_a (void *arg)
rtems_test_exit(0);
}
if (! _Timespec_Equal_to( &timerdata.it_value, &my_period )){
- perror ("Error in Task A timer_gettime\n");
+ fprintf(
+ stderr, "Error in Task A timer_gettime:\n"
+ " re-armed timer: %" PRIdtime_t ":%ld does not match interval: %" PRIdtime_t ":%ld\n",
+ timerdata.it_value.tv_sec, timerdata.it_value.tv_nsec,
+ my_period.tv_sec, my_period.tv_nsec
+ );
}
clock = time(NULL);
printf("Executing task A with count = %2i %s", params->count, ctime(&clock));
@@ -291,7 +296,12 @@ void * task_c (void *arg)
rtems_test_exit(0);
}
if (! _Timespec_Equal_to( &timerdata.it_value, &my_period) ){
- perror ("Error in Task C timer_gettime\n");
+ fprintf(
+ stderr, "Error in Task A timer_gettime:\n"
+ " re-armed timer: %" PRIdtime_t ":%ld does not match interval: %" PRIdtime_t ":%ld\n",
+ timerdata.it_value.tv_sec, timerdata.it_value.tv_nsec,
+ my_period.tv_sec, my_period.tv_nsec
+ );
}
pthread_mutex_lock (&data.mutex);
while (data.updated == FALSE) {