public inbox for [email protected]
help / color / mirror / Atom feedFrom: Илья Чердаков <[email protected]>
To: pgsql-hackers <[email protected]>
Cc: [email protected]
Subject: Environment variable to disable diffs file output
Date: Mon, 6 Apr 2026 14:55:25 +0700
Message-ID: <[email protected]> (raw)
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
Attachments:
[text/plain] v1-0001-Adding-env-disables-diff-output.patch (1013B, 2-v1-0001-Adding-env-disables-diff-output.patch)
download | inline diff:
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
view thread (4+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: Environment variable to disable diffs file output
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox