* [PATCH] selftests/harness: Add 30 second timeout per test
@ 2019-04-12 0:11 Kees Cook
0 siblings, 0 replies; only message in thread
From: Kees Cook @ 2019-04-12 0:11 UTC (permalink / raw)
To: Shuah Khan; +Cc: linux-kernel, linux-kselftest
In order to keep tests from hanging forever, this adds an alarm signal
to each test run. This assumes an individual test doesn't take longer
than 30 seconds.
Signed-off-by: Kees Cook <keescook@chromium.org>
---
tools/testing/selftests/kselftest_harness.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h
index 2d90c98eeb67..941d9391377f 100644
--- a/tools/testing/selftests/kselftest_harness.h
+++ b/tools/testing/selftests/kselftest_harness.h
@@ -696,6 +696,7 @@ void __run_test(struct __test_metadata *t)
t->passed = 1;
t->trigger = 0;
printf("[ RUN ] %s\n", t->name);
+ alarm(30);
child_pid = fork();
if (child_pid < 0) {
printf("ERROR SPAWNING TEST CHILD\n");
@@ -744,6 +745,7 @@ void __run_test(struct __test_metadata *t)
}
}
printf("[ %4s ] %s\n", (t->passed ? "OK" : "FAIL"), t->name);
+ alarm(0);
}
static int test_harness_run(int __attribute__((unused)) argc,
--
2.17.1
--
Kees Cook
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2019-04-12 0:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-12 0:11 [PATCH] selftests/harness: Add 30 second timeout per test Kees Cook
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox