From 92fc68d23d9e53c1b3a92de776a01945e0a687c5 Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.munro@gmail.com>
Date: Tue, 28 Mar 2023 15:12:56 +1300
Subject: [PATCH 2/2] fixup

---
 src/bin/pg_basebackup/meson.build               |  1 +
 .../pg_basebackup/t/011_in_place_tablespace.pl  | 17 ++++++++++++++---
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/bin/pg_basebackup/meson.build b/src/bin/pg_basebackup/meson.build
index c684622bfb..c426173db3 100644
--- a/src/bin/pg_basebackup/meson.build
+++ b/src/bin/pg_basebackup/meson.build
@@ -86,6 +86,7 @@ tests += {
     },
     'tests': [
       't/010_pg_basebackup.pl',
+      't/011_in_place_tablespace.pl',
       't/020_pg_receivewal.pl',
       't/030_pg_recvlogical.pl',
     ],
diff --git a/src/bin/pg_basebackup/t/011_in_place_tablespace.pl b/src/bin/pg_basebackup/t/011_in_place_tablespace.pl
index d58696e8f9..2ea70cbd3c 100644
--- a/src/bin/pg_basebackup/t/011_in_place_tablespace.pl
+++ b/src/bin/pg_basebackup/t/011_in_place_tablespace.pl
@@ -25,16 +25,27 @@ SET allow_in_place_tablespaces = on;
 CREATE TABLESPACE inplace LOCATION '';
 EOM
 
-# Back it up.
-my $backupdir = $tempdir . '/backup';
+# Back it up with tar format.
+my $backupdir = $tempdir . '/backup-tar';
 $node->command_ok(
 	[ @pg_basebackup_defs, '-D', $backupdir, '-Ft', '-X', 'none' ],
-	'pg_basebackup runs');
+	'pg_basebackup runs with tar format');
 
 # Make sure we got base.tar and one tablespace.
 ok(-f "$backupdir/base.tar", 'backup tar was created');
 my @tblspc_tars = glob "$backupdir/[0-9]*.tar";
 is(scalar(@tblspc_tars), 1, 'one tablespace tar was created');
 
+# Back it up with plain format.
+$backupdir = $tempdir . '/backup-plain';
+$node->command_ok(
+	[ @pg_basebackup_defs, '-D', $backupdir, '-Fp', '-X', 'none' ],
+	'pg_basebackup runs with plain format');
+
+# Make sure we got an in-place tablespace directly in the PGDATA.
+my @tblspc_dirs = glob "$backupdir/pg_tblspc/[0-9]*";
+is(scalar(@tblspc_dirs), 1, 'one tablespace was created');
+ok(-d $tblspc_dirs[0], 'it is a directory');
+
 # All good.
 done_testing();
-- 
2.39.2

