3 * Test select(...) system call
9 #include <sys/syslimits.h>
19 int main(int argc
, char **argv
) {
20 char *tests
[] = {"t40a", "t40b", "t40c", "t40d", "t40e", "t40f", "t40g"};
21 char copy_command
[8+PATH_MAX
+1];
22 int no_tests
, i
, forkres
, status
= 0;
24 no_tests
= sizeof(tests
) / sizeof(char *);
28 for(i
= 0; i
< no_tests
; i
++) {
30 snprintf(subtest
, 2, "%d", i
+1);
33 snprintf(copy_command
, 8 + PATH_MAX
, "cp ../%s .", tests
[i
]);
37 if(forkres
== 0) { /* Child */
38 execl(tests
[i
], tests
[i
], subtest
, (char *) 0);
39 printf("Failed to execute subtest %s\n", tests
[i
]);
41 } else if(forkres
> 0) { /* Parent */
42 if(waitpid(forkres
, &status
, 0) > 0 && WEXITSTATUS(status
) < 20) {
43 errct
+= WEXITSTATUS(status
); /* Count errors */
45 status
= 0; /* Reset */
47 printf("Failed to fork\n");
54 return (-1); /* Impossible */