From e5c2c23a64ac52e01a8c9d379da689c5a3462e47 Mon Sep 17 00:00:00 2001
From: Henson Choi <assam258@gmail.com>
Date: Wed, 10 Jun 2026 10:52:07 +0900
Subject: [PATCH v2 1/3] Add jit regression test to exercise the LLVM JIT path

The default is jit = off, so the regular regression suite no longer
exercises the LLVM JIT.  Add a small test that turns jit on and sets
jit_above_cost to zero, so that even a trivial query enables JIT and
initializes the JIT provider.  On a working installation it returns the
expected result.

Author: Henson Choi <assam258@gmail.com>
---
 src/test/regress/expected/jit.out  | 19 +++++++++++++++++++
 src/test/regress/parallel_schedule |  5 +++++
 src/test/regress/sql/jit.sql       | 14 ++++++++++++++
 3 files changed, 38 insertions(+)
 create mode 100644 src/test/regress/expected/jit.out
 create mode 100644 src/test/regress/sql/jit.sql

diff --git a/src/test/regress/expected/jit.out b/src/test/regress/expected/jit.out
new file mode 100644
index 00000000000..2c0a0cdc366
--- /dev/null
+++ b/src/test/regress/expected/jit.out
@@ -0,0 +1,19 @@
+--
+-- JIT
+--
+-- Exercise the LLVM JIT provider.  The default is jit = off, so the regular
+-- regression suite no longer initializes the JIT.  Turn jit on and set
+-- jit_above_cost to zero so that even a trivial query enables JIT and forces
+-- the JIT provider to initialize.  On a working installation this simply
+-- returns the result below.
+--
+SET jit = on;
+SET jit_above_cost = 0;
+SELECT 1 AS result;
+ result 
+--------
+      1
+(1 row)
+
+RESET jit_above_cost;
+RESET jit;
diff --git a/src/test/regress/parallel_schedule b/src/test/regress/parallel_schedule
index 8fa0a6c47fb..18b061282d8 100644
--- a/src/test/regress/parallel_schedule
+++ b/src/test/regress/parallel_schedule
@@ -143,6 +143,11 @@ test: event_trigger_login
 # this test also uses event triggers, so likewise run it by itself
 test: fast_default
 
+# jit forces the JIT code generator (jit on, cost thresholds 0).  The default
+# is jit = off, so the rest of the suite no longer exercises it.  Run it by
+# itself so that a JIT failure does not take down any concurrent tests.
+test: jit
+
 # run tablespace test at the end because it drops the tablespace created during
 # setup that other tests may use.
 test: tablespace
diff --git a/src/test/regress/sql/jit.sql b/src/test/regress/sql/jit.sql
new file mode 100644
index 00000000000..b16d0255543
--- /dev/null
+++ b/src/test/regress/sql/jit.sql
@@ -0,0 +1,14 @@
+--
+-- JIT
+--
+-- Exercise the LLVM JIT provider.  The default is jit = off, so the regular
+-- regression suite no longer initializes the JIT.  Turn jit on and set
+-- jit_above_cost to zero so that even a trivial query enables JIT and forces
+-- the JIT provider to initialize.  On a working installation this simply
+-- returns the result below.
+--
+SET jit = on;
+SET jit_above_cost = 0;
+SELECT 1 AS result;
+RESET jit_above_cost;
+RESET jit;
-- 
2.47.3

