selftests/powerpc: Allow tests to extend their kill timeout
authorCyril Bur <cyrilbur@gmail.com>
Fri, 23 Sep 2016 06:18:17 +0000 (16:18 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 4 Oct 2016 09:10:13 +0000 (20:10 +1100)
Signed-off-by: Cyril Bur <cyrilbur@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
tools/testing/selftests/powerpc/harness.c
tools/testing/selftests/powerpc/utils.h

index 52f9be7f61f028fd930d793f88146cbf911f8e9e..248a820048dfe89018697926f4f308acd786e694 100644 (file)
@@ -19,9 +19,9 @@
 #include "subunit.h"
 #include "utils.h"
 
-#define TIMEOUT                120
 #define KILL_TIMEOUT   5
 
+static uint64_t timeout = 120;
 
 int run_test(int (test_function)(void), char *name)
 {
@@ -44,7 +44,7 @@ int run_test(int (test_function)(void), char *name)
        setpgid(pid, pid);
 
        /* Wake us up in timeout seconds */
-       alarm(TIMEOUT);
+       alarm(timeout);
        terminated = false;
 
 wait:
@@ -94,6 +94,11 @@ static struct sigaction alarm_action = {
        .sa_handler = alarm_handler,
 };
 
+void test_harness_set_timeout(uint64_t time)
+{
+       timeout = time;
+}
+
 int test_harness(int (test_function)(void), char *name)
 {
        int rc;
index ecd11b51475d8b08a6c514147834f1b1fe0a688a..53405e8a52abf45cc5c7b9a880e860951732513e 100644 (file)
@@ -22,7 +22,7 @@ typedef uint32_t u32;
 typedef uint16_t u16;
 typedef uint8_t u8;
 
-
+void test_harness_set_timeout(uint64_t time);
 int test_harness(int (test_function)(void), char *name);
 extern void *get_auxv_entry(int type);
 int pick_online_cpu(void);