From 7722da8b9faeaa728daa21d7ccb3953594755a67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20No=C3=ABl?= Date: Fri, 15 May 2026 13:42:22 -0700 Subject: [PATCH] cargo-pgrx: add --valgrind flag to `cargo pgrx regress` `cargo pgrx start` and `cargo pgrx run` already accept `--valgrind` and the underlying `start_postgres` already knows how to launch Postgres under valgrind, but the flag was not exposed on `cargo pgrx regress`: `From<&Regress> for Run` hardcoded `valgrind: false`, so there was no way to run the regression suite under valgrind without manually starting Postgres first. This adds the flag to `Regress` and propagates it through to `Run`. --- cargo-pgrx/src/command/regress.rs | 4 ++++ cargo-pgrx/src/command/run.rs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cargo-pgrx/src/command/regress.rs b/cargo-pgrx/src/command/regress.rs index 369ca03cd..fc1f1f6f9 100644 --- a/cargo-pgrx/src/command/regress.rs +++ b/cargo-pgrx/src/command/regress.rs @@ -98,6 +98,10 @@ pub(crate) struct Regress { /// Run the test suite this many times (default: 1) #[clap(long, default_value_t = 1, value_name = "N")] pub(crate) repeat: u32, + + /// Run Postgres under valgrind while executing the regression tests + #[clap(long)] + pub(crate) valgrind: bool, } impl Regress { diff --git a/cargo-pgrx/src/command/run.rs b/cargo-pgrx/src/command/run.rs index 014dfb5ef..7e83975d2 100644 --- a/cargo-pgrx/src/command/run.rs +++ b/cargo-pgrx/src/command/run.rs @@ -72,7 +72,7 @@ impl From<&Regress> for Run { verbose: regress.verbose, pgcli: false, install_only: false, - valgrind: false, + valgrind: regress.valgrind, } } }