Lines Matching refs:test

33  * This is a test tool for IP divert sockets.  For the time being, it just
35 * behaviour. It would be highly desirable to broaden this test tool to
52 ok(const char *test)
55 fprintf(stderr, "%s: OK\n", test);
59 fail(const char *test, const char *note)
62 fprintf(stderr, "%s - %s: FAIL (%s)\n", test, note, strerror(errno));
67 failx(const char *test, const char *note)
70 fprintf(stderr, "%s - %s: FAIL\n", test, note);
75 ipdivert_create(const char *test)
81 fail(test, "socket");
86 ipdivert_close(const char *test, int s)
90 fail(test, "close");
94 ipdivert_bind(const char *test, int s, u_short port, int expect)
107 fail(test, "bind");
109 fail(test, "bind");
112 failx(test, "bind");
119 const char *test;
123 * First test: create and close an IP divert socket.
125 test = "create_close";
126 s1 = ipdivert_create(test);
127 ipdivert_close(test, s1);
128 ok(test);
131 * Second test: create, bind, and close an IP divert socket.
133 test = "create_bind_close";
134 s1 = ipdivert_create(test);
135 ipdivert_bind(test, s1, 1000, 0);
136 ipdivert_close(test, s1);
137 ok(test);
140 * Third test: create two sockets, bind to different ports, and close.
143 test = "create2_bind2_close2";
144 s1 = ipdivert_create(test);
145 s2 = ipdivert_create(test);
146 ipdivert_bind(test, s1, 1000, 0);
147 ipdivert_bind(test, s2, 1001, 0);
148 ipdivert_close(test, s1);
149 ipdivert_close(test, s2);
150 ok(test);
153 * Fourth test: create two sockets, bind to the *same* port, and
156 test = "create2_bind2_conflict_close2";
157 s1 = ipdivert_create(test);
158 s2 = ipdivert_create(test);
159 ipdivert_bind(test, s1, 1000, 0);
160 ipdivert_bind(test, s2, 1000, EADDRINUSE);
161 ipdivert_close(test, s1);
162 ipdivert_close(test, s2);
163 ok(test);