1 #include <ccan/oserver/oserver.h>
2 #include <ccan/oserver/oserver.c>
3 #include <ccan/str/str.h>
4 #include <ccan/foreach/foreach.h>
5 #include <ccan/tap/tap.h>
19 /* This is how many tests you plan to run */
26 "This is a test\nWith extra",
27 "This is a test\rWith extra",
28 "This is a test\r\nWith extra") {
29 fd = open("run-fd", O_RDWR|O_CREAT|O_TRUNC, 0600);
31 write(fd, input, strlen(input));
32 lseek(fd, 0, SEEK_SET);
39 ok1(WIFEXITED(status));
40 ok1(WEXITSTATUS(status) == 0);
42 lseek(fd, 0, SEEK_SET);
43 buf[read(fd, buf, sizeof(buf)-1)] = '\0';
45 ok1(strncmp(buf, input, strlen("This is a test")) == 0);
46 ok1(streq(buf + strlen("This is a test") + 1,
47 "Louder, like this: 'THIS IS A TEST'\r\n"));
50 /* This exits depending on whether all tests passed */