/usr/src/blcr-0.8.2/tests/perl_test.sh is in blcr-dkms 0.8.2-15ubuntu2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | #!/bin/sh
#
# Test of checkpoint/restart of a perl script.
# Note that the outer shell script is bash
. ${cr_testsdir:-`dirname $0`}/shellinit
\rm -f Context[123] .Context[123].tmp 2>/dev/null
bash <<-'__OUTER__'
exec 2>/dev/null # Drop job control message(s) from the outer script
echo '#ST_ALARM:120'
$cr_run perl 2>&1 <<-'__INNER__'
my $chkpt_cmd=$ENV{'cr_checkpoint'};
my $rstrt_cmd=$ENV{'cr_restart'};
sub checkpoint($$) {
my ($file, $pid) = @_;
my $cmd = "$chkpt_cmd --file=$file --tree --term $pid";
#print "# $cmd\n";
system("$cmd");
if ($pid != $$) { waitpid($pid, 0); }
sleep 1;
}
sub restart($) {
my ($file) = @_;
my $cmd = "$rstrt_cmd $file";
#print "# $cmd\n";
defined(my $pid = fork()) || die;
if (!$pid) { exec($cmd); exit(1); }
sleep 3;
$pid;
}
$|=1;
defined(my $pid = fork()) || die;
if (!$pid) { foreach $i (0..15) { print "$i Hello\n"; sleep 1;}; exit 0; }
sleep 3;
print "# Checkpoint original child\n";
checkpoint('Context1',$pid);
print "# Restart 1\n";
$pid = restart('Context1');
print "# Checkpoint restarted child\n";
checkpoint('Context2',$pid);
print "# Restart^2\n";
$pid = restart('Context2');
print "# Checkpoint self\n";
checkpoint('Context3',$$);
waitpid($pid, 0);
print "16 DONE\n";
__INNER__
exec 2>&1
sleep 3
echo "# Restart interpreter"
$cr_restart Context3
__OUTER__
\rm -f Context[123] .Context[123].tmp 2>/dev/null
|