X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Fipc.t;fp=t%2Fipc.t;h=face572632a5be27971ece8949cc08b2782d6a17;hb=2d610f0e645fd2b01bf9108b2d06022ab730815c;hp=5801c760cf8bcb960896138f4c05b75483eac774;hpb=a47d55c2f93cad83440ce20aa8bd971fa1501b56;p=public-inbox.git diff --git a/t/ipc.t b/t/ipc.t index 5801c760..face5726 100644 --- a/t/ipc.t +++ b/t/ipc.t @@ -37,7 +37,6 @@ my $ipc = bless {}, 'PublicInbox::IPC'; my @t = qw(array scalar scalarref undef); my $test = sub { my $x = shift; - my @res; for my $type (@t) { my $m = "test_$type"; my @ret = $ipc->ipc_do($m); @@ -46,34 +45,10 @@ my $test = sub { $ipc->ipc_do($m); - $ipc->ipc_async($m, [], sub { push @res, \@_ }, \$m); - my $ret = $ipc->ipc_do($m); my $exp = $ipc->$m; is_deeply($ret, $exp, "!wantarray $m $x"); - - is_deeply(\@res, [ [ \$m, \@exp ] ], "async $m $x"); - @res = (); } - $ipc->ipc_async_wait(-1); - is_deeply(\@res, [], 'no leftover results'); - $ipc->ipc_async('test_die', ['die test'], - sub { push @res, \@_ }, 'die arg'); - $ipc->ipc_async_wait(1); - is(scalar(@res), 1, 'only one result'); - is(scalar(@{$res[0]}), 2, 'result has 2-element array'); - is($res[0]->[0], 'die arg', 'got async die arg '.$x); - is(ref($res[0]->[1]), 'PublicInbox::IPC::Die', - "exception type $x"); - { - my $nr = PublicInbox::IPC::PIPE_BUF(); - my $count = 0; - my $cb = sub { ++$count }; - $ipc->ipc_async('test_undef', [], $cb) for (1..$nr); - $ipc->ipc_async_wait(-1); - is($count, $nr, "$x async runs w/o deadlock"); - } - my $ret = eval { $ipc->test_die('phail') }; my $exp = $@; $ret = eval { $ipc->ipc_do('test_die', 'phail') };