X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Ffailtest%2Ffailtest.c;fp=ccan%2Ffailtest%2Ffailtest.c;h=be5234f7a90453ac8ec313a287b3dd4594667431;hb=931f1941d3000b38ee1c45a987c219e7e25f125c;hp=ec41e92b46e4cc514bdecb54598686b0a5e9b716;hpb=57cc9494b0daacd23372cdbdefcd31fe9320c836;p=ccan diff --git a/ccan/failtest/failtest.c b/ccan/failtest/failtest.c index ec41e92b..be5234f7 100644 --- a/ccan/failtest/failtest.c +++ b/ccan/failtest/failtest.c @@ -523,7 +523,12 @@ static bool should_fail(struct failtest_call *call) /* Attach debugger if they asked for it. */ if (debugpath) { - char *path = failpath_string(); + char *path; + + /* Pretend this last call matches whatever path wanted: + * keeps valgrind happy. */ + call->fail = cisupper(debugpath[strlen(debugpath)-1]); + path = failpath_string(); if (streq(path, debugpath)) { char str[80]; @@ -534,9 +539,14 @@ static bool should_fail(struct failtest_call *call) getpid(), getpid()); if (system(str) == 0) sleep(5); - } else if (!strstarts(path, debugpath)) { - fprintf(stderr, "--debugpath not followed: %s\n", path); - debugpath = NULL; + } else { + /* Ignore last character: could be upper or lower. */ + path[strlen(path)-1] = '\0'; + if (!strstarts(debugpath, path)) { + fprintf(stderr, + "--debugpath not followed: %s\n", path); + debugpath = NULL; + } } free(path); }