3 * Test select(...) system call
17 int main(int argc
, char **argv
) {
18 char *tests
[] = {"t40a", "t40b", "t40c", "t40d", "t40e", "t40f"};
19 char copy_command
[8+PATH_MAX
+1];
20 int no_tests
, i
, forkres
, status
= 0, errorct
= 0;
22 no_tests
= sizeof(tests
) / sizeof(char *);
26 for(i
= 0; i
< no_tests
; i
++) {
28 snprintf(subtest
, 2, "%d", i
+1);
31 snprintf(copy_command
, 8 + PATH_MAX
, "cp ../%s .", tests
[i
]);
35 if(forkres
== 0) { /* Child */
36 execl(tests
[i
], tests
[i
], subtest
, (char *) 0);
37 printf("Failed to execute subtest %s\n", tests
[i
]);
39 } else if(forkres
> 0) { /* Parent */
40 if(waitpid(forkres
, &status
, 0) > 0 && WEXITSTATUS(status
) < 20) {
41 errorct
+= WEXITSTATUS(status
); /* Count errors */
43 status
= 0; /* Reset */
45 printf("Failed to fork\n");
52 return (-1); /* Impossible */