2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-09-04 20:17:55 +00:00

test(remoteshell): pin the signal that stops the ssh daemon

Check that no kill in the postscript gives the signal number without a hyphen,
and that the ssh daemon gets the signal that a process cannot catch.
This commit is contained in:
Vinícius Ferrão
2026-08-29 18:32:47 -03:00
parent 7ea6aa9697
commit 1f26a3b318
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env perl
use strict;
use warnings;
use File::Spec;
use FindBin;
use Test::More;
my $script = File::Spec->catfile( $FindBin::Bin, '..', '..',
'xCAT', 'postscripts', 'remoteshell' );
plan skip_all => 'remoteshell not found' unless -r $script;
open( my $fh, '<', $script ) or die "Unable to read $script: $!";
my $source = do { local $/; <$fh> };
close($fh);
# A kill without the hyphen reads the signal number as one more process id, so
# the target gets the default signal, which a process can catch, and the
# process with that id is signalled as well.
my @bare = ( $source =~ /^[^#\n]*\bkill\s+\d/gm );
is( scalar(@bare), 0, 'no kill gives the signal number without a hyphen' );
like( $source, qr/kill -9 \$PIDLIST/,
'the ssh daemon gets the signal that a process cannot catch' );
done_testing();