> On 30 Mar 2023, at 22:29, Tom Lane <t...@sss.pgh.pa.us> wrote: > Well, we could do "select rolname from pg_roles order by 1" and > actually compare the results of the two selects. That might be > advisable anyway, in order to produce a complaint with useful > detail when there is something wrong.
I took a look at this and came up with the attached. This adds a new parameter to pg_regress for specifying a test which will be executed before and after the suite, where the first invocation creates the expectfile for the second. For storing the expecfile the temp dir creation is somewhat refactored. I've added a sample test in the patch (to regress, not ECPG), but I'm sure it can be expanded to be a bit more interesting. The comment which is now incorrectly formatted was left like that to make review easier, if this gets committed it will be fixed then. I opted for this to use the machinery that pg_regress already has rather than add a new mechanism (and dependency) for running and verifying queries. This also avoids hardcoding the test making it easier to have custom queries during hacking etc. Looking at this I also found a bug introduced in the TAP format patch, which made failed single run tests report as 0ms due to the parameters being mixed up in the report function call. This is in 0002, which I'll apply to HEAD regardless of 0001 as they are unrelated. -- Daniel Gustafsson
v1-0002-pg_regress-Fix-reported-runtime-for-failed-single.patch
Description: Binary data
v1-0001-pg_regress-Add-database-verification-test.patch
Description: Binary data