Re: convert libpq uri-regress tests to tap test

Justin Pryzby <pryzby@telsasoft.com>

From: Justin Pryzby <pryzby@telsasoft.com>
To: Andres Freund <andres@anarazel.de>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Andrew Dunstan <andrew@dunslane.net>, Peter Eisentraut <peter.eisentraut@enterprisedb.com>, pgsql-hackers@postgresql.org
Date: 2022-04-16T14:44:54Z
Lists: pgsql-hackers
On Sat, Feb 26, 2022 at 05:46:26PM -0800, Andres Freund wrote:
> Pushed.  Attached is the remainder, 0003, the move of libpq_pipeline to
> src/interfaces/libpq that I'm not planning to push for now.

I saw that Andrew just pushed something to start building this under MSVC.

In case it's of any interest, I had done this differently a while back.
This probably doesn't apply except on top of some other patches, but you get
the idea.

commit 923f8a1c2cbea35cb01d1599caa2a81e3186181c
Author: Justin Pryzby <pryzbyj@telsasoft.com>
Date:   Mon Feb 28 01:31:10 2022 -0600

    f!
    
    ci-os-only: windows

diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index 4364ab943fd..71ec747e544 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -44,6 +44,7 @@ my $contrib_extraincludes  = {};
 my $contrib_extrasource    = {
 	'uri-regress' => ['src/interfaces/libpq/test/uri-regress.c'],
 	'testclient' => ['src/interfaces/libpq/test/testclient.c'],
+	'libpq_pipeline' => ['src/interfaces/libpq/test/libpq_pipeline.c'],
 };
 my @contrib_excludes = (
 	'bool_plperl',      'commit_ts',
@@ -475,7 +476,7 @@ sub mkvcbuild
 		push @contrib_excludes, 'uuid-ossp';
 	}
 
-	foreach my $subdir ('contrib', 'src/test/modules', 'src/interfaces/libpq')
+	foreach my $subdir ('contrib', 'src/test/modules') #, 'src/interfaces/libpq')
 	{
 		opendir($D, $subdir) || croak "Could not opendir on $subdir!\n";
 		while (my $d = readdir($D))
@@ -804,6 +805,20 @@ sub mkvcbuild
 		$p->AddReference($postgres);
 	}
 
+	$mf = Project::read_file('src/interfaces/libpq/test/Makefile');
+	$mf =~ s{\\\r?\n}{}g;
+	$mf =~ m{PROGRAMS\s*=\s*(.*)$}m
+	  || die 'Could not match in src/interfaces/libpq/test/Makefile' . "\n";
+	foreach my $prg (split /\s+/, $1)
+	{
+		my $proj = $solution->AddProject($prg, 'exe', 'bin');
+		$proj->AddFile("src/interfaces/libpq/test/$prg.c"); # implicit source file
+		$proj->AddIncludeDir('src/interfaces/libpq');
+		# XXX: pipeline needs pgcommon and ws2, but uri-regress doesn't
+		$proj->AddReference($libpq, $libpgport, $libpgcommon);
+		$proj->AddLibrary('ws2_32.lib');
+	}
+
 	$mf = Project::read_file('src/bin/scripts/Makefile');
 	$mf =~ s{\\\r?\n}{}g;
 	$mf =~ m{PROGRAMS\s*=\s*(.*)$}m



Commits

  1. Run tests of libpq on installcheck-world, checkprep and check-world

  2. Convert src/interfaces/libpq/test to a tap test.

  3. Run tap tests in src/interfaces/libpq.