]> git.ozlabs.org Git - ccan/commitdiff
failtest: continue (without failing) if we run off end of --failpath=
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 28 Mar 2011 03:58:22 +0000 (14:28 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 28 Mar 2011 03:58:22 +0000 (14:28 +1030)
This is important because we tell people to use --failpath to reproduce a
failure, but the fail path we list only goes up to the last failure injection
if the child dies, for example.

Thanks to David Gibson for prodding me to fix this...

ccan/failtest/failtest.c

index 7a6f5220e60cd5ed7d1035922b267751c999a84e..b25b049edac1d162c663ae58218c75dc3815e0dd 100644 (file)
@@ -364,7 +364,10 @@ static bool should_fail(struct failtest_call *call)
                /* + means continue after end, like normal. */
                if (*failpath == '+')
                        failpath = NULL;
-               else {
+               else if (*failpath == '\0') {
+                       /* Continue, but don't inject errors. */
+                       return call->fail = false;
+               } else {
                        if (tolower((unsigned char)*failpath)
                            != info_to_arg[call->type])
                                errx(1, "Failpath expected '%c' got '%c'\n",