mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-09-09 05:00:44 +00:00
1f26a3b318
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.
27 lines
823 B
Perl
27 lines
823 B
Perl
#!/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();
|