From 859b1bebe1e0e2e1fdfec77b019b9d7c27588e02 Mon Sep 17 00:00:00 2001 From: John Stultz Date: Wed, 13 May 2015 15:13:03 -0700 Subject: kselftests: timers: Increase delay between suspends in alarmtimer-suspend When testing on some hardware, waiting only a second before re-triggering suspend can keep TCP connections from re-establishing which after a number of cycles can cause TCP connections to close while the test is running. So extend the delay between suspend calls to 3 seconds to let the connections stay alive. Cc: Shuah Khan Cc: Prarit Bhargava Cc: Thomas Gleixner Cc: Richard Cochran Signed-off-by: John Stultz Signed-off-by: Shuah Khan --- tools/testing/selftests/timers/alarmtimer-suspend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools/testing/selftests/timers/alarmtimer-suspend.c') diff --git a/tools/testing/selftests/timers/alarmtimer-suspend.c b/tools/testing/selftests/timers/alarmtimer-suspend.c index aaffbde1d5ee..99a1ad331ac8 100644 --- a/tools/testing/selftests/timers/alarmtimer-suspend.c +++ b/tools/testing/selftests/timers/alarmtimer-suspend.c @@ -172,7 +172,7 @@ int main(void) while (alarmcount < 10) { int ret; - sleep(1); + sleep(3); ret = system("echo mem > /sys/power/state"); if (ret) break; -- cgit v1.2.3 From acd5705d2d17a229b1aa0e549951ec66164b9379 Mon Sep 17 00:00:00 2001 From: John Stultz Date: Wed, 13 May 2015 15:13:04 -0700 Subject: kselftests: timers: Ease alarmtimer-suspend unreasonable latency value On the hardware I have, resume latency from an alarm is often 2-3 seconds (with a fair amount of variability due to the RTC's single second granularity). Having four seconds be the pass/fail bar is maybe a little too tight, so extend this to 5 seconds. Cc: Shuah Khan Cc: Prarit Bhargava Cc: Thomas Gleixner Cc: Richard Cochran Signed-off-by: John Stultz Signed-off-by: Shuah Khan --- tools/testing/selftests/timers/alarmtimer-suspend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools/testing/selftests/timers/alarmtimer-suspend.c') diff --git a/tools/testing/selftests/timers/alarmtimer-suspend.c b/tools/testing/selftests/timers/alarmtimer-suspend.c index 99a1ad331ac8..13586b68ef51 100644 --- a/tools/testing/selftests/timers/alarmtimer-suspend.c +++ b/tools/testing/selftests/timers/alarmtimer-suspend.c @@ -57,7 +57,7 @@ static inline int ksft_exit_fail(void) #define NSEC_PER_SEC 1000000000ULL -#define UNREASONABLE_LAT (NSEC_PER_SEC * 4) /* hopefully we resume in 4secs */ +#define UNREASONABLE_LAT (NSEC_PER_SEC * 5) /* hopefully we resume in 5 secs */ #define SUSPEND_SECS 15 int alarmcount; -- cgit v1.2.3 From 61171d0407b537eff299aea2388773b6c760e6eb Mon Sep 17 00:00:00 2001 From: John Stultz Date: Wed, 13 May 2015 15:13:05 -0700 Subject: kselftests: timers: Check _ALARM clockids are supported before suspending It was reported that the alarmtimer-suspend test hangs on older systems that don't support _ALARM clockids. This is due to the fact that we don't check if the timer_create fails, and thus when we suspend, the system will not programatically resume. Fix this by checking the timer_create call for errors. Cc: Shuah Khan Cc: Prarit Bhargava Cc: Thomas Gleixner Cc: Richard Cochran Signed-off-by: John Stultz Signed-off-by: Shuah Khan --- tools/testing/selftests/timers/alarmtimer-suspend.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tools/testing/selftests/timers/alarmtimer-suspend.c') diff --git a/tools/testing/selftests/timers/alarmtimer-suspend.c b/tools/testing/selftests/timers/alarmtimer-suspend.c index 13586b68ef51..72cacf5383dd 100644 --- a/tools/testing/selftests/timers/alarmtimer-suspend.c +++ b/tools/testing/selftests/timers/alarmtimer-suspend.c @@ -152,7 +152,11 @@ int main(void) alarm_clock_id++) { alarmcount = 0; - timer_create(alarm_clock_id, &se, &tm1); + if (timer_create(alarm_clock_id, &se, &tm1) == -1) { + printf("timer_create failled, %s unspported?\n", + clockstring(alarm_clock_id)); + break; + } clock_gettime(alarm_clock_id, &start_time); printf("Start time (%s): %ld:%ld\n", clockstring(alarm_clock_id), -- cgit v1.2.3