From a622c48d6abbae63288a792d4a2107cbad3f7879 Mon Sep 17 00:00:00 2001 From: Justin Pryzby Date: Sun, 9 Jan 2022 18:25:02 -0600 Subject: [PATCH 02/21] cirrus/vcregress: test modules/contrib with NO_INSTALLCHECK=1 --temp-config must be specified with an "=" because otherwise vcregress runs pg_regress --temp-config test1 test2 [...], ..which means test1 gets eaten as the argument to --temp-config https://www.postgresql.org/message-id/20220109191649.GL14051%40telsasoft.com https://www.postgresql.org/message-id/CA%2BhUKGLneD%2Bq%2BE7upHGwn41KGvbxhsKbJ%2BM-y9nvv7_Xjv8Qog%40mail.gmail.com --- .cirrus.yml | 4 +- contrib/basic_archive/Makefile | 2 +- contrib/pg_stat_statements/Makefile | 2 +- contrib/test_decoding/Makefile | 2 +- src/test/modules/snapshot_too_old/Makefile | 2 +- src/test/modules/worker_spi/Makefile | 2 +- src/tools/msvc/vcregress.pl | 46 +++++++++++++++++++--- 7 files changed, 48 insertions(+), 12 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index bcb8d53db78..2dea2d085cc 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -428,9 +428,9 @@ task: test_isolation_script: | %T_C% perl src/tools/msvc/vcregress.pl isolationcheck test_modules_script: | - %T_C% perl src/tools/msvc/vcregress.pl modulescheck + %T_C% perl src/tools/msvc/vcregress.pl modulescheck install test_contrib_script: | - %T_C% perl src/tools/msvc/vcregress.pl contribcheck + %T_C% perl src/tools/msvc/vcregress.pl contribcheck install stop_script: | tmp_install\bin\pg_ctl.exe stop -D tmp_check/db -l tmp_check/postmaster.log test_ssl_script: | diff --git a/contrib/basic_archive/Makefile b/contrib/basic_archive/Makefile index 14d036e1c42..246358973fe 100644 --- a/contrib/basic_archive/Makefile +++ b/contrib/basic_archive/Makefile @@ -4,7 +4,7 @@ MODULES = basic_archive PGFILEDESC = "basic_archive - basic archive module" REGRESS = basic_archive -REGRESS_OPTS = --temp-config $(top_srcdir)/contrib/basic_archive/basic_archive.conf +REGRESS_OPTS = --temp-config=$(top_srcdir)/contrib/basic_archive/basic_archive.conf NO_INSTALLCHECK = 1 diff --git a/contrib/pg_stat_statements/Makefile b/contrib/pg_stat_statements/Makefile index edc40c8bbfb..8684ea0be9c 100644 --- a/contrib/pg_stat_statements/Makefile +++ b/contrib/pg_stat_statements/Makefile @@ -16,7 +16,7 @@ PGFILEDESC = "pg_stat_statements - execution statistics of SQL statements" LDFLAGS_SL += $(filter -lm, $(LIBS)) -REGRESS_OPTS = --temp-config $(top_srcdir)/contrib/pg_stat_statements/pg_stat_statements.conf +REGRESS_OPTS = --temp-config=$(top_srcdir)/contrib/pg_stat_statements/pg_stat_statements.conf REGRESS = pg_stat_statements oldextversions # Disabled because these tests require "shared_preload_libraries=pg_stat_statements", # which typical installcheck users do not have (e.g. buildfarm clients). diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile index b2209064790..3d7ec65fb53 100644 --- a/contrib/test_decoding/Makefile +++ b/contrib/test_decoding/Makefile @@ -10,7 +10,7 @@ ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \ oldest_xmin snapshot_transfer subxact_without_top concurrent_stream \ twophase_snapshot slot_creation_error -REGRESS_OPTS = --temp-config $(top_srcdir)/contrib/test_decoding/logical.conf +REGRESS_OPTS = --temp-config=$(top_srcdir)/contrib/test_decoding/logical.conf ISOLATION_OPTS = --temp-config $(top_srcdir)/contrib/test_decoding/logical.conf # Disabled because these tests require "wal_level=logical", which diff --git a/src/test/modules/snapshot_too_old/Makefile b/src/test/modules/snapshot_too_old/Makefile index dfb4537f63c..752a0039fdc 100644 --- a/src/test/modules/snapshot_too_old/Makefile +++ b/src/test/modules/snapshot_too_old/Makefile @@ -5,7 +5,7 @@ EXTRA_CLEAN = $(pg_regress_clean_files) ISOLATION = sto_using_cursor sto_using_select sto_using_hash_index -ISOLATION_OPTS = --temp-config $(top_srcdir)/src/test/modules/snapshot_too_old/sto.conf +ISOLATION_OPTS = --temp-config=$(top_srcdir)/src/test/modules/snapshot_too_old/sto.conf # Disabled because these tests require "old_snapshot_threshold" >= 0, which # typical installcheck users do not have (e.g. buildfarm clients). diff --git a/src/test/modules/worker_spi/Makefile b/src/test/modules/worker_spi/Makefile index cbf9b2e37fd..d9f7d9bab6d 100644 --- a/src/test/modules/worker_spi/Makefile +++ b/src/test/modules/worker_spi/Makefile @@ -9,7 +9,7 @@ PGFILEDESC = "worker_spi - background worker example" REGRESS = worker_spi # enable our module in shared_preload_libraries for dynamic bgworkers -REGRESS_OPTS = --temp-config $(top_srcdir)/src/test/modules/worker_spi/dynamic.conf +REGRESS_OPTS = --temp-config=$(top_srcdir)/src/test/modules/worker_spi/dynamic.conf # Disable installcheck to ensure we cover dynamic bgworkers. NO_INSTALLCHECK = 1 diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl index c3729f6be5e..2d6ccd45419 100644 --- a/src/tools/msvc/vcregress.pl +++ b/src/tools/msvc/vcregress.pl @@ -426,6 +426,7 @@ sub plcheck sub subdircheck { my $module = shift; + my $installcheck = shift || 1; if ( !-d "$module/sql" || !-d "$module/expected" @@ -435,7 +436,7 @@ sub subdircheck } chdir $module; - my @tests = fetchTests(); + my @tests = fetchTests($installcheck); # Leave if no tests are listed in the module. if (scalar @tests == 0) @@ -445,12 +446,13 @@ sub subdircheck } my @opts = fetchRegressOpts(); + push @opts, "--temp-instance=tmp_check" if $installcheck == -1; print "============================================================\n"; print "Checking $module\n"; my @args = ( "$topdir/$Config/pg_regress/pg_regress", - "--bindir=${topdir}/${Config}/psql", + "--bindir=$tmp_installdir/bin", "--dbname=contrib_regression", @opts, @tests); print join(' ', @args), "\n"; system(@args); @@ -460,6 +462,8 @@ sub subdircheck sub contribcheck { + my $mode = shift || ''; + chdir "../../../contrib"; my $mstat = 0; foreach my $module (glob("*")) @@ -477,12 +481,25 @@ sub contribcheck my $status = $? >> 8; $mstat ||= $status; } + + # As above, but creates new DB instance for each module. For CI. + if ($mode eq "install") + { + foreach my $module (glob("*")) + { + subdircheck("$module", -1); + $mstat ||= $? >> 8; + } + } + exit $mstat if $mstat; return; } sub modulescheck { + my $mode = shift || ''; + chdir "../../../src/test/modules"; my $mstat = 0; foreach my $module (glob("*")) @@ -491,6 +508,17 @@ sub modulescheck my $status = $? >> 8; $mstat ||= $status; } + + # As above, but creates new DB instance for each module. For CI. + if ($mode eq "install") + { + foreach my $module (glob("*")) + { + subdircheck("$module", -1); + $mstat ||= $? >> 8; + } + } + exit $mstat if $mstat; return; } @@ -558,6 +586,7 @@ sub fetchRegressOpts # option starting with "--". @opts = grep { !/\$\(/ && /^--/ } map { (my $x = $_) =~ s/\Q$(top_builddir)\E/\"$topdir\"/; $x; } + map { (my $x = $_) =~ s/\Q$(top_srcdir)\E/\"$topdir\"/; $x; } split(/\s+/, $1); } if ($m =~ /^\s*ENCODING\s*=\s*(\S+)/m) @@ -583,14 +612,19 @@ sub fetchTests my $m = <$handle>; close($handle); my $t = ""; + my $installcheck = shift || 1; $m =~ s{\\\r?\n}{}g; - # A module specifying NO_INSTALLCHECK does not support installcheck, - # so bypass its run by returning an empty set of tests. if ($m =~ /^\s*NO_INSTALLCHECK\s*=\s*\S+/m) { - return (); + # Skip modules marked installcheck unless running installcheck tests. + return () if $installcheck == 1; + } + else + { + # Skip modules not marked installcheck if running installcheck tests. + return () if $installcheck == -1; } if ($m =~ /^REGRESS\s*=\s*(.*)$/gm) @@ -656,6 +690,8 @@ sub usage "\nOptions for : (used by check and installcheck)\n", " serial serial mode\n", " parallel parallel mode\n", + "\nOptions for : (used by contribcheck and modulescheck)\n", + " install also run tests which require a new instance\n", "\nOption for : for taptest\n", " TEST_DIR (required) directory where tests reside\n"; exit(1); -- 2.17.1