#include <sys/wait.h>
#include <unistd.h>
#include <stdlib.h>
+#include <time.h>
static pid_t pid;
static int fds[2];
char *line = strndup(from, next - from);
char *a = line, *b;
do {
- b = line + strlen(line);
int idx = -1;
int i;
+ b = line + strlen(line);
for ( i = 0; i < 2; ++i ) {
if (subst[i].key) {
// printf("trying: %s -> %s\n", subst[i].value, subst[i].key);
}
}
-static void passed(int i, char *f) {
+static const char *duration(time_t start)
+{
+ static char buf[16];
+ int t = (int)(time(NULL) - start);
+
+ sprintf(buf, "%2d:%02d", t / 60, t % 60);
+ return buf;
+}
+
+static void passed(int i, char *f, time_t t) {
if (strstr(readbuf, "TEST WARNING")) {
++s.nwarned;
s.status[i] = WARNED;
- printf("warnings\n");
+ printf("warnings %s\n", duration(t));
} else {
++ s.npassed;
s.status[i] = PASSED;
- printf("passed.\n");
+ printf("passed. %s\n", duration(t));
}
}
fflush(stderr);
_exit(202);
} else {
+ int st, w;
+ time_t start = time(NULL);
char buf[128];
snprintf(buf, 128, "%s ...", f);
buf[127] = 0;
printf("Running %-40s ", buf);
fflush(stdout);
- int st, w;
while ((w = waitpid(pid, &st, WNOHANG)) == 0) {
drain();
usleep(20000);
drain();
if (WIFEXITED(st)) {
if (WEXITSTATUS(st) == 0) {
- passed(i, f);
+ passed(i, f, start);
} else if (WEXITSTATUS(st) == 200) {
skipped(i, f);
} else {
}
int main(int argc, char **argv) {
+ const char *be_verbose = getenv("VERBOSE");
+ time_t start = time(NULL);
int i;
if (argc >= MAX) {
exit(1);
}
- s.nwarned = s.nfailed = s.npassed = s.nskipped = 0;
-
- char *be_verbose = getenv("VERBOSE");
if (be_verbose && atoi(be_verbose))
verbose = 1; // XXX
break;
}
- printf("\n## %d tests: %d OK, %d warnings, %d failures; %d skipped\n",
+ printf("\n## %d tests %s : %d OK, %d warnings, %d failures; %d skipped\n",
s.nwarned + s.npassed + s.nfailed + s.nskipped,
+ duration(start),
s.npassed, s.nwarned, s.nfailed, s.nskipped);
/* print out a summary */
printf("\n");
return s.nfailed > 0 || die;
}
+
return die;
}