summaryrefslogtreecommitdiff
path: root/src/test/isolation/isolationtester.c
diff options
context:
space:
mode:
authorMichael Paquier2019-08-24 02:45:05 +0000
committerMichael Paquier2019-08-24 02:45:05 +0000
commit989d23b04beac0c26f44c379b04ac781eaa4265e (patch)
tree73adaa8e3a9c4a9a5b0f744c6f1e29e7cc4d73c1 /src/test/isolation/isolationtester.c
parent9903338b5ea59093d77cfe50ec0b1c22d4a7d843 (diff)
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. Author: Michael Paquier Reviewed-by: Asim Praveen, Melanie Plageman Discussion: https://postgr.es/m/[email protected]
Diffstat (limited to 'src/test/isolation/isolationtester.c')
-rw-r--r--src/test/isolation/isolationtester.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/test/isolation/isolationtester.c b/src/test/isolation/isolationtester.c
index 66ebe3b27e9..556b46d93f4 100644
--- a/src/test/isolation/isolationtester.c
+++ b/src/test/isolation/isolationtester.c
@@ -81,7 +81,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;
}
}
@@ -235,10 +235,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);
+ }
}
/*
@@ -438,7 +451,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 */