From: Eric Wong Date: Tue, 26 Aug 2025 19:50:44 +0000 (+0000) Subject: t/ipc: improve test reliability X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a9d1e6d52f9c31c8a4182b963770c89b373d77b3;p=thirdparty%2Fpublic-inbox.git t/ipc: improve test reliability ->wq_close works asynchronously, nowadays, so processes may not be completely done writing warnings when the parent process reads the file. We'll test some untested methods after test_die to ensure the worker has had time to write the exception to the warning log. Finally, we'll explain warning contents on failure in case it happens again. --- diff --git a/t/ipc.t b/t/ipc.t index d6a4b3414..fa1b04051 100644 --- a/t/ipc.t +++ b/t/ipc.t @@ -168,6 +168,10 @@ SKIP: { my $exp = bless ['blessed'], 'PublicInbox::WTF'; my $ret = eval { $ipc->wq_do('test_die', $exp) }; is_deeply($@, $exp, 'die with blessed ref'); + $s = $ipc->wq_do('test_scalarref'); + is_xdeeply $s, \'scalarref', 'scalar ref returned'; + $s = $ipc->wq_do('test_undef'); + is $s, undef, 'undef returned'; } $ipc->wq_close; @@ -175,7 +179,7 @@ SKIP: { require_mods '+SCM_RIGHTS', 1; seek $warn, 0, SEEK_SET; my @warn = <$warn>; - is(scalar(@warn), 2, 'warned 3 times'); + is(scalar(@warn), 2, 'warned 3 times') or diag explain(\@warn); like($warn[0], qr/ wq_worker: /, '2nd warned from wq_worker'); is($warn[0], $warn[1], 'worker did not die');