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:
@@ -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();
|
||||
Reference in New Issue
Block a user