Commit b980b856 authored by Rusty Russell's avatar Rusty Russell

failtest, tools: update for new timespec-using ccan/time module.

parent 2012d45e
...@@ -91,7 +91,7 @@ static int control_fd = -1; ...@@ -91,7 +91,7 @@ static int control_fd = -1;
/* If we're a child, this is the first call we did ourselves. */ /* If we're a child, this is the first call we did ourselves. */
static struct failtest_call *our_history_start = NULL; static struct failtest_call *our_history_start = NULL;
/* For printing runtime with --trace. */ /* For printing runtime with --trace. */
static struct timeval start; static struct timespec start;
/* Set when failtest_hook returns FAIL_PROBE */ /* Set when failtest_hook returns FAIL_PROBE */
static bool probing = false; static bool probing = false;
/* Table to track duplicates. */ /* Table to track duplicates. */
...@@ -761,7 +761,7 @@ static bool should_fail(struct failtest_call *call) ...@@ -761,7 +761,7 @@ static bool should_fail(struct failtest_call *call)
if (child == 0) { if (child == 0) {
traceindent++; traceindent++;
if (tracef) { if (tracef) {
struct timeval diff; struct timespec diff;
const char *p; const char *p;
char *failpath; char *failpath;
struct failtest_call *c; struct failtest_call *c;
...@@ -776,7 +776,7 @@ static bool should_fail(struct failtest_call *call) ...@@ -776,7 +776,7 @@ static bool should_fail(struct failtest_call *call)
p = c->file; p = c->file;
trace("%u->%u (%u.%02u): %s (%s:%u)\n", trace("%u->%u (%u.%02u): %s (%s:%u)\n",
getppid(), getpid(), getppid(), getpid(),
(int)diff.tv_sec, (int)diff.tv_usec / 10000, (int)diff.tv_sec, (int)diff.tv_nsec / 10000000,
failpath, p, c->line); failpath, p, c->line);
free(failpath); free(failpath);
} }
......
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 \ DEP_OBJS = ccan/grab_file/grab_file.o \
ccan/noerr/noerr.o \ ccan/noerr/noerr.o \
ccan/read_write_all/read_write_all.o \ ccan/read_write_all/read_write_all.o \
......
...@@ -70,7 +70,7 @@ static void run_more(void) ...@@ -70,7 +70,7 @@ static void run_more(void)
signal(SIGALRM, killme); signal(SIGALRM, killme);
itim.it_interval.tv_sec = itim.it_interval.tv_usec = 0; 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); setitimer(ITIMER_REAL, &itim, NULL);
c->status = system(c->command); c->status = system(c->command);
......
...@@ -73,7 +73,7 @@ char *run_with_timeout(const void *ctx, const char *cmd, ...@@ -73,7 +73,7 @@ char *run_with_timeout(const void *ctx, const char *cmd,
int p[2]; int p[2];
char *ret; char *ret;
int status, ms; int status, ms;
struct timeval start; struct timespec start;
*ok = false; *ok = false;
if (pipe(p) != 0) if (pipe(p) != 0)
...@@ -106,7 +106,7 @@ char *run_with_timeout(const void *ctx, const char *cmd, ...@@ -106,7 +106,7 @@ char *run_with_timeout(const void *ctx, const char *cmd,
signal(SIGALRM, killme); signal(SIGALRM, killme);
itim.it_interval.tv_sec = itim.it_interval.tv_usec = 0; 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); setitimer(ITIMER_REAL, &itim, NULL);
status = system(cmd); status = system(cmd);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment