From 759d9d67695783f6d04a85aba383a41c5382548c Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 28 Jan 2012 17:55:08 -0500 Subject: Add simple tests of EvalPlanQual using the isolationtester infrastructure. Much more could be done here, but at least now we have *some* automated test coverage of that mechanism. In particular this tests the writable-CTE case reported by Phil Sorber. In passing, remove isolationtester's arbitrary restriction on the number of steps in a permutation list. I used this so that a single spec file could be used to run several related test scenarios, but there are other possible reasons to want a step series that's not exactly a permutation. Improve documentation and fix a couple other nits as well. --- src/test/isolation/isolationtester.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src/test/isolation/isolationtester.c') diff --git a/src/test/isolation/isolationtester.c b/src/test/isolation/isolationtester.c index ab1ef036045..0e681639ba1 100644 --- a/src/test/isolation/isolationtester.c +++ b/src/test/isolation/isolationtester.c @@ -395,15 +395,9 @@ run_named_permutations(TestSpec * testspec) Permutation *p = testspec->permutations[i]; Step **steps; - if (p->nsteps != nallsteps) - { - fprintf(stderr, "invalid number of steps in permutation %d\n", i + 1); - exit_nicely(); - } - steps = malloc(p->nsteps * sizeof(Step *)); - /* Find all the named steps from the lookup table */ + /* Find all the named steps using the lookup table */ for (j = 0; j < p->nsteps; j++) { Step **this = (Step **) bsearch(p->stepnames[j], allsteps, @@ -418,7 +412,9 @@ run_named_permutations(TestSpec * testspec) steps[j] = *this; } + /* And run them */ run_permutation(testspec, p->nsteps, steps); + free(steps); } } @@ -483,6 +479,8 @@ report_two_error_messages(Step *step1, Step *step2) free(step2->errormsg); step2->errormsg = NULL; } + + free(prefix); } /* @@ -700,7 +698,7 @@ try_complete_step(Step *step, int flags) FD_ZERO(&read_set); - while (flags & STEP_NONBLOCK && PQisBusy(conn)) + while ((flags & STEP_NONBLOCK) && PQisBusy(conn)) { FD_SET(sock, &read_set); timeout.tv_sec = 0; @@ -739,7 +737,8 @@ try_complete_step(Step *step, int flags) } else if (!PQconsumeInput(conn)) /* select(): data available */ { - fprintf(stderr, "PQconsumeInput failed: %s", PQerrorMessage(conn)); + fprintf(stderr, "PQconsumeInput failed: %s\n", + PQerrorMessage(conn)); exit_nicely(); } } -- cgit v1.2.3