From 69b5d6c362c98054b703172e5bdaf9de1446dd41 Mon Sep 17 00:00:00 2001 From: Henson Choi Date: Mon, 26 Oct 2026 10:56:44 +0900 Subject: [PATCH v4 1/4] Add a regression test that runs a query through the LLVM JIT jit is off by default, so no regression test compiles a query with the LLVM JIT, and a build on which JIT compilation is broken passes them all. On the AddressSanitizer build in CI, for example, every JIT-compiled query crashes or hangs the backend while the JIT generates code for it: on Linux the backend dies of SIGILL, and on macOS it was seen to loop forever inside LLVM. The regression tests do not show it. Add a small test that turns jit on and sets jit_above_cost to zero, so that even SELECT 1 is JIT-compiled. On an AddressSanitizer build, it crashes or hangs the backend until the following two commits. --- src/test/regress/expected/jit.out | 17 +++++++++++++++++ src/test/regress/parallel_schedule | 3 +++ src/test/regress/sql/jit.sql | 12 ++++++++++++ 3 files changed, 32 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..20ce603471c --- /dev/null +++ b/src/test/regress/expected/jit.out @@ -0,0 +1,17 @@ +-- +-- JIT +-- +-- Run a query through the LLVM JIT. jit is off by default, so turn it on +-- and set jit_above_cost to zero, which makes even a trivial query be +-- JIT-compiled. +-- +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 75063f87a4a..6e2ca186363 100644 --- a/src/test/regress/parallel_schedule +++ b/src/test/regress/parallel_schedule @@ -143,6 +143,9 @@ test: event_trigger_login # this test also uses event triggers, so likewise run it by itself test: fast_default +# jit compiles its queries with the LLVM JIT (jit = on, jit_above_cost = 0) +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..e79466d64a5 --- /dev/null +++ b/src/test/regress/sql/jit.sql @@ -0,0 +1,12 @@ +-- +-- JIT +-- +-- Run a query through the LLVM JIT. jit is off by default, so turn it on +-- and set jit_above_cost to zero, which makes even a trivial query be +-- JIT-compiled. +-- +SET jit = on; +SET jit_above_cost = 0; +SELECT 1 AS result; +RESET jit_above_cost; +RESET jit; -- 2.54.0 (Apple Git-157)