Browse Source

failtest: continue (without failing) if we run off end of --failpath=

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...
Rusty Russell 15 years ago
parent
commit
3ad57bc902
1 changed files with 4 additions and 1 deletions
  1. 4 1
      ccan/failtest/failtest.c

+ 4 - 1
ccan/failtest/failtest.c

@@ -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",