]> Sergey Matveev's repositories - public-inbox.git/commitdiff
t/lei: fix double-running of socket test with oneshot
authorEric Wong <e@80x24.org>
Tue, 19 Jan 2021 09:34:33 +0000 (09:34 +0000)
committerEric Wong <e@80x24.org>
Thu, 21 Jan 2021 03:29:12 +0000 (03:29 +0000)
We split out t/lei-oneshot.t and t/lei.t so it's easier
to isolate run-mode specific bugs and behavior and there's
no reason to rerun the socket daemon tests.

t/lei.t

diff --git a/t/lei.t b/t/lei.t
index 8eede13e2437fb63d99e9bbe7e78d7b18c55275e..c804ff5916c5378e0795b3f8db4bf9571899e178 100644 (file)
--- a/t/lei.t
+++ b/t/lei.t
@@ -234,18 +234,14 @@ if ($ENV{TEST_LEI_ONESHOT}) {
        local $ENV{XDG_RUNTIME_DIR} = $xrd;
        $err_filter = qr!\Q$xrd!;
        $test_lei_common->();
-}
-
+} else {
 SKIP: { # real socket
-       require_mods(qw(Cwd), my $nr = 105);
-       my $nfd = eval { require Socket::MsgHdr; 5 } // do {
+       eval { require Socket::MsgHdr; 1 } // do {
                require PublicInbox::Spawn;
-               PublicInbox::Spawn->can('send_cmd4') ? 5 : undef;
-       } //
-       skip 'Socket::MsgHdr or Inline::C missing or unconfigured', $nr;
-
+               PublicInbox::Spawn->can('send_cmd4');
+       } // skip 'Socket::MsgHdr or Inline::C missing or unconfigured', 115;
        local $ENV{XDG_RUNTIME_DIR} = "$home/xdg_run";
-       my $sock = "$ENV{XDG_RUNTIME_DIR}/lei/$nfd.seq.sock";
+       my $sock = "$ENV{XDG_RUNTIME_DIR}/lei/5.seq.sock";
 
        ok($lei->('daemon-pid'), 'daemon-pid');
        is($err, '', 'no error from daemon-pid');
@@ -297,6 +293,7 @@ SKIP: { # real socket
        }
        ok(!kill(0, $new_pid), 'daemon exits after unlink');
        # success over socket, can't test without
-};
+}; # SKIP
+} # else
 
 done_testing;