diff --git a/HISTORY.asc b/HISTORY.asc index da32ce4..57aa422 100644 --- a/HISTORY.asc +++ b/HISTORY.asc @@ -1,5 +1,28 @@ STABLE ------ +== Fix `make results` refusing to create a new test's first expected output +`verify-results` blocked `make results` whenever `regression.diffs` existed +at all, which made seeding the first `test/expected/.out` for a +brand-new test impossible: pgxntool creates an empty placeholder for a test +that has no expected file (pg_regress aborts outright on a missing one), so +pg_regress always reports a difference against it no matter how clean the +new test's actual output is. + +`verify-results` now reads what `regression.diffs` actually says. A test +that differs only from that empty placeholder is allowed through, provided +its own pgtap output is clean and contains no SQL error; a test that differs +from a real expected file still blocks `make results` as before. This +applies to the default `PGXNTOOL_VERIFY_RESULTS_MODE=pgtap`; +`PGXNTOOL_VERIFY_RESULTS_MODE=diffs` still blocks on any `regression.diffs`. + +An empty `regression.diffs` is now its own, separately reported refusal: +pg_regress writes one at startup and removes it again when it finishes with +nothing to report, so an empty one left behind means it died before +comparing anything (unreachable server, interrupt) and `test/results/` still +holds an earlier run's output. `make results` previously blocked that case +only as a side effect of blocking on the file's existence, and says so +explicitly now. + == Add `PGXNTOOL_ENABLE_FS_INSTALL` and `PGXNTOOL_ENABLE_PGXN_INSTALL` `test`/`verify-results` unconditionally filesystem-installed the extension (via PGXS's `install`), and `installcheck` unconditionally auto-installed @@ -43,7 +66,7 @@ None of these are documented anywhere as override points, but if you happened to reference one directly (unsupported, but possible), update to the new name. -Issues fixed in this release: #87, #21, #55, #90 +Issues fixed in this release: #87, #21, #55, #90, #119 2.3.0 ----- diff --git a/README.asc b/README.asc index bf48c80..55f0609 100644 --- a/README.asc +++ b/README.asc @@ -237,11 +237,13 @@ Never run `make results` without first verifying the test changes are correct. T ==== verify-results safeguard By default, `make results` will refuse to run if your tests are failing, so you can't accidentally promote incorrect output into the new expected results. Which failures it looks for is controlled by `PGXNTOOL_VERIFY_RESULTS_MODE`: -`pgtap` (the default):: Scans `test/results/*.out` for pgTAP `not ok` lines (ignoring `# TODO` items) and plan-count mismatches, then also checks `test/results/regression.diffs` for any output mismatch pgTAP itself wouldn't catch. -`diffs`:: Only checks whether `test/results/regression.diffs` exists. +`pgtap` (the default):: Scans `test/results/*.out` for pgTAP `not ok` lines (ignoring `# TODO` items) and plan-count mismatches, then also checks `test/regression.diffs` for any output mismatch pgTAP itself wouldn't catch. A test that has no expected output file yet is the one exception: it always shows up in `regression.diffs` (pgxntool creates an empty expected file for it, because `pg_regress` aborts on a missing one), so `make results` is allowed to create its first expected output — provided its own pgTAP output is clean and free of SQL errors. If a new test legitimately needs output containing a SQL error blessed, use `PGXNTOOL_ENABLE_VERIFY_RESULTS=no` for that one run. +`diffs`:: Only checks whether `test/regression.diffs` exists, so it can't create a new test's first expected output; use `pgtap` mode, or `PGXNTOOL_ENABLE_VERIFY_RESULTS=no` for that one run. If tests are failing, `make results` prints an explanation of what failed and exits without touching `test/expected/`; fix the failures, then re-run `make results`. +It also refuses when `pg_regress` didn't finish at all — an unreachable server, an interrupt — since `test/results/` then still holds an earlier run's output and blessing it would make that stale output the new expected results. + To select a mode explicitly: ---- # In your Makefile @@ -729,7 +731,7 @@ Default: `pgtap`. Controls how the <<_verify_results_safeguard,verify-results sa ==== pgtap -Scans `test/results/*.out` for pgTap `not ok` lines and plan mismatches, falling back to checking for `regression.diffs` too. Use this mode when your test suite uses pgTap. +Scans `test/results/*.out` for pgTap `not ok` lines and plan mismatches, falling back to checking `regression.diffs` too — except for a test that has no expected output yet, whose first expected file `make results` is allowed to create. Use this mode when your test suite uses pgTap. ==== diffs diff --git a/README.html b/README.html index c3428cd..86e45d9 100644 --- a/README.html +++ b/README.html @@ -1000,11 +1000,11 @@

pgtap (the default)
-

Scans test/results/*.out for pgTAP not ok lines (ignoring # TODO items) and plan-count mismatches, then also checks test/results/regression.diffs for any output mismatch pgTAP itself wouldn’t catch.

+

Scans test/results/*.out for pgTAP not ok lines (ignoring # TODO items) and plan-count mismatches, then also checks test/regression.diffs for any output mismatch pgTAP itself wouldn’t catch. A test that has no expected output file yet is the one exception: it always shows up in regression.diffs (pgxntool creates an empty expected file for it, because pg_regress aborts on a missing one), so make results is allowed to create its first expected output — provided its own pgTAP output is clean and free of SQL errors. If a new test legitimately needs output containing a SQL error blessed, use PGXNTOOL_ENABLE_VERIFY_RESULTS=no for that one run.

diffs
-

Only checks whether test/results/regression.diffs exists.

+

Only checks whether test/regression.diffs exists, so it can’t create a new test’s first expected output; use pgtap mode, or PGXNTOOL_ENABLE_VERIFY_RESULTS=no for that one run.

@@ -1012,6 +1012,9 @@

+

It also refuses when pg_regress didn’t finish at all — an unreachable server, an interrupt — since test/results/ then still holds an earlier run’s output and blessing it would make that stale output the new expected results.

+ +

To select a mode explicitly:

@@ -1980,7 +1983,7 @@

8.8.1. pgtap

-

Scans test/results/*.out for pgTap not ok lines and plan mismatches, falling back to checking for regression.diffs too. Use this mode when your test suite uses pgTap.

+

Scans test/results/*.out for pgTap not ok lines and plan mismatches, falling back to checking regression.diffs too — except for a test that has no expected output yet, whose first expected file make results is allowed to create. Use this mode when your test suite uses pgTap.

@@ -2068,7 +2071,7 @@