diff options
Diffstat (limited to 'src/bin/psql/t/010_tab_completion.pl')
-rw-r--r-- | src/bin/psql/t/010_tab_completion.pl | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/src/bin/psql/t/010_tab_completion.pl b/src/bin/psql/t/010_tab_completion.pl index 2eea515e871..d500e5efe7e 100644 --- a/src/bin/psql/t/010_tab_completion.pl +++ b/src/bin/psql/t/010_tab_completion.pl @@ -7,7 +7,6 @@ use warnings; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; use Test::More; -use IPC::Run qw(pump finish timer); use Data::Dumper; # Do nothing unless Makefile has told us that the build is --with-readline. @@ -91,14 +90,7 @@ print $FH "other stuff\n"; close $FH; # fire up an interactive psql session -my $in = ''; -my $out = ''; - -my $timer = timer($PostgreSQL::Test::Utils::timeout_default); - -my $h = $node->interactive_psql('postgres', \$in, \$out, $timer); - -like($out, qr/psql/, "print startup banner"); +my $h = $node->interactive_psql('postgres'); # Simple test case: type something and see if psql responds as expected sub check_completion @@ -108,15 +100,12 @@ sub check_completion # report test failures from caller location local $Test::Builder::Level = $Test::Builder::Level + 1; - # reset output collector - $out = ""; # restart per-command timer - $timer->start($PostgreSQL::Test::Utils::timeout_default); - # send the data to be sent - $in .= $send; - # wait ... - pump $h until ($out =~ $pattern || $timer->is_expired); - my $okay = ($out =~ $pattern && !$timer->is_expired); + $h->{timeout}->start($PostgreSQL::Test::Utils::timeout_default); + + # send the data to be sent and wait for its result + my $out = $h->query_until($pattern, $send); + my $okay = ($out =~ $pattern && !$h->{timeout}->is_expired); ok($okay, $annotation); # for debugging, log actual output if it didn't match local $Data::Dumper::Terse = 1; @@ -442,10 +431,7 @@ check_completion("blarg \t\t", qr//, "check completion failure path"); clear_query(); # send psql an explicit \q to shut it down, else pty won't close properly -$timer->start($PostgreSQL::Test::Utils::timeout_default); -$in .= "\\q\n"; -finish $h or die "psql returned $?"; -$timer->reset; +$h->quit or die "psql returned $?"; # done $node->stop; |