Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nNPET-0007cw-JF for pgsql-hackers@arkaria.postgresql.org; Fri, 25 Feb 2022 01:17:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nNPES-00031w-Bj for pgsql-hackers@arkaria.postgresql.org; Fri, 25 Feb 2022 01:17:16 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nNPER-00031j-UQ for pgsql-hackers@lists.postgresql.org; Fri, 25 Feb 2022 01:17:16 +0000 Received: from mail-io1-xd34.google.com ([2607:f8b0:4864:20::d34]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nNPEK-00070q-DE for pgsql-hackers@postgresql.org; Fri, 25 Feb 2022 01:17:15 +0000 Received: by mail-io1-xd34.google.com with SMTP id t11so4863501ioi.7 for ; Thu, 24 Feb 2022 17:17:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=uQrABxKocO3GYtvPQRNDIO18fMZRGGfz6fyT1ubq2P0=; b=tySpGmxBfrALOIm82/VsX4b3HV9NkBfB5X6rLLKqYz6Q5X8IBHP2UPneQaRSEYrZyB zEMOAif4X1/c2+dCnEdkDw8V1eJDWb0AQfXBX7au6yopU7MvmFduHiDDSCV9NC4GNXVR 9x+7kDwXIDH9wDO2oNFO4LpbVhSsC3hCeiJXkbr+sRkKTrsyyTPHFe/pU8aXiW7TGlBD Pq9JVdWiPEoMmGmz5xaDOTT8WYBoh1K5wT1kvTsJMxTdCFax2jBtsTlJMq51jmAFs7mF FgGQCGP3Bc4DyD/r5LvOnPuELR/4/f0J3xcNryfSmQaVgJsKlpECAQ0QXstvGf5rEiz/ xnEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=uQrABxKocO3GYtvPQRNDIO18fMZRGGfz6fyT1ubq2P0=; b=Htp/fItutFxAFi7EB2l7Mnov0iACYMgcGk68NPeL/kdHOQPSsjdcCJBUo2bT6VPYOz HbG+iXHIQPjxZ2Gk6A5z5y80fnOPyPzdaaAil5nM1IEKoz6Wri8IWR2IIuKIvHbZzFtU 0SL+50j/ddQm9spgAxyDC65nPhJOwaidE0WagvcGDWHES94kG5uNPeoifM7Ro1El4moF L+27s9eyCqkNiy6kSvH2iSfOvmxy7JaY+yeDF6yTBwdMe3DdqeTcOOQeLopLeFqUMuQe GWKNrK3QYV5OUBkrT8ZajCLhAmdVWPeUTa4ux8A+2gsVrw8XsaAOVe/VlgFmuduZ9UhC NvKg== X-Gm-Message-State: AOAM530WhL75QFZaf9wy/+AfR+I4ur4IYz0blQJ/Gy46uMzyW60NmOeH wgH30FwfxIgnlo7+PFt4c9qNyQ== X-Google-Smtp-Source: ABdhPJysfVZunNet5Kcc8WhUHLELbfEjIOtYwoaHSuz0pb4mRznNqqZcRXYaugB/YR9P+r+Lf/nKcw== X-Received: by 2002:a05:6638:2243:b0:314:aafc:a452 with SMTP id m3-20020a056638224300b00314aafca452mr4109823jas.2.1645751826318; Thu, 24 Feb 2022 17:17:06 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id n1-20020a92d9c1000000b002c26b97c8dasm733137ilq.35.2022.02.24.17.17.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Feb 2022 17:17:05 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 01A4C8004DF; Thu, 24 Feb 2022 19:17:04 -0600 (CST) Date: Thu, 24 Feb 2022 19:17:04 -0600 From: Justin Pryzby To: Andrew Dunstan Cc: Andres Freund , Tom Lane , Robert Haas , pgsql-hackers@postgresql.org, Thomas Munro , Melanie Plageman , Peter Eisentraut , Daniel Gustafsson Subject: Re: set TESTDIR from perl rather than Makefile Message-ID: <20220225011704.GA9008@telsasoft.com> References: <20220219234148.GC9008@telsasoft.com> <20220219235309.GA27807@telsasoft.com> <0d18be28-8314-6587-8ea2-713bb663d539@dunslane.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="bGR76rFJjkSxVeRa" Content-Disposition: inline In-Reply-To: <0d18be28-8314-6587-8ea2-713bb663d539@dunslane.net> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --bGR76rFJjkSxVeRa Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Feb 21, 2022 at 07:00:54AM -0500, Andrew Dunstan wrote: > On 2/19/22 18:53, Justin Pryzby wrote: > > On Sat, Feb 19, 2022 at 05:41:49PM -0600, Justin Pryzby wrote: > >> I rebased and fixed the check-guc script to work, made it work with vpath > >> builds, and cleaned it up some. > > I also meant to also attach it. > > This is going to break a bunch of stuff as written. > > First, it's not doing the same thing. The current system sets TESTDIR to > be the parent of the directory that holds the test. e.g. for > src/bin/pg_ctl/t/001_start_stop.pl it's src/bin/pg_ctl in the build > tree, not the 't' subdirectory. This patch apparently sets it to the 't' > subdirectory. That will break anything that goes looking for log files > in the current location, like the buildfarm client, and possibly some CI > setups as well. Yes, thanks. I changed the patch to use ENV{CURDIR} || dirname(dirname($0)). If I'm not wrong, that seems to be doing the right thing. > Also, unless I'm mistaken it appears to to the wrong thing for vpath > builds: > > my $test_dir = File::Spec->rel2abs(dirname($0)); > > is completely wrong for vpaths, since that will place it in the source > tree, not the build tree. > > Last, and for no explained reason that I can see, the patch undoes > commit f4ce6c4d3a, but only for msvc builds. Even if that's justified it > appears to have no relevance to this patch. Andres' idea is that perl should set TESTDIR and PATH. Here I commented out PATH, and had the improbable issue that nothing seemed to be breaking, including the pipeline test under msvc. It'd be helpful to know what configuration that breaks so I can test that it's broken and then test that it's fixed when set from within perl... I got busy here, and may not be able to progress this for awhile. --bGR76rFJjkSxVeRa Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-wip-set-TESTDIR-from-src-test-perl-rather-than-Makef.patch" From b46b405565a2fce3f96a1dcddf6d35ae7f3acc6d Mon Sep 17 00:00:00 2001 From: Justin Pryzby Date: Sat, 19 Feb 2022 13:06:52 -0600 Subject: [PATCH] wip: set TESTDIR from src/test/perl rather than Makefile/vcregress These seem most likely to break: make check -C src/bin/psql make check -C src/bin/pgbench make check -C src/test/modules/test_misc make check -C src/test/modules/libpq_pipeline PROVE_TESTS=t/027_stream_regress.pl make check -C src/test/recovery --- src/Makefile.global.in | 9 ++++++--- src/test/perl/PostgreSQL/Test/Utils.pm | 17 ++++++++++------- src/tools/msvc/vcregress.pl | 4 +--- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/Makefile.global.in b/src/Makefile.global.in index c980444233..92649d0193 100644 --- a/src/Makefile.global.in +++ b/src/Makefile.global.in @@ -451,8 +451,9 @@ define prove_installcheck rm -rf '$(CURDIR)'/tmp_check $(MKDIR_P) '$(CURDIR)'/tmp_check cd $(srcdir) && \ - TESTDIR='$(CURDIR)' PATH="$(bindir):$(CURDIR):$$PATH" \ + PATH="$(bindir):$(CURDIR):$$PATH" \ PGPORT='6$(DEF_PGPORT)' top_builddir='$(CURDIR)/$(top_builddir)' \ + PG_SUBDIR='$(CURDIR)' \ PG_REGRESS='$(CURDIR)/$(top_builddir)/src/test/regress/pg_regress' \ $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(if $(PROVE_TESTS),$(PROVE_TESTS),t/*.pl) endef @@ -461,8 +462,9 @@ define prove_installcheck rm -rf '$(CURDIR)'/tmp_check $(MKDIR_P) '$(CURDIR)'/tmp_check cd $(srcdir) && \ - TESTDIR='$(CURDIR)' PATH="$(bindir):$(CURDIR):$$PATH" \ + PATH="$(bindir):$(CURDIR):$$PATH" \ PGPORT='6$(DEF_PGPORT)' top_builddir='$(top_builddir)' \ + PG_SUBDIR='$(CURDIR)' \ PG_REGRESS='$(top_builddir)/src/test/regress/pg_regress' \ $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(if $(PROVE_TESTS),$(PROVE_TESTS),t/*.pl) endef @@ -472,7 +474,8 @@ define prove_check rm -rf '$(CURDIR)'/tmp_check $(MKDIR_P) '$(CURDIR)'/tmp_check cd $(srcdir) && \ - TESTDIR='$(CURDIR)' $(with_temp_install) PGPORT='6$(DEF_PGPORT)' \ + $(with_temp_install) PGPORT='6$(DEF_PGPORT)' \ + PG_SUBDIR='$(CURDIR)' \ PG_REGRESS='$(CURDIR)/$(top_builddir)/src/test/regress/pg_regress' \ $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(if $(PROVE_TESTS),$(PROVE_TESTS),t/*.pl) endef diff --git a/src/test/perl/PostgreSQL/Test/Utils.pm b/src/test/perl/PostgreSQL/Test/Utils.pm index 46cd746796..74ccaa08d9 100644 --- a/src/test/perl/PostgreSQL/Test/Utils.pm +++ b/src/test/perl/PostgreSQL/Test/Utils.pm @@ -184,19 +184,22 @@ INIT # test may still fail, but it's more likely to report useful facts. $SIG{PIPE} = 'IGNORE'; - # Determine output directories, and create them. The base path is the - # TESTDIR environment variable, which is normally set by the invoking - # Makefile. - $tmp_check = $ENV{TESTDIR} ? "$ENV{TESTDIR}/tmp_check" : "tmp_check"; + my $test_dir = File::Spec->rel2abs($ENV{PG_SUBDIR} || dirname(dirname($0))); + + my $test_name = basename($0); + $test_name =~ s/\.[^.]+$//; + + # Determine output directories, and create them. + # TODO: set srcdir? + $tmp_check = "$test_dir/tmp_check"; $log_path = "$tmp_check/log"; + $ENV{TESTDIR} = $test_dir; mkdir $tmp_check; mkdir $log_path; # Open the test log file, whose name depends on the test name. - $test_logfile = basename($0); - $test_logfile =~ s/\.[^.]+$//; - $test_logfile = "$log_path/regress_log_$test_logfile"; + $test_logfile = "$log_path/regress_log_$test_name"; open my $testlog, '>', $test_logfile or die "could not open STDOUT to logfile \"$test_logfile\": $!"; diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl index e2b0db0879..c1876fbdab 100644 --- a/src/tools/msvc/vcregress.pl +++ b/src/tools/msvc/vcregress.pl @@ -261,10 +261,8 @@ sub tap_check $ENV{PG_REGRESS} = "$topdir/$Config/pg_regress/pg_regress"; $ENV{REGRESS_SHLIB} = "$topdir/src/test/regress/regress.dll"; - $ENV{TESTDIR} = "$dir"; my $module = basename $dir; - # add the module build dir as the second element in the PATH - $ENV{PATH} =~ s!;!;$topdir/$Config/$module;!; + # $ENV{VCREGRESS_MODE} = $Config; rmtree('tmp_check'); system(@args); -- 2.17.1 --bGR76rFJjkSxVeRa--