3 * Test select(...) system call
14 int main(int argc
, char **argv
) {
15 char *tests
[] = {"t40a", "t40b", "t40c", "t40d", "t40e", "t40f"};
16 int no_tests
, i
, forkres
, status
= 0, errorct
= 0;
18 no_tests
= sizeof(tests
) / sizeof(char *);
23 for(i
= 0; i
< no_tests
; i
++) {
25 sprintf(subtest
, "%d", i
+1);
28 if(forkres
== 0) { /* Child */
29 execl(tests
[i
], tests
[i
], subtest
, (char *) 0);
30 printf("Failed to execute subtest %s\n", tests
[i
]);
32 } else if(forkres
> 0) { /* Parent */
33 if(waitpid(forkres
, &status
, 0) > 0 && WEXITSTATUS(status
) < 20) {
34 errorct
+= WEXITSTATUS(status
); /* Count errors */
36 status
= 0; /* Reset */
38 printf("Failed to fork\n");
47 printf("%d error(s)\n", errorct
);
51 return (-1); /* Impossible */