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 1nLZXW-0002no-2D for pgsql-hackers@arkaria.postgresql.org; Sat, 19 Feb 2022 23:53:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nLZXU-000149-4f for pgsql-hackers@arkaria.postgresql.org; Sat, 19 Feb 2022 23:53:20 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nLZXT-000140-N5 for pgsql-hackers@lists.postgresql.org; Sat, 19 Feb 2022 23:53:19 +0000 Received: from mail-io1-xd2c.google.com ([2607:f8b0:4864:20::d2c]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nLZXL-0003UT-R9 for pgsql-hackers@postgresql.org; Sat, 19 Feb 2022 23:53:18 +0000 Received: by mail-io1-xd2c.google.com with SMTP id t11so6131152ioi.7 for ; Sat, 19 Feb 2022 15:53:11 -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=eIQjIVNatZUiWHczi7I3nJ4jVTP8Z1WR4QlH70RqdaI=; b=al72WA2j3O9RuOU56flZfwP3hCGOiE+M6aVr/tK8ermZ3f+nsprQDJgPIvevi6o2Cz L/rVQ3IGChLwYy0ul3zVrTUmixttyDaUZo7vVGnxxtTU7ggFmJ/VH35G5mCXdldXjy1c Ky0cPbF4Y1SqZxUSIse8o/YXfukjIq4tlaGEbWcEVGV9gCHt8aUeVYzCzTPPerRup4BP zUBnovsrUtLqM1qzZQ6XkHo0t5CXDe9V6MYzWEYpaW+5F7SoAvRbx4rREgzn4Hv0bEo1 IyQUEm1Da10FE9Z10bOULfjYmQMvECV4t4vHoKWIlXN/B7padb/axcQsY0OzaBvF536p G5Ug== 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=eIQjIVNatZUiWHczi7I3nJ4jVTP8Z1WR4QlH70RqdaI=; b=WrVfCRnddsIcyCLai9gnJiogRU5MAZ4ZJcVizwjmWR7XBE4PH3ySSM/tDMtZDkTbDR zwsrtqimPN8UWQt4dha2vC4W6IKWOkLLNoB+g/LkLK7W8c8by+E9EnXPpXzIMwId15Pg HXINLlm7dg4yZWIZF7hjDwd/H+FgoJYobL+vt7uF0v7DeeMlr/ozbvSt65FxKZR+509Q wE28tcPxWJl1P5WuWzw/VQagVKTtYIqA73/C1Jmzu3QTpnEWXwqfM0xw/A2WCmIB+8Hx pZjuhCwe2j1MGJnV3wAfkLWv0DHxrhSr83KAFf/k8aCI6CXNpAziGFWqQsB6ckhDv8WH sQDg== X-Gm-Message-State: AOAM531gj/IGuS6JucQEjqSAIIs3o0Qn+JY5fUz2IIWPrekYfSvCAYXk OjegCWVDZq5vM5LtnlCM7DI0ZA== X-Google-Smtp-Source: ABdhPJyB8oj9/r4xeurDsG6cjW/DtVWZlJ0ytedeHz+oEbMpZqBLEQXrFDOAAWaPD+3bmggYhktmgQ== X-Received: by 2002:a05:6638:3b3:b0:314:bcc7:d975 with SMTP id z19-20020a05663803b300b00314bcc7d975mr4831654jap.202.1645314791011; Sat, 19 Feb 2022 15:53:11 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id y10sm5978719ill.15.2022.02.19.15.53.10 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 19 Feb 2022 15:53:10 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id AD6E8800747; Sat, 19 Feb 2022 17:53:09 -0600 (CST) Date: Sat, 19 Feb 2022 17:53:09 -0600 From: Justin Pryzby To: Andres Freund Cc: Tom Lane , Robert Haas , Andrew Dunstan , pgsql-hackers@postgresql.org, Thomas Munro , Melanie Plageman , Peter Eisentraut , Daniel Gustafsson Subject: Re: set TESTDIR from perl rather than Makefile Message-ID: <20220219235309.GA27807@telsasoft.com> References: <20220219234148.GC9008@telsasoft.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="ZPt4rx8FFjLCG7dd" Content-Disposition: inline In-Reply-To: <20220219234148.GC9008@telsasoft.com> 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 --ZPt4rx8FFjLCG7dd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 (and other) patches ran here. > https://github.com/justinpryzby/postgres/runs/5261323874 > ... > e806bcb280 wip: set TESTDIR from src/test/perl rather than Makefile/vcregress --ZPt4rx8FFjLCG7dd 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 e806bcb280f1093c0a0e71c9a0b5617f938c4b86 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 --- src/Makefile.global.in | 6 +++--- .../libpq_pipeline/t/001_libpq_pipeline.pl | 3 ++- src/test/modules/test_misc/t/003_check_guc.pl | 2 +- src/test/perl/PostgreSQL/Test/Utils.pm | 16 +++++++++------- src/tools/msvc/vcregress.pl | 4 +--- 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/Makefile.global.in b/src/Makefile.global.in index c980444233..ff20387c42 100644 --- a/src/Makefile.global.in +++ b/src/Makefile.global.in @@ -451,7 +451,7 @@ 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_REGRESS='$(CURDIR)/$(top_builddir)/src/test/regress/pg_regress' \ $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(if $(PROVE_TESTS),$(PROVE_TESTS),t/*.pl) @@ -461,7 +461,7 @@ 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_REGRESS='$(top_builddir)/src/test/regress/pg_regress' \ $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(if $(PROVE_TESTS),$(PROVE_TESTS),t/*.pl) @@ -472,7 +472,7 @@ 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_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/modules/libpq_pipeline/t/001_libpq_pipeline.pl b/src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl index 0c164dcaba..2a0eca7744 100644 --- a/src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl +++ b/src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl @@ -49,7 +49,8 @@ for my $testname (@tests) my $expected; my $result; - $expected = slurp_file_eval("traces/$testname.trace"); + my $inputdir = "$ENV{'TESTDIR'}/tmp_check"; + $expected = slurp_file_eval("$inputdir/traces/$testname.trace"); next unless $expected ne ""; $result = slurp_file_eval($traceout); next unless $result ne ""; diff --git a/src/test/modules/test_misc/t/003_check_guc.pl b/src/test/modules/test_misc/t/003_check_guc.pl index 60459ef759..f4c1636240 100644 --- a/src/test/modules/test_misc/t/003_check_guc.pl +++ b/src/test/modules/test_misc/t/003_check_guc.pl @@ -35,7 +35,7 @@ my @not_in_sample_array = split("\n", lc($not_in_sample)); # TAP tests are executed in the directory of the test, in the source tree, # even for VPATH builds, so rely on that to find postgresql.conf.sample. -my $rootdir = "../../../.."; +my $rootdir = "$ENV{TESTDIR}/../../../../.."; my $sample_file = "$rootdir/src/backend/utils/misc/postgresql.conf.sample"; # List of all the GUCs found in the sample file. diff --git a/src/test/perl/PostgreSQL/Test/Utils.pm b/src/test/perl/PostgreSQL/Test/Utils.pm index 31e2b0315e..8a8d95ca8c 100644 --- a/src/test/perl/PostgreSQL/Test/Utils.pm +++ b/src/test/perl/PostgreSQL/Test/Utils.pm @@ -184,19 +184,21 @@ 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(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..63085506e0 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 --ZPt4rx8FFjLCG7dd--