On 09.11.18 10:14, Henning Schild via Xenomai wrote:
The test often asserted. This patch gives the thread a priority,
introduces a 25us margin and prints the value in case we still fail.
Signed-off-by: Henning Schild <henning.sch...@siemens.com>
---
testsuite/smokey/posix-clock/posix-clock.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/testsuite/smokey/posix-clock/posix-clock.c
b/testsuite/smokey/posix-clock/posix-clock.c
index f672a9d52..36e0f5dea 100644
--- a/testsuite/smokey/posix-clock/posix-clock.c
+++ b/testsuite/smokey/posix-clock/posix-clock.c
@@ -417,8 +417,10 @@ static int
clock_decrease_after_periodic_timer_first_tick(void)
diff = now.tv_sec * 1000000000ULL + now.tv_nsec -
(timer.it_value.tv_sec * 1000000000ULL +
timer.it_value.tv_nsec);
- if (!smokey_assert(diff < 1000000000))
+ if (!smokey_assert(diff < 1000000000ULL + 25000ULL)) {
Philippe, is this margin also reasonable from your perspective? Or are we
risking to miss a problem this way? I'm currently lacking a feeling.
Thanks,
Jan
+ fprintf(stderr, "diff = %llu\n", diff);
return -EINVAL;
+ }
ret = smokey_check_errno(read(t, &ticks, sizeof(ticks)));
if (ret < 0)
@@ -430,10 +432,21 @@ static int
clock_decrease_after_periodic_timer_first_tick(void)
return smokey_check_errno(close(t));
}
+static int init_posix_clock(void)
+{
+ struct sched_param params = {.sched_priority = 1};
+
+ return pthread_setschedparam(pthread_self(), SCHED_FIFO, ¶ms);
+}
+
static int run_posix_clock(struct smokey_test *t, int argc, char *const
argv[])
{
int ret;
+ ret = init_posix_clock();
+ if (ret)
+ return ret;
+
ret = clock_increase_before_oneshot_timer_first_tick();
if (ret)
return ret;
--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux