diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-14 19:15:04 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-14 19:15:04 +0000 |
commit | acfe2110be5f07ddfdbae94262d8726d3dd71cc9 (patch) | |
tree | 132a3bd6d1ea91b56690f48b6b09a38ee286289e | |
parent | Adding upstream version 259. (diff) | |
download | postgresql-common-acfe2110be5f07ddfdbae94262d8726d3dd71cc9.tar.xz postgresql-common-acfe2110be5f07ddfdbae94262d8726d3dd71cc9.zip |
Adding upstream version 260.upstream/260
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
-rw-r--r-- | t/001_packages.t | 8 | ||||
-rw-r--r-- | t/020_create_sql_remove.t | 13 | ||||
-rw-r--r-- | t/027_jit.t | 44 | ||||
-rwxr-xr-x | testsuite | 14 |
4 files changed, 66 insertions, 13 deletions
diff --git a/t/001_packages.t b/t/001_packages.t index 697e871..e205321 100644 --- a/t/001_packages.t +++ b/t/001_packages.t @@ -45,10 +45,12 @@ foreach my $v (@MAJORS) { skip "No python2 support", 1 unless ($v <= 11 and $PgCommon::have_python2); ok ((deb_installed "postgresql-plpython-$v$f"), "postgresql-plpython-$v$f installed"); } - if ($v >= '9.1') { + SKIP: { + skip "no Python 3 package for version $v", 1 if ($v < '9.1'); + my $pyver = `python3 --version 2>/dev/null`; + chomp $pyver; + skip "$pyver is too new for PL/Python3 on $v", 1 if ($v < 10 and $pyver and $pyver =~ /3\.1[2-9]/); # distutils removed in Python 3.12 ok ((deb_installed "postgresql-plpython3-$v$f"), "postgresql-plpython3-$v$f installed"); - } else { - pass "no Python 3 package for version $v"; } ok ((deb_installed "postgresql-plperl-$v$f"), "postgresql-plperl-$v$f installed"); ok ((deb_installed "postgresql-pltcl-$v$f"), "postgresql-pltcl-$v$f installed"); diff --git a/t/020_create_sql_remove.t b/t/020_create_sql_remove.t index d208b99..aa2bcaa 100644 --- a/t/020_create_sql_remove.t +++ b/t/020_create_sql_remove.t @@ -292,19 +292,16 @@ tel|2 } # Check PL/Python3 (untrusted) - if ($v >= '9.1') { + SKIP: { + skip "Skipping PL/Python3 test for version $v...", 6 if ($v < 9.1); + my $pyver = `python3 --version 2>/dev/null`; + chomp $pyver; + skip "$pyver is too new for PL/Python3 on $v...", 6 if ($v < 10 and $pyver and $pyver =~ /3\.1[1-9]/); # distutils removed in Python 3.12 is_program_out 'postgres', create_extension($v, 'plpython3u'), 0, '', 'CREATE EXTENSION plpython3u succeeds for user postgres'; is_program_out 'postgres', 'psql nobodydb -qc "CREATE FUNCTION capitalize3(text) RETURNS text AS \'import sys; return args[0].capitalize() + sys.version[0]\' LANGUAGE plpython3u;"', 0, '', 'creating PL/Python3 function as user postgres succeeds'; is_program_out 'nobody', 'psql nobodydb -Atc "select capitalize3(\'foo\')"', 0, "Foo3\n", 'calling PL/Python function'; - } else { - pass "Skipping PL/Python3 test for version $v..."; - pass '...'; - pass '...'; - pass '...'; - pass '...'; - pass '...'; } # Check PL/Tcl (trusted/untrusted) diff --git a/t/027_jit.t b/t/027_jit.t new file mode 100644 index 0000000..4ed5ddb --- /dev/null +++ b/t/027_jit.t @@ -0,0 +1,44 @@ +use strict; + +use lib 't'; +use TestLib; + +use Test::More; + +my $arch = `dpkg --print-architecture`; +chomp $arch; +if (grep { $_ eq $arch} qw(alpha hppa hurd-i386 ia64 kfreebsd-amd64 kfreebsd-i386 loong64 m68k powerpc riscv64 sh4 sparc64 x32)) { + ok 1, "No JIT tests on $arch"; + done_testing(); + exit; +} + +foreach my $v (@MAJORS) { + if ($v < 11) { + ok 1, "No JIT support on $v"; + next; + } + note "$v"; + + program_ok 'root', "pg_createcluster $v main --start", 0; + + my $jit_default = $v == '11' ? 'off' : 'on'; + like_program_out 'postgres', "psql -Xatc 'show jit'", 0, qr/$jit_default/, "JIT is $jit_default by default"; + program_ok 'root', "pg_conftool $v main set jit on", 0, "Turn on JIT on PG11" if ($v == 11); + program_ok 'root', "pg_ctlcluster $v main reload", 0 if ($v == 11); + + unlike_program_out 'postgres', "psql -c 'explain (analyze) select count(*) from pg_class'", 0, qr/JIT/, + "No JIT on cheap query"; + program_ok 'root', "pg_conftool $v main set seq_page_cost 100000", 0; + program_ok 'root', "pg_conftool $v main set random_page_cost 100000", 0; + program_ok 'root', "pg_ctlcluster $v main reload", 0; + like_program_out 'postgres', "psql -c 'explain (analyze) select count(*) from pg_class'", 0, qr/Timing: Generation .* ms/, + "Expensive query is JITed"; + + program_ok 'root', "pg_dropcluster --stop $v main", 0; + check_clean; +} + +done_testing(); + +# vim: filetype=perl @@ -3,7 +3,7 @@ # Run integration tests (on the installed packages). # # (C) 2005-2012 Martin Pitt <mpitt@debian.org> -# (C) 2012-2023 Christoph Berg <myon@debian.org> +# (C) 2012-2024 Christoph Berg <myon@debian.org> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -70,11 +70,21 @@ if [ "${INSTALL:-}" ] && [ -z "${UNSHARED:-}" ]; then [ "$(perl -I. -le 'use PgCommon; print $PgCommon::have_python2')" = "1" ] && PYTHON2_PACKAGE=postgresql-plpython-$v${PG_FLAVOR:=} ;; esac + case $v in + 8.*|9.0) ;; + 9.[1-6]) # plpython3 only for Python < 3.12 + py3ver=$(apt-cache policy python3) + case $py3ver in + *3.[0-9].*|*3.1[01].*) PYTHON3_PACKAGE=postgresql-plpython3-$v${PG_FLAVOR:-} ;; + esac + ;; + *) PYTHON3_PACKAGE=postgresql-plpython3-$v${PG_FLAVOR:-} ;; + esac apt-get install -y \ postgresql-contrib-$v${PG_FLAVOR:=} \ postgresql-plperl-$v$PG_FLAVOR \ ${PYTHON2_PACKAGE:-} \ - $(dpkg --compare-versions $v ge 9.1 && echo postgresql-plpython3-$v$PG_FLAVOR) \ + ${PYTHON3_PACKAGE:-} \ postgresql-pltcl-$v$PG_FLAVOR \ postgresql-server-dev-$v$PG_FLAVOR \ postgresql-doc-$v$PG_FLAVOR |