harness.c (3eb66e91a25497065c5322b1268cbc3953642227) | harness.c (83e367f9ad18d42a1883ee29f20608a2b93e1071) |
---|---|
1/* 2 * Copyright 2013, Michael Ellerman, IBM Corp. 3 * Licensed under GPLv2. 4 */ 5 6#include <errno.h> 7#include <signal.h> 8#include <stdbool.h> --- 7 unchanged lines hidden (view full) --- 16#include <link.h> 17#include <sys/stat.h> 18 19#include "subunit.h" 20#include "utils.h" 21 22#define KILL_TIMEOUT 5 23 | 1/* 2 * Copyright 2013, Michael Ellerman, IBM Corp. 3 * Licensed under GPLv2. 4 */ 5 6#include <errno.h> 7#include <signal.h> 8#include <stdbool.h> --- 7 unchanged lines hidden (view full) --- 16#include <link.h> 17#include <sys/stat.h> 18 19#include "subunit.h" 20#include "utils.h" 21 22#define KILL_TIMEOUT 5 23 |
24/* Setting timeout to -1 disables the alarm */ |
|
24static uint64_t timeout = 120; 25 26int run_test(int (test_function)(void), char *name) 27{ 28 bool terminated; 29 int rc, status; 30 pid_t pid; 31 --- 6 unchanged lines hidden (view full) --- 38 exit(test_function()); 39 } else if (pid == -1) { 40 perror("fork"); 41 return 1; 42 } 43 44 setpgid(pid, pid); 45 | 25static uint64_t timeout = 120; 26 27int run_test(int (test_function)(void), char *name) 28{ 29 bool terminated; 30 int rc, status; 31 pid_t pid; 32 --- 6 unchanged lines hidden (view full) --- 39 exit(test_function()); 40 } else if (pid == -1) { 41 perror("fork"); 42 return 1; 43 } 44 45 setpgid(pid, pid); 46 |
46 /* Wake us up in timeout seconds */ 47 alarm(timeout); | 47 if (timeout != -1) 48 /* Wake us up in timeout seconds */ 49 alarm(timeout); |
48 terminated = false; 49 50wait: 51 rc = waitpid(pid, &status, 0); 52 if (rc == -1) { 53 if (errno != EINTR) { 54 printf("unknown error from waitpid\n"); 55 return 1; --- 76 unchanged lines hidden --- | 50 terminated = false; 51 52wait: 53 rc = waitpid(pid, &status, 0); 54 if (rc == -1) { 55 if (errno != EINTR) { 56 printf("unknown error from waitpid\n"); 57 return 1; --- 76 unchanged lines hidden --- |