xref: /minix3/minix/tests/test39.c (revision 433d6423c39e34ec4b79c950597bb2d236f886be)
1*433d6423SLionel Sambuc 
2*433d6423SLionel Sambuc #define _MINIX_SYSTEM
3*433d6423SLionel Sambuc 
4*433d6423SLionel Sambuc #include <stdio.h>
5*433d6423SLionel Sambuc #include <minix/endpoint.h>
6*433d6423SLionel Sambuc #include <minix/sys_config.h>
7*433d6423SLionel Sambuc int max_error = 1;
8*433d6423SLionel Sambuc #include "common.h"
9*433d6423SLionel Sambuc 
10*433d6423SLionel Sambuc 
11*433d6423SLionel Sambuc void test39a(void);
12*433d6423SLionel Sambuc 
main(int argc,char * argv[])13*433d6423SLionel Sambuc int main(int argc, char *argv[])
14*433d6423SLionel Sambuc {
15*433d6423SLionel Sambuc   start(39);
16*433d6423SLionel Sambuc   test39a();
17*433d6423SLionel Sambuc   quit();
18*433d6423SLionel Sambuc   return(-1);	/* Unreachable */
19*433d6423SLionel Sambuc }
20*433d6423SLionel Sambuc 
test39a()21*433d6423SLionel Sambuc void test39a()
22*433d6423SLionel Sambuc {
23*433d6423SLionel Sambuc   int g, p;
24*433d6423SLionel Sambuc 
25*433d6423SLionel Sambuc   subtest = 1;
26*433d6423SLionel Sambuc 
27*433d6423SLionel Sambuc   for (g = 0; g <= _ENDPOINT_MAX_GENERATION; g++) {
28*433d6423SLionel Sambuc 	for (p = -MAX_NR_TASKS; p < MAX_NR_PROCS; p++) {
29*433d6423SLionel Sambuc 		endpoint_t ept;
30*433d6423SLionel Sambuc 		int mg, mp;
31*433d6423SLionel Sambuc 		ept = _ENDPOINT(g, p);
32*433d6423SLionel Sambuc 		mg = _ENDPOINT_G(ept);
33*433d6423SLionel Sambuc 		mp = _ENDPOINT_P(ept);
34*433d6423SLionel Sambuc 		if (mg != g || mp != p) e(1);
35*433d6423SLionel Sambuc 		if (g == 0 && ept != p) e(2);
36*433d6423SLionel Sambuc 		if (ept == ANY || ept == SELF || ept == NONE) e(3);
37*433d6423SLionel Sambuc 	}
38*433d6423SLionel Sambuc   }
39*433d6423SLionel Sambuc }
40