]> begriffs open source - libtap/blob - t/test.c
Allow CFLAGS and CC to be append and set
[libtap] / t / test.c
1 #include "tap.h"
2 #include <stdio.h>
3 #include <dirent.h>
4 #include <stdlib.h>
5 #include <string.h>
6
7 int main () {
8     DIR *dp = opendir("t");
9     if (!dp) {
10         perror("opendir");
11         exit(1);
12     }
13     struct dirent *ep;
14     while ((ep = readdir(dp))) {
15         char *name = ep->d_name;
16         if (strchr(name, '.') || !strcmp(name, "test"))
17             continue;
18         char command[1024];
19         snprintf(command, 1024, "./t/%s >t/%s.got 2>&1", name, name);
20         system(command);
21         snprintf(command, 1024, "diff -up t/%s.expected t/%s.got", name, name);
22         int retval = system(command);
23         ok(!(retval >> 8), name);
24     }
25     closedir(dp);
26     done_testing();
27 }
28