diff options
author | Eric Wong <e@80x24.org> | 2020-12-18 07:16:58 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2020-12-19 09:32:08 +0000 |
commit | b28dcf96700a79616e7338bb8610f89155dd57e4 (patch) | |
tree | fa1fc80c00d6d8e29348be4fed175311f793a521 /t | |
parent | 223d66dfcf9d0915709e23a561322e8bb4a7fac6 (diff) | |
download | public-inbox-b28dcf96700a79616e7338bb8610f89155dd57e4.tar.gz |
I'm a bit spoiled by using single-dash digit options from common tools: ("git log -$DIGIT", "kill -9", "tail -1", ...), so we'll support it for limiting query results. But first, make it easier to send arbitrary signals to the daemon via "daemon-kill". "daemon-stop" is redundant, now, and removed, since the default for "daemon-kill" is SIGTERM to match kill(1) behavior.
Diffstat (limited to 't')
-rw-r--r-- | t/lei.t | 18 |
1 files changed, 14 insertions, 4 deletions
@@ -127,7 +127,7 @@ my $test_lei_common = sub { my $test_lei_oneshot = $ENV{TEST_LEI_ONESHOT}; SKIP: { last SKIP if $test_lei_oneshot; - require_mods(qw(IO::FDPass Cwd), 41); + require_mods(qw(IO::FDPass Cwd), 46); my $sock = "$ENV{XDG_RUNTIME_DIR}/lei/sock"; ok(run_script([qw(lei daemon-pid)], undef, $opt), 'daemon-pid'); @@ -174,9 +174,9 @@ SKIP: { ok(run_script([qw(lei daemon-env)], undef, $opt), 'env is empty'); is($out, '', 'env cleared'); - ok(run_script([qw(lei daemon-stop)], undef, $opt), 'daemon-stop'); - is($out, '', 'no output from daemon-stop'); - is($err, '', 'no error from daemon-stop'); + ok(run_script([qw(lei daemon-kill)], undef, $opt), 'daemon-kill'); + is($out, '', 'no output from daemon-kill'); + is($err, '', 'no error from daemon-kill'); for (0..100) { kill(0, $pid) or last; tick(); @@ -189,6 +189,16 @@ SKIP: { ok(kill(0, $new_pid), 'new pid is running'); ok(-S $sock, 'sock exists again'); + $out = $err = ''; + for my $sig (qw(-0 -CHLD)) { + ok(run_script([qw(lei daemon-kill), $sig ], undef, $opt), + "handles $sig"); + } + is($out.$err, '', 'no output on innocuous signals'); + ok(run_script([qw(lei daemon-pid)], undef, $opt), 'daemon-pid'); + chomp $out; + is($out, $new_pid, 'PID unchanged after -0/-CHLD'); + if ('socket inaccessible') { chmod 0000, $sock or BAIL_OUT "chmod 0000: $!"; $out = $err = ''; |