]> git.ozlabs.org Git - ccan/commitdiff
failtest, tools: update for new timespec-using ccan/time module.
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 10 Sep 2012 06:14:54 +0000 (15:44 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 10 Sep 2012 06:14:54 +0000 (15:44 +0930)
ccan/failtest/failtest.c
tools/Makefile
tools/ccanlint/async.c
tools/tools.c

index b3ee0337ebd96cfb7fe9a3b7cd3114fe473404c8..ed9e1e98eeadde6ae55d1635f01b62b3ad73a778 100644 (file)
@@ -91,7 +91,7 @@ static int control_fd = -1;
 /* If we're a child, this is the first call we did ourselves. */
 static struct failtest_call *our_history_start = NULL;
 /* For printing runtime with --trace. */
 /* If we're a child, this is the first call we did ourselves. */
 static struct failtest_call *our_history_start = NULL;
 /* For printing runtime with --trace. */
-static struct timeval start;
+static struct timespec start;
 /* Set when failtest_hook returns FAIL_PROBE */
 static bool probing = false;
 /* Table to track duplicates. */
 /* Set when failtest_hook returns FAIL_PROBE */
 static bool probing = false;
 /* Table to track duplicates. */
@@ -761,7 +761,7 @@ static bool should_fail(struct failtest_call *call)
        if (child == 0) {
                traceindent++;
                if (tracef) {
        if (child == 0) {
                traceindent++;
                if (tracef) {
-                       struct timeval diff;
+                       struct timespec diff;
                        const char *p;
                        char *failpath;
                        struct failtest_call *c;
                        const char *p;
                        char *failpath;
                        struct failtest_call *c;
@@ -776,7 +776,7 @@ static bool should_fail(struct failtest_call *call)
                                p = c->file;
                        trace("%u->%u (%u.%02u): %s (%s:%u)\n",
                              getppid(), getpid(),
                                p = c->file;
                        trace("%u->%u (%u.%02u): %s (%s:%u)\n",
                              getppid(), getpid(),
-                             (int)diff.tv_sec, (int)diff.tv_usec / 10000,
+                             (int)diff.tv_sec, (int)diff.tv_nsec / 10000000,
                              failpath, p, c->line);
                        free(failpath);
                }
                              failpath, p, c->line);
                        free(failpath);
                }
index 4bc7497ae4fd2e2d3ee4ff36374e83dc7289bfb1..da2353271b3246c6203db26826a0c8c766ad9a2c 100644 (file)
@@ -1,5 +1,5 @@
 ALL_TOOLS = tools/configurator/configurator tools/ccan_depends tools/doc_extract tools/namespacize tools/ccanlint/ccanlint
 ALL_TOOLS = tools/configurator/configurator tools/ccan_depends tools/doc_extract tools/namespacize tools/ccanlint/ccanlint
-
+LDLIBS = -lrt
 DEP_OBJS = ccan/grab_file/grab_file.o \
        ccan/noerr/noerr.o \
        ccan/read_write_all/read_write_all.o \
 DEP_OBJS = ccan/grab_file/grab_file.o \
        ccan/noerr/noerr.o \
        ccan/read_write_all/read_write_all.o \
index 4f51dd62db942d7a4d4f63a9e33ec98d6e85906d..680f947c357305aa945d7db765c215323aa47636 100644 (file)
@@ -70,7 +70,7 @@ static void run_more(void)
 
                        signal(SIGALRM, killme);
                        itim.it_interval.tv_sec = itim.it_interval.tv_usec = 0;
 
                        signal(SIGALRM, killme);
                        itim.it_interval.tv_sec = itim.it_interval.tv_usec = 0;
-                       itim.it_value = time_from_msec(c->time_ms);
+                       itim.it_value = timespec_to_timeval(time_from_msec(c->time_ms));
                        setitimer(ITIMER_REAL, &itim, NULL);
 
                        c->status = system(c->command);
                        setitimer(ITIMER_REAL, &itim, NULL);
 
                        c->status = system(c->command);
index 1eddf7e934ab9f658cadb9fe4e7a2c34b8312b15..5b6581e5fc068c69218c4823672fef13a286c58e 100644 (file)
@@ -73,7 +73,7 @@ char *run_with_timeout(const void *ctx, const char *cmd,
        int p[2];
        char *ret;
        int status, ms;
        int p[2];
        char *ret;
        int status, ms;
-       struct timeval start;
+       struct timespec start;
 
        *ok = false;
        if (pipe(p) != 0)
 
        *ok = false;
        if (pipe(p) != 0)
@@ -106,7 +106,7 @@ char *run_with_timeout(const void *ctx, const char *cmd,
 
                signal(SIGALRM, killme);
                itim.it_interval.tv_sec = itim.it_interval.tv_usec = 0;
 
                signal(SIGALRM, killme);
                itim.it_interval.tv_sec = itim.it_interval.tv_usec = 0;
-               itim.it_value = time_from_msec(*timeout_ms);
+               itim.it_value = timespec_to_timeval(time_from_msec(*timeout_ms));
                setitimer(ITIMER_REAL, &itim, NULL);
 
                status = system(cmd);
                setitimer(ITIMER_REAL, &itim, NULL);
 
                status = system(cmd);