diff options
author | Kees Cook <keescook@chromium.org> | 2019-04-12 02:11:08 +0200 |
---|---|---|
committer | Shuah Khan <skhan@linuxfoundation.org> | 2019-04-17 01:04:34 +0200 |
commit | a745f7af3cbd04b9c9c9e803429e1c20775b538d (patch) | |
tree | 4d0031d5008980801320d11e749b1e7d665a4416 /tools/testing/selftests/kselftest_harness.h | |
parent | selftests/seccomp: Handle namespace failures gracefully (diff) | |
download | linux-a745f7af3cbd04b9c9c9e803429e1c20775b538d.tar.xz linux-a745f7af3cbd04b9c9c9e803429e1c20775b538d.zip |
selftests/harness: Add 30 second timeout per test
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>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/testing/selftests/kselftest_harness.h')
-rw-r--r-- | tools/testing/selftests/kselftest_harness.h | 2 |
1 files changed, 2 insertions, 0 deletions
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, |