From e0d1a9a04c3dab1f37d9772588f45a62c586d9a9 Mon Sep 17 00:00:00 2001
From: Lee Dong Wook <sh95119@gmail.com>
Date: Tue, 9 Aug 2022 11:13:49 +0900
Subject: [PATCH] vacuumlo: add test for coverage

---
 contrib/vacuumlo/t/002_vacuumlo.pl | 31 ++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 contrib/vacuumlo/t/002_vacuumlo.pl

diff --git a/contrib/vacuumlo/t/002_vacuumlo.pl b/contrib/vacuumlo/t/002_vacuumlo.pl
new file mode 100644
index 000000000000..e661b08f25ce
--- /dev/null
+++ b/contrib/vacuumlo/t/002_vacuumlo.pl
@@ -0,0 +1,31 @@
+
+# Copyright (c) 2021-2022, PostgreSQL Global Development Group
+
+use strict;
+use warnings;
+
+use PostgreSQL::Test::Cluster;
+use Test::More;
+use IPC::Run;
+
+my ($node, $port, $stdout, $stderr);
+
+$node = PostgreSQL::Test::Cluster->new('main');
+$node->init;
+$node->start;
+
+$node->safe_psql('postgres',
+    'CREATE TABLE test(loid oid);'
+    . 'INSERT INTO test(loid)
+       SELECT lo_creat(27);'
+    . 'DROP TABLE test;'
+    . 'CREATE TABLE test(loid oid);'
+    . 'INSERT INTO test(loid)
+       SELECT lo_creat(27);');
+
+$port = $node->port;
+IPC::Run::run [ 'vacuumlo', '-v', '-n', '-p', $port, 'postgres' ], '>', \$stdout;
+
+like($stdout, qr/Removing lo  \d+/, 'remove lo successfully');
+
+done_testing();
