Running a single test
Hello hackers
Apologies if this is a n00b question - but really can’t find anything about it in the docs.
I can run all the regression tests with `make test`. But is there a way to run a single specific test?
It’d be nice to do this for example when adding extra assertions to a test, without touching the code.
/Viktor Holmberg
Import Notes
Reference msg id not found: 41c22521-e4d3-4871-8dbe-c91e54b86123@Spark
On 17/11/2025 12:26, Viktor Holmberg wrote:
Hello hackers
Apologies if this is a n00b question - but really can’t find anything
about it in the docs.
I can run all the regression tests with `make test`. But is there a way
to run a single specific test?
It’d be nice to do this for example when adding extra assertions to a
test, without touching the code.
The main test suite that 'make check' runs is quick enough that usually
I just run them all. But sometimes if I want to iterate quickly on a
single test, I modify "parallel_schedule", commenting out all the other
tests, and then use "make check". You could also call the pg_regress
program directly and pass the name of the test as an argument, but I
find it easier to just modify parallel_schedule.
"make check-world" takes a little longer. If you want to run just one of
the test suites that that executes, you can run "make check" in the
right subdirectory. For example, "(cd src/bin/pg_config; make check)"
See also the corresponding instructions for meson builds at
https://wiki.postgresql.org/wiki/Meson#Test_related_commands. Meson is
much better at running the "world" test suites in parallel, and faster
to compile anyway, so I highly recommend switching to meson.
- Heikki
Hi Victor,
Apologies if this is a n00b question - but really can’t find anything about it in the docs.
I can run all the regression tests with `make test`. But is there a way to run a single specific test?
It’d be nice to do this for example when adding extra assertions to a test, without touching the code.
I would recommend using Meson. It's much faster and Autotools support
will be removed in the future.
I have a little cheat sheet on the subject [1]https://eax.me/2022/2022-12-19-postgresql-meson.html. It's in Russian but
Google Translate will help. For instance you can do:
```
meson test -C build --suite postgresql:test_slru 'test_slru/regress'
```
If you believe there is room for improvement in the official
documentation, patches are welcome.
[1]: https://eax.me/2022/2022-12-19-postgresql-meson.html
--
Best regards,
Aleksander Alekseev
On Mon, Nov 17, 2025 at 6:27 PM Viktor Holmberg <v@viktorh.net> wrote:
Hello hackers
Apologies if this is a n00b question - but really can’t find anything about it in the docs.
I can run all the regression tests with `make test`. But is there a way to run a single specific test?
It’d be nice to do this for example when adding extra assertions to a test, without touching the code.
hi.
run test_setup.sql, boolean.sql, char.sql tests only
you can use
make check-tests TESTS="test_setup boolean char"
this is not documented, see
/messages/by-id/CA+renyXB5jYG9r5-CaDc4g607EB398QwTk_efEXTzarrO8bPzw@mail.gmail.com
meson,
there is patch available:
https://commitfest.postgresql.org/patch/5405/
after apply the patch, you can use
meson test -C $your_build_dir --suite setup --verbose
TESTS='test_setup boolean char' meson test -C $your_build_dir --suite
regress --verbose
Thank you both. I was not aware of meson at all, I had some idea that it was something used exclusively by the CI server.
FWIW, that doc patch would have helped me!
/Viktor
On 18 Nov 2025, at 09:55, Viktor Holmberg <v@viktorh.net> wrote:
FWIW, that doc patch would have helped me!
Maybe we should resurrect it then, I tweaked it a fraction to better match the
language in that section.
--
Daniel Gustafsson
Attachments:
test_subset.diffapplication/octet-stream; name=test_subset.diff; x-unix-mode=0644Download
diff --git a/doc/src/sgml/regress.sgml b/doc/src/sgml/regress.sgml
index 8838fe7f022..c05cd2f96f5 100644
--- a/doc/src/sgml/regress.sgml
+++ b/doc/src/sgml/regress.sgml
@@ -125,6 +125,18 @@ make installcheck-parallel
</para>
</sect2>
+ <sect2 id="regress-subset">
+ <title>Running Specific Tests</title>
+
+ <para>
+ A subset of the regression tests can be run with the command
+ <literal>make check-tests TESTS="boolean char"</literal> or
+ <literal>make installcheck-tests TESTS="boolean char"</literal>.
+ Note that sometimes tests have dependencies on objects created by other
+ tests, which can cause unexpected failures.
+ </para>
+ </sect2>
+
<sect2 id="regress-additional">
<title>Additional Test Suites</title>
On 18 Nov 2025 at 10:11 +0100, Daniel Gustafsson <daniel@yesql.se>, wrote:
On 18 Nov 2025, at 09:55, Viktor Holmberg <v@viktorh.net> wrote:
FWIW, that doc patch would have helped me!Maybe we should resurrect it then, I tweaked it a fraction to better match the
language in that section.--
Daniel Gustafsson
Looks good!
Hi,
On Tue, 18 Nov 2025 at 12:11, Daniel Gustafsson <daniel@yesql.se> wrote:
On 18 Nov 2025, at 09:55, Viktor Holmberg <v@viktorh.net> wrote:
FWIW, that doc patch would have helped me!
Postgres wiki page [1]https://wiki.postgresql.org/wiki/Meson#Test_related_commands has nice information too.
Maybe we should resurrect it then, I tweaked it a fraction to better match the
language in that section.
+1 for this change. Patch LGTM.
[1]: https://wiki.postgresql.org/wiki/Meson#Test_related_commands
--
Regards,
Nazir Bilal Yavuz
Microsoft
On 2025-11-17 Mo 6:57 AM, jian he wrote:
On Mon, Nov 17, 2025 at 6:27 PM Viktor Holmberg <v@viktorh.net> wrote:
Hello hackers
Apologies if this is a n00b question - but really can’t find anything about it in the docs.
I can run all the regression tests with `make test`. But is there a way to run a single specific test?
It’d be nice to do this for example when adding extra assertions to a test, without touching the code.hi.
run test_setup.sql, boolean.sql, char.sql tests only
you can usemake check-tests TESTS="test_setup boolean char"
this is not documented, see
/messages/by-id/CA+renyXB5jYG9r5-CaDc4g607EB398QwTk_efEXTzarrO8bPzw@mail.gmail.commeson,
there is patch available:
https://commitfest.postgresql.org/patch/5405/after apply the patch, you can use
meson test -C $your_build_dir --suite setup --verbose
TESTS='test_setup boolean char' meson test -C $your_build_dir --suite
regress --verbose
I'm off for a couple of days, but intending to commit this later this
week unless someone beats me to it.
cheers
andrew
--
Andrew Dunstan
EDB: https://www.enterprisedb.com