Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a745f7af authored by Kees Cook's avatar Kees Cook Committed by Shuah Khan
Browse files

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: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
parent 9dd3fcb0
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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,