diff options
Diffstat (limited to 'src/test/perl/PostgreSQL/Test/Utils.pm')
-rw-r--r-- | src/test/perl/PostgreSQL/Test/Utils.pm | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/test/perl/PostgreSQL/Test/Utils.pm b/src/test/perl/PostgreSQL/Test/Utils.pm index 2c0c72f57ac..46cd7467963 100644 --- a/src/test/perl/PostgreSQL/Test/Utils.pm +++ b/src/test/perl/PostgreSQL/Test/Utils.pm @@ -73,6 +73,7 @@ our @EXPORT = qw( system_log run_log run_command + pump_until command_ok command_fails @@ -408,6 +409,28 @@ sub run_command =pod +=item pump_until(proc, timeout, stream, until) + +Pump until string is matched on the specified stream, or timeout occurs. + +=cut + +sub pump_until +{ + my ($proc, $timeout, $stream, $until) = @_; + $proc->pump_nb(); + while (1) + { + last if $$stream =~ /$until/; + return 0 if ($timeout->is_expired); + return 0 if (not $proc->pumpable()); + $proc->pump(); + } + return 1; +} + +=pod + =item generate_ascii_string(from_char, to_char) Generate a string made of the given range of ASCII characters. |