Re: Weird test mixup

Heikki Linnakangas <hlinnaka@iki.fi>

From: Heikki Linnakangas <hlinnaka@iki.fi>
To: Tom Lane <tgl@sss.pgh.pa.us>, Michael Paquier <michael@paquier.xyz>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2024-03-15T13:23:18Z
Lists: pgsql-hackers
On 15/03/2024 14:10, Heikki Linnakangas wrote:
> On 15/03/2024 13:09, Heikki Linnakangas wrote:
>> I committed a patch to do that, to put out the fire.
> 
> That's turning the buildfarm quite red. Many, but not all animals are
> failing like this:
> 
>> --- /home/buildfarm/hippopotamus/buildroot/HEAD/pgsql.build/src/test/modules/injection_points/expected/injection_points.out	2024-03-15 12:41:16.363286975 +0100
>> +++ /home/buildfarm/hippopotamus/buildroot/HEAD/pgsql.build/src/test/modules/injection_points/results/injection_points.out	2024-03-15 12:53:11.528159615 +0100
>> @@ -1,118 +1,111 @@
>>   CREATE EXTENSION injection_points;
>> +ERROR:  extension "injection_points" is not available
>> +DETAIL:  Could not open extension control file "/home/buildfarm/hippopotamus/buildroot/HEAD/pgsql.build/tmp_install/home/buildfarm/hippopotamus/buildroot/HEAD/inst/share/postgresql/extension/injection_points.control": No such file or directory.
>> +HINT:  The extension must first be installed on the system where PostgreSQL is running.
>> ...
> 
> Looks like adding NO_INSTALLCHECK somehow affected how the modules are
> installed in tmp_install. I'll investigate..

I think this is a bug in the buildfarm client. In the make_misc_check 
step, it does this (reduced to just the interesting parts):

> # run the modules that can't be run with installcheck
> sub make_misc_check
> {
> 	...
> 	my @dirs = glob("$pgsql/src/test/modules/* $pgsql/contrib/*");
> 	foreach my $dir (@dirs)
> 	{
> 		next unless -e "$dir/Makefile";
> 		my $makefile = file_contents("$dir/Makefile");
> 		next unless $makefile =~ /^NO_INSTALLCHECK/m;
> 		my $test = basename($dir);
> 
> 		# skip redundant TAP tests which are called elsewhere
> 		my @out = run_log("cd $dir && $make $instflags TAP_TESTS= check");
> 		...
> 	}

So it scans src/test/modules, and runs "make check" for all 
subdirectories that have NO_INSTALLCHECK in the makefile. But the 
injection fault tests are also conditional on the 
enable_injection_points in the parent Makefile:

> ifeq ($(enable_injection_points),yes)
> SUBDIRS += injection_points gin
> else
> ALWAYS_SUBDIRS += injection_points gin
> endif

The buildfarm client doesn't pay any attention to that, and runs the 
test anyway.

I committed an ugly hack to the subdirectory Makefiles, to turn "make 
check" into a no-op if injection points are disabled. Normally when you 
run "make check" at the parent level, it doesn't even recurse to the 
directories, but this works around the buildfarm script. I hope...

-- 
Heikki Linnakangas
Neon (https://neon.tech)




Commits

  1. injection_points: Store runtime conditions in private area

  2. Introduce private data area for injection points

  3. injection_points: Fix incorrect spinlock acquisition

  4. Make GIN tests using injection points concurrent-safe

  5. injection_points: Fix race condition with local injection point tests

  6. injection_points: Introduce runtime conditions

  7. Make GIN test using injection points repeatable

  8. Fix backstop in gin test if injection point is not reached

  9. Try to unbreak injection-fault tests in the buildfarm

  10. Disable tests using injection points in installcheck