Update to work with new user-cr command names, and on f11
PATCH 1/1 Update to work with new user-cr command names, and on f11
1. Several .c files to be checkpointed are changed to close all fds between 0 and 100. On F11, for some reason fds 4 and 5 now point to libnspr4.so, which for some reason doesn't want to be checkpointed.
2. user-cr now renames mktree to restart, rstr to restart_self, and ckpt to checkpoint. Stop using 'rstr' at all, just always use restart. (Though it might lead to regressions in restart_self)
Note that the previous commit will still be available in the 'mktree' branch of cr_tests.
Signed-off-by Serge Hallyn <serue-r/[email protected]>
--- common.sh | 26 ++++++++------------------ counterloop/cloop_once.sh | 10 +++++----- counterloop/cloop_parallel.sh | 8 ++++---- counterloop/cloop_serial.sh | 13 ++++++------- counterloop/crcounter.c | 7 +++---- fileio/fileio1.c | 3 ++- fileio/rstrsh | 4 ++-- fileio/runtests.sh | 4 ++-- futex/run.sh | 6 +++--- ipc/mktree.sh | 6 +++--- ipc/test-mq.sh | 8 ++++---- ipc/test-sem.sh | 12 ++++++------ ipc/test-shm.sh | 12 ++++++------ process-tree/pthread1.c | 2 +- process-tree/ptree1.c | 2 +- process-tree/run-pthread1.sh | 15 +++++++-------- process-tree/run-ptree1.sh | 15 +++++++-------- runall.sh | 14 ++++---------- simple/runtests.sh | 8 ++++---- sleep/runtest.sh | 9 ++++----- userns/run_depth.sh | 4 ++-- userns/run_sbits.sh | 4 ++-- userns/run_simple.sh | 4 ++-- userns/run_userns.sh | 4 ++-- userns/run_usertask.sh | 4 ++-- 25 files changed, 92 insertions(+), 112 deletions(-)
common.sh +8 -18
@@ -13,19 +13,14 @@ verify_freezer() verify_paths() { - which ckpt > /dev/null 2>&1 + which checkpoint > /dev/null 2>&1 if [ $? -ne 0 ]; then - echo "BROK: ckpt not in path" + echo "BROK: checkpoint not in path" exit 1 fi - which rstr > /dev/null 2>&1 + which restart > /dev/null 2>&1 if [ $? -ne 0 ]; then - echo "BROK: rstr not in path" - exit 1 - fi - which mktree > /dev/null 2>&1 - if [ $? -ne 0 ]; then - echo "BROK: mktree not in path" + echo "BROK: restart not in path" exit 1 fi }
@@ -82,18 +77,13 @@ settimer() timerpid=`jobs -p | tail -1` } -CKPT=`which ckpt` -if [ $? -ne 0 ]; then - echo "BROK: ckpt not found in your path" - exit 1 -fi -RSTR=`which rstr` +CHECKPOINT=`which checkpoint` if [ $? -ne 0 ]; then - echo "BROK: rstr not found in your path" + echo "BROK: checkpoint not found in your path" exit 1 fi -MKTREE=`which mktree` +RESTART=`which restart` if [ $? -ne 0 ]; then - echo "BROK: mktree not found in your path" + echo "BROK: restart not found in your path" exit 1 fi
counterloop/cloop_once.sh +5 -5
@@ -6,8 +6,8 @@ freezermountpoint=/cgroup -CKPT=`which ckpt` -RSTR=`which rstr` +CHECKPOINT=`which checkpoint` +RESTART=`which restart` DEBUG=0 my_debug()
@@ -59,7 +59,7 @@ pid=`pidof crcounter` freeze $pid pre=`cat counter_out` -$CKPT $pid > o.1 +$CHECKPOINT $pid > o.1 unfreeze $pid echo "sleeping for 7 seconds to let counter_out be incremented"
@@ -70,8 +70,8 @@ prekill=`cat counter_out` unfreeze $pid kill $pid -#../ns_exec -m $usercrdir/rstr < ./o.1 & -$RSTR < ./o.1 & +#../ns_exec -m $usercrdir/restart < ./o.1 & +$RESTART < ./o.1 & echo "sleeping for 4 seconds to inc counter_out by less than last time" sleep 4
counterloop/cloop_parallel.sh +4 -4
@@ -8,8 +8,8 @@ freezermountpoint=/cgroup source ../common.sh -CKPT=`which ckpt` -RSTR=`which rstr` +CHECKPOINT=`which checkpoint` +RESTART=`which restart` cleanup() {
@@ -44,7 +44,7 @@ do_checkpoint() pid=$1 cnt=$2 freeze $pid - $CKPT $pid > d.$cnt/ckpt.out + $CHECKPOINT $pid > d.$cnt/ckpt.out unfreeze $pid touch d.$cnt/ckptdone }
@@ -118,7 +118,7 @@ done echo Restarting all jobs in parallel for i in `seq 1 $NUMJOBS`; do - (cd d.$i; $RSTR < ckpt.out) & + (cd d.$i; $RESTART < ckpt.out) & done settimer 10
counterloop/cloop_serial.sh +6 -7
@@ -7,9 +7,8 @@ freezermountpoint=/cgroup -CKPT=`which ckpt` -RSTR=`which rstr` -MKTREE=`which mktree` +CHECKPOINT=`which checkpoint` +RESTART=`which restart` DEBUG=0 debug()
@@ -71,14 +70,14 @@ for cnt in `seq 1 $NUMLOOPS`; do exit 1 fi freeze $pid - $CKPT $pid > o.$cnt - echo ckpt returned $? + $CHECKPOINT $pid > o.$cnt + echo checkpoint returned $? kill -9 $pid unfreeze $pid - #../ns_exec -m $RSTR < ./o.$cnt & + #../ns_exec -m $RESTART < ./o.$cnt & wait $pid rm -f counter_out - $RSTR < ./o.$cnt & + $RESTART < ./o.$cnt & while [ ! -f counter_out ]; do : ; done done
counterloop/crcounter.c +3 -4
@@ -14,11 +14,10 @@ int main()int cnt=0 ;FILE *f;char fnam[20 ]; +int i; -close (0 ); -close (1 ); -close (2 ); -close (3 ); +for (i=0 ; i<100 ; i++) +close (i); f =fopen ("counter_out" ,"r" );if (!f) { cnt =1 ;
fileio/fileio1.c +2 -1
@@ -226,6 +226,7 @@ int main(int argc, char *argv[]) {int c;int fd; +int i;char *srcfile;char *destfile;enum test_mode mode;
@@ -244,7 +245,7 @@ int main(int argc, char *argv[])* Cannot checkpoint process with open device files yet; */ printf ("Closing stdio fds and writing messages to %s\n" ,LOG_FILE ); -close (0 );close (1 );close (2 ); +for (i=0 ; i<100 ; i++)close (i);/* * Announce that we are now prepared for a checkpoint
fileio/rstrsh +2 -2
@@ -1,3 +1,3 @@ #!/bin/sh -RSTR=`which rstr` -$RSTR < $1 +RESTART=`which restart` +$RESTART < $1
fileio/runtests.sh +2 -2
@@ -5,8 +5,8 @@ freezermountpoint=/cgroup CHECKPOINT="../" NS_EXEC="../ns_exec" -CR=`which ckpt` -RSTR=`which rstr` +CR=`which checkpoint` +RSTR=`which restart` SLOW_DOWN="slow-down-fileio" CKPT_FILE="ckpt-fileio1";
futex/run.sh +3 -3
@@ -70,7 +70,7 @@ while [ $CURTEST -lt $NUMTESTS ]; do sync cp log.${T} log.${T}.pre-ckpt err_msg="FAIL" - ckpt ${TEST_PID} > checkpoint-${T} + $CHECKPOINT ${TEST_PID} > checkpoint-${T} err_msg="BROK" thaw trap 'do_err; break' ERR EXIT
@@ -91,11 +91,11 @@ while [ $CURTEST -lt $NUMTESTS ]; do mv log.${T} log.${T}.post-ckpt cp log.${T}.pre-ckpt log.${T} err_msg="FAIL" - # We need to pass -p to mktree since futexes often store the + # We need to pass -p to restart since futexes often store the # pid of the task that owns the futex in the futex, even in # the uncontended cases where the kernel is entirely unaware # of the futex. --copy-status ensures that we trap on error. - ${MKTREE} -p --copy-status < checkpoint-${T} + ${RESTART} -p --copy-status < checkpoint-${T} retval=$? err_msg="BROK" mv log.${T} log.${T}.post-rstr
ipc/mktree.sh +3 -3
@@ -1,4 +1,4 @@ #!/bin/bash -MKTREE=`which mktree` -echo mktree.sh: running $MKTREE $1 -$MKTREE $1 +RESTART=`which restart` +echo mktree.sh: running $RESTART $1 +$RESTART $1
ipc/test-mq.sh +4 -4
@@ -22,7 +22,7 @@ do_checkpoint() { echo "failed to execute testcase" exit 2 fi - ckpt $pid > ckpt.msq + ${CHECKPOINT} $pid > ckpt.msq thaw killall check-mq }
@@ -32,7 +32,7 @@ clean_all ../ns_exec -ci ./check-mq & do_checkpoint # Restart it. If it finds the msq it created, it creates msq-ok -$MKTREE < ckpt.msq +$RESTART < ckpt.msq if [ ! -f sandbox/msq-ok ]; then echo "Fail: sysv msq was not re-created" exit 1
@@ -44,7 +44,7 @@ clean_all ../ns_exec -ci ./check-mq -u 501 & do_checkpoint # restart should fail to create msq -$MKTREE < ckpt.msq +$RESTART < ckpt.msq if [ -f sandbox/msq-ok ]; then echo "Fail: sysv msq was re-created" exit 1
@@ -57,7 +57,7 @@ clean_all ../ns_exec -ci ./check-mq -e -u 501 & do_checkpoint # restart should be able to create msq -$MKTREE < ckpt.msq +$RESTART < ckpt.msq if [ ! -f sandbox/msq-ok ]; then echo "Fail: sysv msq was not re-created" exit 1
ipc/test-sem.sh +6 -6
@@ -22,7 +22,7 @@ do_checkpoint() { echo "failed to execute testcase" exit 2 fi - ckpt $pid > ckpt.sem + ${CHECKPOINT} $pid > ckpt.sem thaw killall create-sem }
@@ -32,7 +32,7 @@ clean_all ../ns_exec -ci ./create-sem & do_checkpoint # Restart it. If it finds the sem it created, it creates sem-ok -$MKTREE < ckpt.sem +$RESTART < ckpt.sem if [ ! -f sandbox/sem-ok ]; then echo "Fail: sysv sem was not re-created" exit 1
@@ -44,7 +44,7 @@ clean_all ../ns_exec -ci ./create-sem -u 501 & do_checkpoint # restart should fail to create sems -$MKTREE < ckpt.sem +$RESTART < ckpt.sem if [ -f sandbox/sem-ok ]; then echo "Fail: sysv sem was re-created" exit 1
@@ -57,7 +57,7 @@ clean_all ../ns_exec -ci ./create-sem -e -u 501 & do_checkpoint # restart should be able to create sems -$MKTREE < ckpt.sem +$RESTART < ckpt.sem if [ ! -f sandbox/sem-ok ]; then echo "Fail: sysv sem was not re-created" exit 1
@@ -73,11 +73,11 @@ fi ../ns_exec -ci ./create-sem -r -u $uid & do_checkpoint chown $uid ckpt.sem -setcap cap_sys_admin+pe $MKTREE +setcap cap_sys_admin+pe $RESTART cat ckpt.sem | su ltp -c ./mktree.sh ckpt.sem if [ -f sandbox/sem-ok ]; then echo "Fail: uid $uid managed to recreate root-owned sems" exit 1 fi -setcap -r $MKTREE +setcap -r $RESTART echo "PASS: restart failed as it was supposed to"
ipc/test-shm.sh +6 -6
@@ -22,7 +22,7 @@ do_checkpoint() { echo "failed to execute testcase" exit 2 fi - ckpt $pid > ckpt.shm + ${CHECKPOINT} $pid > ckpt.shm thaw killall create-shm }
@@ -32,7 +32,7 @@ clean_all ../ns_exec -ci ./create-shm & do_checkpoint # Restart it. If it finds the shm it created, it creates shm-ok -$MKTREE < ckpt.shm +$RESTART < ckpt.shm if [ ! -f sandbox/shm-ok ]; then echo "Fail: sysv shm was not re-created" exit 1
@@ -44,7 +44,7 @@ clean_all ../ns_exec -ci ./create-shm -u 501 & do_checkpoint # restart should fail to create shm -$MKTREE < ckpt.shm +$RESTART < ckpt.shm if [ -f sandbox/shm-ok ]; then echo "Fail: sysv shm was re-created" exit 1
@@ -57,7 +57,7 @@ clean_all ../ns_exec -ci ./create-shm -e -u 501 & do_checkpoint # restart should be able to create shm -$MKTREE < ckpt.shm +$RESTART < ckpt.shm if [ ! -f sandbox/shm-ok ]; then echo "Fail: sysv shm was not re-created" exit 1
@@ -73,11 +73,11 @@ fi ../ns_exec -ci ./create-shm -r -u $uid & do_checkpoint chown $uid ckpt.shm -setcap cap_sys_admin+pe $MKTREE +setcap cap_sys_admin+pe $RESTART cat ckpt.shm | su ltp -c ./mktree.sh if [ -f sandbox/shm-ok ]; then echo "Fail: uid $uid managed to recreate root-owned shms" exit 1 fi -setcap -r $MKTREE +setcap -r $RESTART echo "PASS: restart failed as it was supposed to"
process-tree/pthread1.c +1 -1
@@ -105,7 +105,7 @@ main(int argc, char *argv[]) } }; -close (0 );close (1 );close (2 ); +for (i=0 ; i<100 ; i++)close (i); tid_list =create_threads (num_threads);
process-tree/ptree1.c +1 -1
@@ -176,7 +176,7 @@ main(int argc, char *argv[]) } }; -close (0 );close (1 );close (2 ); +for (i=0 ; i<100 ; i++)close (i);create_children (1 , id_str);
process-tree/run-pthread1.sh +7 -8
@@ -7,9 +7,8 @@ CHECKPOINT=".." # test to fail with "container not isolated" message due to the # log-file being shared between the application threads. # -CR="`which ckpt` --container" -RSTR=`which rstr` -MKTREE=`which mktree` +CHECKPOINT="`which checkpoint` --container" +RESTART=`which restart` ECHO="/bin/echo -e" TEST_CMD="./pthread1"
@@ -58,8 +57,8 @@ checkpoint() { local pid=$1 - $ECHO "Checkpoint: $CR $pid \> $CHECKPOINT_FILE" - $CR $pid > $CHECKPOINT_FILE + $ECHO "Checkpoint: $CHECKPOINT $pid \> $CHECKPOINT_FILE" + $CHECKPOINT $pid > $CHECKPOINT_FILE ret=$? if [ $ret -ne 0 ]; then $ECHO "***** FAIL: Checkpoint of $pid failed"
@@ -106,7 +105,7 @@ function restart_container { local ret; - cmdline="$MKTREE --pids --pidns --wait" + cmdline="$RESTART --pids --pidns --wait" $ECHO "\t- $cmdline" sleep 1
@@ -209,10 +208,10 @@ while [ $cnt -lt 15 ]; do $ECHO "\t- num_pids1 $num_pids1, num_pids2 $num_pids2"; # ns_exec pid is parent-pid of restarted-container-init - nspid=`pidof mktree` + nspid=`pidof restart` if [ "x$nspid" == "x" ]; then - $ECHO "***** FAIL: Can't find pid of $MKTREE" + $ECHO "***** FAIL: Can't find pid of $RESTART" exit 1; fi
process-tree/run-ptree1.sh +7 -8
@@ -3,9 +3,8 @@ freezermountpoint=/cgroup BASE_DIR=".." -CR=`which ckpt` -RSTR=`which rstr` -MKTREE=`which mktree` +CHECKPOINT=`which checkpoint` +RESTART=`which restart` FILEIO="../fileio/fileio1" ECHO="/bin/echo -e"
@@ -60,8 +59,8 @@ checkpoint() { local pid=$1 - $ECHO "Checkpoint: $CR $pid \> $CHECKPOINT_FILE" - $CR $pid > $CHECKPOINT_FILE + $ECHO "Checkpoint: $CHECKPOINT $pid \> $CHECKPOINT_FILE" + $CHECKPOINT $pid > $CHECKPOINT_FILE ret=$? if [ $ret -ne 0 ]; then $ECHO "***** FAIL: Checkpoint of $pid failed"
@@ -108,7 +107,7 @@ function restart_container { local ret; - cmdline="$MKTREE --pids --pidns --wait" + cmdline="$RESTART --pids --pidns --wait" $ECHO "\t- $cmdline" sleep 1
@@ -229,10 +228,10 @@ while [ $cnt -lt 15 ]; do $ECHO "\t- num_pids1 $num_pids1, num_pids2 $num_pids2"; # ns_exec pid is parent-pid of restarted-container-init - nspid=`pidof mktree` + nspid=`pidof restart` if [ "x$nspid" == "x" ]; then - $ECHO "***** FAIL: Can't find pid of $MKTREE" + $ECHO "***** FAIL: Can't find pid of $RESTART" exit 1; fi
runall.sh +4 -10
@@ -2,25 +2,19 @@ # Copyright 2009 IBM Corp. # Author: Serge Hallyn -which ckpt > /dev/null 2>&1 +which checkpoint > /dev/null 2>&1 if [ $? -ne 0 ]; then echo Please place ckpt from user-cr in your PATH exit 1 fi -which rstr > /dev/null 2>&1 +which restart > /dev/null 2>&1 if [ $? -ne 0 ]; then echo Please place rstr from user-cr in your PATH exit 1 fi -which mktree > /dev/null 2>&1 -if [ $? -ne 0 ]; then - echo Please place mktree from user-cr in your PATH - exit 1 -fi -export CKPT=`which ckpt` -export MKTREE=`which mktree` -export RSTR=`which rstr` +export CHECKPOINT=`which checkpoint` +export RESTART=`which restart` line=`grep freezer /proc/mounts` if [ $? -ne 0 ]; then
simple/runtests.sh +4 -4
@@ -2,7 +2,7 @@ # Copyright 2009 IBM Corp. # Author: Serge Hallyn -RSTR=`which rstr` +RESTART=`which restart` ./ckpt > out if [ ! -f /tmp/cr-test.out ]; then
@@ -21,14 +21,14 @@ if [ ! $v -gt 0 ]; then exit 3 fi -$RSTR < out +$RESTART < out v=`grep ret /tmp/cr-test.out | awk -F= '{ print $2 }'` if [ "x$v" == "x" ]; then - echo "FAIL - rstrt return value was not in /tmp/cr-test.out" + echo "FAIL - restart return value was not in /tmp/cr-test.out" exit 4 fi if [ $v -ne 0 ]; then - echo "FAIL - rstrt return value was $v, should be == 0" + echo "FAIL - restart return value was $v, should be == 0" exit 5 fi echo PASS
sleep/runtest.sh +4 -5
@@ -13,9 +13,8 @@ fi freezermountpoint=`echo $line | awk '{ print $2 '}` mkdir $freezermountpoint/1 > /dev/null 2>&1 -MKTREE=`which mktree` -CKPT=`which ckpt` -RSTR=`which rstr` +RESTART=`which restart` +CHECKPOINT=`which checkpoint` freeze() {
@@ -32,10 +31,10 @@ killall sleeptest > /dev/null 2>&1 ./sleeptest & sleep 1 freeze -$CKPT `pidof sleeptest` > o.sleep +$CHECKPOINT `pidof sleeptest` > o.sleep thaw killall sleeptest -$MKTREE --pids < o.sleep & +$RESTART --pids < o.sleep & sleep 1 pidof sleeptest if [ $? -ne 0 ]; then
userns/run_depth.sh +2 -2
@@ -15,12 +15,12 @@ canceltimer job=`jobs -p | head -1` freeze echo "Checkpointing job $job" -$CKPT $job > o.deep +$CHECKPOINT $job > o.deep thaw killall userns_deep echo "Restarting jobs" -$MKTREE < o.deep & +$RESTART < o.deep & touch sandbox/go touch sandbox/die
userns/run_sbits.sh +2 -2
@@ -23,10 +23,10 @@ do_yer_thang() exit 1 fi; freeze - $CKPT $pid > out.$pid + $CHECKPOINT $pid > out.$pid thaw killall sbits - $RSTR < out.$pid & + $RESTART < out.$pid & touch checkpointed settimer 5
userns/run_simple.sh +2 -2
@@ -14,12 +14,12 @@ canceltimer job=`jobs -p | head -1` freeze echo "Checkpointing job $job" -$CKPT $job > o.simple +$CHECKPOINT $job > o.simple thaw killall simple_deep echo "Restarting jobs" -$MKTREE < o.simple & +$RESTART < o.simple & touch sandbox/go touch sandbox/die
userns/run_userns.sh +2 -2
@@ -15,12 +15,12 @@ canceltimer job=`jobs -p|head -1` freeze echo "Checkpointing job $job" -$CKPT $job > o.userns +$CHECKPOINT $job > o.userns thaw killall userns_ckptme echo "Restarting jobs" -$MKTREE < o.userns & +$RESTART < o.userns & touch sandbox/go touch sandbox/die
userns/run_usertask.sh +2 -2
@@ -26,10 +26,10 @@ canceltimer pid=`pidof usertask` freeze -$CKPT $pid > ckpt.out +$CHECKPOINT $pid > ckpt.out thaw kill -9 $pid -$RSTR < ckpt.out & +$RESTART < ckpt.out & touch sandbox/go settimer 5
Signature · 1 line
1.6.2.5