Greetings!
I'd like to add a environment variable to the patch to
disable diff output. Sometimes you have to be creative
with exploratory testing, modifying test files, etc.,
and multiple diff outputs can become a nuisance. This
doesn't change the default behavior, but it does give
you control over diff output in tests for specific
scenarios where a large number of failures are expected
(mass runs or exploratory testing with changing tests).
The env usage and implementation are somewhat similar
to PG_REGRESS_DIFF_OPTS
PG_REGRESS_DISABLE_DIFFS_OUTPUT=1 make check -s.
For now, I suggest to simply disabling it, but I'm also
considering passing the number of lines to output via env
or via flag pg_regress instead of completely disabling it.
Something like
PG_REGRESS_DIFFS_NUMBER_LINES_OUTPUT=20 make check
and then when an error occurs, 20 lines will be output
instead of the default 80. Setting it to 0 disables
diffs output.
I think this small addition will be useful for many
developers, especially testers.
---
This is my first patch. I welcome critique and comments.
Best regards,
Ilya Cherdakov, PostgresPro
From aece3527f29dcaf2731ef99a4d95c792facdf63d Mon Sep 17 00:00:00 2001
From: Ilya Cherdakov <[email protected]>
Date: Mon, 6 Apr 2026 10:18:22 +0300
Subject: [PATCH v1] Adding-env-disables-diff-output
---
src/test/regress/pg_regress.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c
index 9a918156437..06af24699b4 100644
--- a/src/test/regress/pg_regress.c
+++ b/src/test/regress/pg_regress.c
@@ -1550,6 +1550,13 @@ results_differ(const char *testname, const char
*resultsfile, const char *defaul
pretty_diff_opts, best_expect_file,
resultsfile, difffilename);
run_diff(cmd, difffilename);
+ /* Disabling difffile output via an environment variable */
+ if (getenv("PG_REGRESS_DISABLE_DIFFS_OUTPUT") != NULL)
+ {
+ unlink(diff);
+ return true;
+ }
+
/*
* Reopen the file for reading to emit the diff as TAP
diagnostics. We
* can't keep the file open while diff appends to it, because on
--
2.47.3