VM: simplify slab allocator
[minix.git] / test / t11a.c
blob1f824f7d2ff8b367c8c850c86300fed1a9b6fbb7
1 /* t11a */
3 #include <sys/types.h>
4 #include <errno.h>
5 #include <fcntl.h>
6 #include <stdlib.h>
7 #include <unistd.h>
8 #include <stdio.h>
10 #define MAX_ERROR 4
12 int errct, subtest=1;
14 int main(int argc, char *argv [], char *envp []);
15 int diff(char *s1, char *s2);
16 void e(int n);
18 int main(argc, argv, envp)
19 int argc;
20 char *argv[], *envp[];
22 /* See if arguments passed ok. */
24 char aa[4];
26 if (diff(argv[0], "t11a")) e(21);
27 if (diff(argv[1], "arg0")) e(22);
28 if (diff(argv[2], "arg1")) e(23);
29 if (diff(argv[3], "arg2")) e(24);
30 if (diff(envp[0], "spring")) e(25);
31 if (diff(envp[1], "summer")) e(26);
32 if (argc != 4) e(27);
34 /* Now see if the files are ok. */
35 if (read(3, aa, 4) != 2) e(28);
36 if (aa[0] != 7 || aa[1] != 9) e(29);
38 if (getuid() == 10) e(30);
39 if (geteuid() != 10) e(31);
40 if (getgid() == 20) e(32);
41 if (getegid() != 20) e(33);
43 if (open("t1", 0) < 0) e(34);
44 if (open("t2", 0) < 0) e(35);
45 exit(100);
48 int diff(s1, s2)
49 char *s1, *s2;
51 while (1) {
52 if (*s1 == 0 && *s2 == 0) return(0);
53 if (*s1 != *s2) return (1);
54 s1++;
55 s2++;
59 void e(n)
60 int n;
62 printf("Subtest %d, error %d errno=%d ", subtest, n, errno);
63 perror("");
64 if (errct++ > MAX_ERROR) {
65 printf("Too many errors; test aborted\n");
66 chdir("..");
67 system("rm -rf DIR*");
68 exit(1);