1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-04 20:11:56 +03:00

Detect unused steps in isolation specs and do some cleanup

This is useful for developers to find out if an isolation spec is
over-engineered or if it needs more work by warning at the end of a
test run if a step is not used, generating a failure with extra diffs.

While on it, clean up all the specs which include steps not used in any
permutations to simplify them.

This is a backpatch of 989d23b and 06fdc4e, as it is becoming useful to
make all the branches consistent for an upcoming patch that will improve
the output generated by isolationtester.

Author: Michael Paquier
Reviewed-by: Asim Praveen, Melanie Plageman
Discussion: https://postgr.es/m/20190819080820.GG18166@paquier.xyz
Discussion: https://postgr.es/m/794820.1623872009@sss.pgh.pa.us
Backpatch-through: 9.6
This commit is contained in:
Michael Paquier
2021-06-17 11:57:21 +09:00
parent a8f687927e
commit 96f3661e45
13 changed files with 40 additions and 41 deletions

View File

@@ -86,7 +86,7 @@ main(int argc, char **argv)
puts("isolationtester (PostgreSQL) " PG_VERSION);
exit(0);
default:
fprintf(stderr, "Usage: isolationtester [-n] [CONNINFO]\n");
fprintf(stderr, "Usage: isolationtester [CONNINFO]\n");
return EXIT_FAILURE;
}
}
@@ -248,10 +248,23 @@ static int *piles;
static void
run_testspec(TestSpec *testspec)
{
int i;
if (testspec->permutations)
run_named_permutations(testspec);
else
run_all_permutations(testspec);
/*
* Verify that all steps have been used, complaining about anything
* defined but not used.
*/
for (i = 0; i < testspec->nallsteps; i++)
{
if (!testspec->allsteps[i]->used)
fprintf(stderr, "unused step name: %s\n",
testspec->allsteps[i]->name);
}
}
/*
@@ -451,7 +464,11 @@ run_permutation(TestSpec *testspec, int nsteps, Step **steps)
printf("\nstarting permutation:");
for (i = 0; i < nsteps; i++)
{
/* Track the permutation as in-use */
steps[i]->used = true;
printf(" %s", steps[i]->name);
}
printf("\n");
/* Perform setup */