Обсуждение: 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.
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
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]. 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 https://postgr.es/m/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!
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
Вложения
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] 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