]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/cmd_ipc.t
No ext_urls
[public-inbox.git] / t / cmd_ipc.t
index dd90fa2a63e401962061cece8f1450295f8beb0c..cd76d5e896d160a015e19a9f9e119bfa0ffaa188 100644 (file)
@@ -1,5 +1,5 @@
 #!perl -w
-# Copyright (C) 2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use strict;
 use v5.10.1;
@@ -10,7 +10,6 @@ pipe(my ($r, $w)) or BAIL_OUT;
 my ($send, $recv);
 require_ok 'PublicInbox::Spawn';
 my $SOCK_SEQPACKET = eval { Socket::SOCK_SEQPACKET() } // undef;
-use Time::HiRes qw(usleep);
 
 my $do_test = sub { SKIP: {
        my ($type, $flag, $desc) = @_;
@@ -61,7 +60,7 @@ my $do_test = sub { SKIP: {
                        if ($pid == 0) {
                                # need to loop since Perl signals are racy
                                # (the interpreter doesn't self-pipe)
-                               while (usleep(1000)) {
+                               while (tick(0.01)) {
                                        kill 'ALRM', $tgt;
                                }
                        }
@@ -142,4 +141,15 @@ SKIP: {
        }
 }
 
+SKIP: {
+       skip 'not Linux', 1 if $^O ne 'linux';
+       require_ok 'PublicInbox::Syscall';
+       $send = PublicInbox::Syscall->can('send_cmd4') or
+               skip 'send_cmd4 not defined for arch';
+       $recv = PublicInbox::Syscall->can('recv_cmd4') or
+               skip 'recv_cmd4 not defined for arch';
+       $do_test->(SOCK_STREAM, 0, 'PP Linux stream');
+       $do_test->($SOCK_SEQPACKET, MSG_EOR, 'PP Linux seqpacket');
+}
+
 done_testing;