forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit7265dbf
committed
Add TAP test to automate the equivalent of check_guc, take two
src/backend/utils/misc/check_guc is a script that cross-checks theconsistency of the GUCs with postgresql.conf.sample, making sure thatits format is in line with what guc.c has. It has never been runautomatically, and has rotten over the years, creating a lot of falsepositives as per a report from Justin Pryzby.d10e41d has introduced a SQL function to publish the most relevant flagsassociated to a GUC, with tests added in the main regression test suiteto make sure that we avoid most of the inconsistencies in the GUCsettings, based on recent reports, but there was nothing able tocross-check postgresql.conf.sample with the contents of guc.c.This commit adds a TAP test that covers the remaining gap. It emulatesthe most relevant checks that check_guc did, so as any format mistakesare detected in postgresql.conf.sample at development stage, with thefollowing checks:- Check that parameters marked as NOT_IN_SAMPLE are not in the samplefile.- Check that there are no dead entries in postgresql.conf.sample forparameters not marked as NOT_IN_SAMPLE.- Check that no parameters are missing from the sample file if listed inguc.c without NOT_IN_SAMPLE.The idea of building a list of the GUCs by parsing the sample file comesfrom Justin, and he wrote the regex used in the patch to find all theGUCs (this same formatting rule basically applies for the last 20~ yearsor so). In order to test this patch, I have played with manualmodifications of postgresql.conf.sample and guc.c, making sure that wedetect problems with the GUC rules and the sample file format.The test is located in src/test/modules/test_misc, which is the bestlocation I could think about for such sanity checks, rather than themain regression test suite (src/test/regress) to avoid a new type ofdependency with the source tree.The first attempt of this patch wasb0a55f4, where the location ofpostgresql.conf.sample was retrieved using pg_config --sharedir. Thishas proven to be an issue for distributions that patch pg_config toenforce the installation paths at some wanted location (like Debian),that may not exist when the test is run, hence causing a failure.Instead of that, as per a suggestion from Andres Freund, rely on thefact that the test is always executed from its directory in the sourcetree and use a relative path to find the sample file. This works forthe CI, VPATH builds and on Windows, and tests like the recovery oneadded inf47ed79 rely on that already.Reviewed-by: Justin PryzbyDiscussion:https://postgr.es/m/Yf9YGSwPiMu0c7fP@paquier.xyz1 parent853c640 commit7265dbf
1 file changed
+110
-0
lines changedLines changed: 110 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + |
0 commit comments
Comments
(0)