]> git.ozlabs.org Git - ccan/commitdiff
failtest: allow continuing after running a failpath.
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 15 Feb 2011 12:49:00 +0000 (23:19 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 15 Feb 2011 12:49:00 +0000 (23:19 +1030)
Append a "+" if you want to start forking as normal.

ccan/failtest/failtest.c

index 598a9e7930e933873ffbd9d02a3578d12d752472..4f71a63dc172896928cde965277b145093c13869 100644 (file)
@@ -280,11 +280,16 @@ static bool should_fail(struct failtest_call *call)
                return false;
 
        if (failpath) {
                return false;
 
        if (failpath) {
-               if (tolower(*failpath) != info_to_arg[call->type])
-                       errx(1, "Failpath expected '%c' got '%c'\n",
-                            info_to_arg[call->type], *failpath);
-               call->fail = isupper(*(failpath++));
-               return call->fail;
+               /* + means continue after end, like normal. */
+               if (*failpath == '+')
+                       failpath = NULL;
+               else {
+                       if (tolower(*failpath) != info_to_arg[call->type])
+                               errx(1, "Failpath expected '%c' got '%c'\n",
+                                    info_to_arg[call->type], *failpath);
+                       call->fail = isupper(*(failpath++));
+                       return call->fail;
+               }
        }
 
        if (!failtest_hook(history, history_num)) {
        }
 
        if (!failtest_hook(history, history_num)) {