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 1nKDYQ-0008BZ-GH for pgsql-hackers@arkaria.postgresql.org; Wed, 16 Feb 2022 06:12:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nKDYP-00069I-Cc for pgsql-hackers@arkaria.postgresql.org; Wed, 16 Feb 2022 06:12:41 +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 1nKDYO-000699-VS for pgsql-hackers@lists.postgresql.org; Wed, 16 Feb 2022 06:12:41 +0000 Received: from mail-il1-x12b.google.com ([2607:f8b0:4864:20::12b]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nKDYM-0003nF-8A for pgsql-hackers@postgresql.org; Wed, 16 Feb 2022 06:12:39 +0000 Received: by mail-il1-x12b.google.com with SMTP id d3so703462ilr.10 for ; Tue, 15 Feb 2022 22:12:38 -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=vPGHLbl82Y+nWjlReSBwXIQp0tzmzLBB1yQEBDSvH+I=; b=i62E6sRj7USy3M97ks4Xo+mV0Lvk0M4pu6Gt+BwENgzUn8PnxDAXdq0EkKFOeDYz5i rqdFyx5HLU7pOtZNRJyOIkx0AdynbqX/OfUHlgvfTDXr1olFzR5vdk5/EXj00fov0/re 6KBNadeSgcia4o7fmqLwyX4f7QZ/RaDFuOGErVrf0wJxpyWY1W8oiK/09GqXmQ5naAO4 tm+rwP0q5Ioc41LkVTrEetRMRd6DurIEZk+Y+BD+vhOkM4jVH3j3oTeM8uuo5vpaI903 mJJqOvEayrzqL5BCoH2lvAn7aFloazaKRyfH/XJh9GCcDC2X3oNRvaBo76Mv8QsU4SpN WibA== 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=vPGHLbl82Y+nWjlReSBwXIQp0tzmzLBB1yQEBDSvH+I=; b=YpVPYEWkFNKTt0FI5D2RuWBmdTsBUq6FaVh/a6tmKHgGW2wsEdus6VSl+YxkO3IWbT tfbI6+Pl2djS8TiFk7uWKr9nfJqIVC0TvXefYsNSCp2Cp0hnnSoqM0Hz4y0LykSKb+kj B5qkENxGBWs5wdqgi2BFr7j9cj26IhwlVaT4HVAHamw5tTBcisJVGrCUCn8L+pRar8/d rp0fkC2+w5m3lZX5RkZofHcsg7j/FST8vscVzQ0k13kDUx9z5DhHN98rF1tfWne2sr1L Mg7ifFhUv5U5LGWh6bUh1YfHon1dZKmlh8fU37TyozS9x3Fa3Plcb8MIZOzxTbFyJsY7 DL1A== X-Gm-Message-State: AOAM532oVQ69YR77jao6qLH4bC7mD5CwdLC3QOS3xYoYfqjNSzeYXWGq gBCeF+i2X8a6aIJSIaahapH9ZA== X-Google-Smtp-Source: ABdhPJzvAccjdvjKOlTJ3zefEI7kf7T2moJWonW1pAOxgnQIKPGioaTjrEjH57sFQ/I4dESMX70+Zw== X-Received: by 2002:a05:6e02:2167:b0:2be:6ab4:ef28 with SMTP id s7-20020a056e02216700b002be6ab4ef28mr823548ilv.237.1644991957482; Tue, 15 Feb 2022 22:12:37 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id f13sm24541960ion.18.2022.02.15.22.12.36 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Feb 2022 22:12:36 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 47182800740; Wed, 16 Feb 2022 00:12:36 -0600 (CST) Date: Wed, 16 Feb 2022 00:12:36 -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: Adding CI to our tree Message-ID: <20220216061235.GE31460@telsasoft.com> References: <85428.1642447853@sss.pgh.pa.us> <20220117201619.3ltudwhgk2krmoki@alap3.anarazel.de> <20220118210847.GC23027@telsasoft.com> <20220203035827.GG23027@telsasoft.com> <20220203195718.smqo5xg4ygp5qktq@alap3.anarazel.de> <20220213002420.z2ynm4tl7maxnsuy@alap3.anarazel.de> <20220213210250.GQ31460@telsasoft.com> <20220213212316.wjxncalestylnufh@alap3.anarazel.de> <20220213213120.GR31460@telsasoft.com> <20220213215319.y2amksapmdwplu5i@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220213215319.y2amksapmdwplu5i@alap3.anarazel.de> 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 On Sun, Feb 13, 2022 at 01:53:19PM -0800, Andres Freund wrote: > Hi, > > On 2022-02-13 15:31:20 -0600, Justin Pryzby wrote: > > Oh - I suppose you're right. That's an unfortunate consequence of running a > > single prove instance without chdir. > > I don't think it's chdir that's relevant (that changes into the source > directory after all). It's the TESTDIR environment variable. > > I was thinking that we should make Utils.pm's INIT block responsible for > figuring out both the directory a test should run in and the log location, > instead having that in vcregress.pl and Makefile.global.in. Mostly because > doing it in the latter means we can't start tests with different TESTDIR and > working dir at the same time. > > If instead we pass the location of the top-level build and top-level source > directory from vcregress.pl / Makefile.global, the tap test infrastructure can > figure out that stuff themselves, on a per-test basis. > > For msvc builds we probably would need to pass in some information that allow > Utils.pm to set up PATH appropriately. I think that might just require knowing > that a) msvc build system is used b) Release vs Debug. I'm totally unsure if this resembles what you're thinking of, and I'm surprised I got it working so easily. But it gets the tap test output in separate dirs, and CI is passing for everyone (windows failed because I injected a "false" to force it to upload artifacts). https://github.com/justinpryzby/postgres/runs/5211673291 commit 899e562102dd7a663cb087cdf88f0f78f8302492 Author: Justin Pryzby Date: Tue Feb 15 20:02:36 2022 -0600 wip: set TESTDIR from src/test/perl rather than Makefile/vcregress diff --git a/src/Makefile.global.in b/src/Makefile.global.in index 05c54b27def..1e49d8c8c37 100644 --- a/src/Makefile.global.in +++ b/src/Makefile.global.in @@ -450,7 +450,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) @@ -460,7 +460,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) @@ -471,7 +471,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/bin/psql/t/010_tab_completion.pl b/src/bin/psql/t/010_tab_completion.pl index 005961f34d4..a86dc78a365 100644 --- a/src/bin/psql/t/010_tab_completion.pl +++ b/src/bin/psql/t/010_tab_completion.pl @@ -70,7 +70,7 @@ delete $ENV{LS_COLORS}; # to run in the build directory so that we can use relative paths to # access the tmp_check subdirectory; otherwise the output from filename # completion tests is too variable. -if ($ENV{TESTDIR}) +if ($ENV{TESTDIR} && 0) { chdir $ENV{TESTDIR} or die "could not chdir to \"$ENV{TESTDIR}\": $!"; } 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 facfec5cad4..2a0eca77440 100644 --- a/src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl +++ b/src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl @@ -49,9 +49,7 @@ for my $testname (@tests) my $expected; my $result; - # Hack to allow TESTDIR=. during parallel tap tests - my $inputdir = "$ENV{'TESTDIR'}/src/test/modules/libpq_pipeline"; - $inputdir = "$ENV{'TESTDIR'}" if ! -e $inputdir; + my $inputdir = "$ENV{'TESTDIR'}/tmp_check"; $expected = slurp_file_eval("$inputdir/traces/$testname.trace"); next unless $expected ne ""; $result = slurp_file_eval($traceout); diff --git a/src/test/perl/PostgreSQL/Test/Utils.pm b/src/test/perl/PostgreSQL/Test/Utils.pm index 57fcb240898..5429de41ed5 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 TESTDIR and 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 fdb6f44eded..d7794c5766a 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; print "============================================================\n"; print "Checking @args\n";