If serial debugging in the boot monitor / kernel is enabled, don't touch
[minix.git] / test / test12.c
blob29e95ecd89efbfd78d83101118af4aa44109e50a
1 /* test 12 */
3 /* Copyright (C) 1987 by Martin Leisner. All rights reserved. */
4 /* Used by permission. */
6 #include <sys/types.h>
7 #include <sys/wait.h>
8 #include <stdlib.h>
9 #include <unistd.h>
10 #include <stdio.h>
12 #define NUM_TIMES 1000
14 int errct = 0;
16 _PROTOTYPE(int main, (void));
17 _PROTOTYPE(void quit, (void));
19 int main()
21 register int i;
22 int k;
24 printf("Test 12 ");
25 fflush(stdout); /* have to flush for child's benefit */
27 system("rm -rf DIR_12; mkdir DIR_12");
28 chdir("DIR_12");
30 for (i = 0; i < NUM_TIMES; i++) switch (fork()) {
31 case 0: exit(1); break;
32 case -1:
33 printf("fork broke\n");
34 exit(1);
35 default: wait(&k); break;
38 quit();
39 return(-1); /* impossible */
42 void quit()
45 chdir("..");
46 system("rm -rf DIR*");
48 if (errct == 0) {
49 printf("ok\n");
50 exit(0);
51 } else {
52 printf("%d errors\n", errct);
53 exit(1);