X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ffailtest%2Ftest%2Frun-history.c;h=88068b55eacdcec025fc6b21a1a9aa12fbfb343e;hp=ef28a3f5a09329db0722bffbc55a0f549f3fed20;hb=36d54ff66bdfdc316f666a98c69d2a27e2975fa2;hpb=e8f0484b7808efe03dbb573563b336d533487e29 diff --git a/ccan/failtest/test/run-history.c b/ccan/failtest/test/run-history.c index ef28a3f5..88068b55 100644 --- a/ccan/failtest/test/run-history.c +++ b/ccan/failtest/test/run-history.c @@ -54,8 +54,8 @@ int main(void) ok1(call->u.realloc.ptr == realloc_call.ptr); ok1(call->u.realloc.size == realloc_call.size); - open_call.ret = open("test/run_history.c", O_RDONLY); - open_call.pathname = "test/run_history.c"; + open_call.ret = open("test/run-history.c", O_RDONLY); + open_call.pathname = "test/run-history.c"; open_call.flags = O_RDONLY; open_call.mode = 0; call = add_history(FAILTEST_OPEN, "run-history.c", 4, &open_call); @@ -102,20 +102,24 @@ int main(void) ok1(call->u.write.fd == write_call.fd); ok1(call->u.write.count == write_call.count); - ok1(history_num == 7); + i = 0; + tlist_for_each(&history, call, list) + i++; - for (i = 0; i < history_num; i++) - history[i].fail = false; + ok1(i == 7); + + tlist_for_each(&history, call, list) + call->fail = false; path = failpath_string(); - ok1(strcmp(path, "cmeoprw") == 0); + ok1(streq(path, "cmeoprw")); free(path); - for (i = 0; i < history_num; i++) - history[i].fail = true; + tlist_for_each(&history, call, list) + call->fail = true; path = failpath_string(); - ok1(strcmp(path, "CMEOPRW") == 0); + ok1(streq(path, "CMEOPRW")); free(path); return exit_status();