Skip to contentSkip to conversation

testsuite/smokey: relax posix-clock time dependancy

PATCH In review Henning Schild 3 participants 6 messages Nov 9, 2018 – Dec 20, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 testsuite/smokey: relax posix-clock time dependancy

The test often asserted. This patch gives the thread a priority, introduces a 25us margin and prints the value in case we still fail.

---
 testsuite/smokey/posix-clock/posix-clock.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
testsuite/smokey/posix-clock/posix-clock.c +14 -1
index f672a9d52..36e0f5dea 100644
@@ -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)) {
+		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, &params);
+}
+
 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;
Signature · 1 line
2.19.1
#1 lore raw
Quoted 13 lines · Henning Schild via Xenomai

The test often asserted. This patch gives the thread a priority, introduces a 25us margin and prints the value in case we still fail.

---
  testsuite/smokey/posix-clock/posix-clock.c | 15 ++++++++++++++-
  1 file changed, 14 insertions(+), 1 deletion(-)
testsuite/smokey/posix-clock/posix-clock.c +0 -0
index f672a9d52..36e0f5dea 100644

testsuite/smokey/posix-clock/posix-clock.c static int clock_decrease_after_periodic_timer_first_tick(void) · line 420

Quoted 5 lines
testsuite/smokey/posix-clock/posix-clock.c +1 -1
@@ -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

Quoted 29 lines
testsuite/smokey/posix-clock/posix-clock.c +13 -0
+		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, &params);
+}
+
  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;
Signature · 2 lines
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
#2 lore raw

Am Fri, 16 Nov 2018 07:23:47 +0100
schrieb Jan Kiszka <[email protected]>:

Quoted 9 lines · Henning Schild via Xenomai
Quoted 8 lines

The test often asserted. This patch gives the thread a priority, introduces a 25us margin and prints the value in case we still fail.

---
  testsuite/smokey/posix-clock/posix-clock.c | 15 ++++++++++++++-
  1 file changed, 14 insertions(+), 1 deletion(-)
Quoted 15 lines

testsuite/smokey/posix-clock/posix-clock.c static int clock_decrease_after_periodic_timer_first_tick(void) · line 420

Quoted 11 lines
(quoted diff) +0 -0

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);

testsuite/smokey/posix-clock/posix-clock.c +1 -1
-	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.

Good question. That is an estimate suitable for x86. While it should not defeat the test, the test failing 60% of the time renders it not too useful.

Henning

Quoted 33 lines

Thanks,
Jan

Quoted 29 lines
testsuite/smokey/posix-clock/posix-clock.c +2 -0
+		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)); }

testsuite/smokey/posix-clock/posix-clock.c +5 -0
+static int init_posix_clock(void)
+{
+	struct sched_param params = {.sched_priority = 1};
+
+	return pthread_setschedparam(pthread_self(), SCHED_FIFO,

&params); +}
+
static int run_posix_clock(struct smokey_test *t, int argc, char
*const argv[]) {
int ret;

testsuite/smokey/posix-clock/posix-clock.c +4 -0
+	ret = init_posix_clock();
+	if (ret)
+		return ret;
+
  	ret = clock_increase_before_oneshot_timer_first_tick();
  	if (ret)
  		return ret;
#3 lore raw
Quoted 28 lines · Henning Schild

Am Fri, 16 Nov 2018 07:23:47 +0100
schrieb Jan Kiszka <[email protected]>:

Quoted 9 lines · Henning Schild via Xenomai
Quoted 8 lines

The test often asserted. This patch gives the thread a priority, introduces a 25us margin and prints the value in case we still fail.

---
  testsuite/smokey/posix-clock/posix-clock.c | 15 ++++++++++++++-
  1 file changed, 14 insertions(+), 1 deletion(-)
Quoted 15 lines

testsuite/smokey/posix-clock/posix-clock.c static int clock_decrease_after_periodic_timer_first_tick(void) · line 420

Quoted 11 lines
(quoted diff) +0 -0

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);

testsuite/smokey/posix-clock/posix-clock.c +1 -1
-	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.

Quoted 4 lines

Good question. That is an estimate suitable for x86. While it should not defeat the test, the test failing 60% of the time renders it not too useful.

Did you calibrate the timer shot with the autotune utility before running that test?

Signature · 1 line
Philippe.
#4 lore raw

Am Mon, 19 Nov 2018 10:52:34 +0100
schrieb Philippe Gerum <[email protected]>:

Quoted 31 lines · Henning Schild
Quoted 30 lines

Am Fri, 16 Nov 2018 07:23:47 +0100
schrieb Jan Kiszka <[email protected]>:

Quoted 26 lines · Henning Schild via Xenomai
Quoted 20 lines

The test often asserted. This patch gives the thread a priority, introduces a 25us margin and prints the value in case we still fail.

---
  testsuite/smokey/posix-clock/posix-clock.c | 15 ++++++++++++++-
  1 file changed, 14 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

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);

(quoted diff) +1 -1
-	if (!smokey_assert(diff < 1000000000))
+	if (!smokey_assert(diff < 1000000000ULL + 25000ULL))
Quoted 1 line

{

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.

Quoted 7 lines
Quoted 4 lines

Good question. That is an estimate suitable for x86. While it should not defeat the test, the test failing 60% of the time renders it not too useful.

Did you calibrate the timer shot with the autotune utility before running that test?

I also saw it failing after calibration, otherwise i would have added the calibration to xeno-test.

Henning

#5 lore raw
Quoted 39 lines · Henning Schild

Am Mon, 19 Nov 2018 10:52:34 +0100
schrieb Philippe Gerum <[email protected]>:

Quoted 36 lines · Henning Schild
Quoted 34 lines

Am Fri, 16 Nov 2018 07:23:47 +0100
schrieb Jan Kiszka <[email protected]>:

Quoted 10 lines · Henning Schild via Xenomai
Quoted 9 lines

The test often asserted. This patch gives the thread a priority, introduces a 25us margin and prints the value in case we still fail.

---
   testsuite/smokey/posix-clock/posix-clock.c | 15 ++++++++++++++-
   1 file changed, 14 insertions(+), 1 deletion(-)
Quoted 16 lines
Quoted 11 lines
(quoted diff) +0 -0

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);

(quoted diff) +1 -1
-	if (!smokey_assert(diff < 1000000000))
+	if (!smokey_assert(diff < 1000000000ULL + 25000ULL))
Quoted 1 line

{

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.

Good question. That is an estimate suitable for x86. While it should not defeat the test, the test failing 60% of the time renders it not too useful.

Quoted 6 lines
Quoted 2 lines

Did you calibrate the timer shot with the autotune utility before running that test?

I also saw it failing after calibration, otherwise i would have added the calibration to xeno-test.

This discussion stranded. Philippe, if you have any further input on the value, that could help to resolve this.

Thanks,
Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux