about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-06-10 07:04:27 +0000
committerEric Wong <e@yhbt.net>2020-06-13 07:55:45 +0000
commit02c7f08fdf43732b977887887c7f94350e894831 (patch)
tree6719fd26c038153550386ed6037180a109ed523d /lib
parentd622e3b7978d974b2c0d76acea3074ec9cac80f5 (diff)
downloadpublic-inbox-02c7f08fdf43732b977887887c7f94350e894831.tar.gz
None of our tests rely on this failing, so just bail out
if the system is out of resources.
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/TestCommon.pm7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm
index 246047b1..5e7dc8b0 100644
--- a/lib/PublicInbox/TestCommon.pm
+++ b/lib/PublicInbox/TestCommon.pm
@@ -37,17 +37,18 @@ sub tcp_server () {
                 Type => Socket::SOCK_STREAM(),
                 Listen => 1024,
                 Blocking => 0,
-        )
+        ) or Test::More::BAIL_OUT("failed to create TCP server: $!");
 }
 
 sub tcp_connect {
         my ($dest, %opt) = @_;
+        my $addr = $dest->sockhost . ':' . $dest->sockport;
         my $s = IO::Socket::INET->new(
                 Proto => 'tcp',
                 Type => Socket::SOCK_STREAM(),
-                PeerAddr => $dest->sockhost . ':' . $dest->sockport,
+                PeerAddr => $addr,
                 %opt,
-        );
+        ) or Test::More::BAIL_OUT("failed to connect to $addr: $!");
         $s->autoflush(1);
         $s;
 }