cr_tests/ptree1: remove dead code
PATCH 1/4 cr_tests/ptree1: remove dead code
The return status of a background command (e.g. "ls &") is always 0. Failure to restart can't be detected this way.
--- process-tree/run-ptree1.sh | 7 ------- 1 files changed, 0 insertions(+), 7 deletions(-)
process-tree/run-ptree1.sh +0 -7
@@ -90,13 +90,6 @@ function restart_container sleep 1 $cmdline < $CHECKPOINT_FILE >> $SCRIPT_LOG 2>&1 & - ret=$? - - if [ $ret -ne 0 ]; then - $ECHO "***** FAIL: Restart of $pid failed" - ps aux |grep $TEST_CMD >> $SCRIPT_LOG - exit 1; - fi } function wait_for_checkpoint_ready()
Signature · 1 line
1.6.0.6
A message that is not in the archive (sent off-list or not yet received): 1267213914-32219-1-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org
PATCH 2/4 cr_tests/ptree1: count tasks accurately
"ps aux |grep $TEST_CMD | wc -l" tends to also count the grep process. The test script already assumes pidof is available, so just use that.
--- process-tree/run-ptree1.sh | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
process-tree/run-ptree1.sh +2 -2
@@ -174,7 +174,7 @@ while [ $cnt -lt 15 ]; do freezerdir=$freezermountpoint/$pid freeze_pid $pid - num_pids1=`ps aux |grep $TEST_CMD | wc -l` + num_pids1=`pidof $TEST_CMD | wc -w` create_fs_snapshot
@@ -196,7 +196,7 @@ while [ $cnt -lt 15 ]; do sleep 3; - num_pids2=`ps aux |grep $TEST_CMD | wc -l` + num_pids2=`pidof $TEST_CMD | wc -w` ps aux |grep $TEST_CMD >> $SCRIPT_LOG $ECHO "\t- num_pids1 $num_pids1, num_pids2 $num_pids2";
Signature · 1 line
1.6.0.6
A message that is not in the archive (sent off-list or not yet received): 1267213914-32219-2-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org
Matt Helsley
Acked-byRe: [PATCH 2/4] cr_tests/ptree1: count tasks accurately
Quoted 4 lines · Nathan Lynch
"ps aux |grep $TEST_CMD | wc -l" tends to also count the grep process. The test script already assumes pidof is available, so just use that.
Signed-off-by Nathan Lynch <[email protected]>
Quoted 33 lines
--- process-tree/run-ptree1.sh | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)process-tree/run-ptree1.sh +2
-2@@ -174,7 +174,7 @@ while [ $cnt -lt 15 ]; do freezerdir=$freezermountpoint/$pid freeze_pid $pid - num_pids1=`ps aux |grep $TEST_CMD | wc -l` + num_pids1=`pidof $TEST_CMD | wc -w` create_fs_snapshot@@ -196,7 +196,7 @@ while [ $cnt -lt 15 ]; do sleep 3; - num_pids2=`ps aux |grep $TEST_CMD | wc -l` + num_pids2=`pidof $TEST_CMD | wc -w` ps aux |grep $TEST_CMD >> $SCRIPT_LOG $ECHO "\t- num_pids1 $num_pids1, num_pids2 $num_pids2";Signature · 6 lines
1.6.0.6 _______________________________________________ Containers mailing list Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org https://lists.linux-foundation.org/mailman/listinfo/containers
PATCH 3/4 cr_tests/ptree1: wait for background tasks to exit
In reply to a message not in the archiveIt is more reliable and usually faster to wait for the shell's notification that background tasks have exited than it is to assume they have exited after three seconds have passed.
--- process-tree/run-ptree1.sh | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
process-tree/run-ptree1.sh +1 -1
@@ -188,7 +188,7 @@ while [ $cnt -lt 15 ]; do thaw - sleep 3 + wait restore_fs_snapshot
Signature · 1 line
1.6.0.6
A message that is not in the archive (sent off-list or not yet received): 1267213914-32219-3-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org
Re: [PATCH 3/4] cr_tests/ptree1: wait for background tasks to exit
Quoted 3 lines · Nathan Lynch
It is more reliable and usually faster to wait for the shell's notification that background tasks have exited than it is to assume they have exited after three seconds have passed.
Yes, a wait should normally do the trick here.
What happens if thaw fails and the task to wait for is still frozen? We'd need a "wait or timeout" here to gracefully handle that. However, I suppose it's arguable whether thaw failing is worth worrying about here...
Cheers,
-Matt Helsley
Quoted 26 lines
Signed-off-by Nathan Lynch <[email protected]>--- process-tree/run-ptree1.sh | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)process-tree/run-ptree1.sh +1
-1@@ -188,7 +188,7 @@ while [ $cnt -lt 15 ]; do thaw - sleep 3 + wait restore_fs_snapshotSignature · 6 lines
1.6.0.6 _______________________________________________ Containers mailing list Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org https://lists.linux-foundation.org/mailman/listinfo/containers
A message that is not in the archive (sent off-list or not yet received): 20100226205659.GE20106-52DBMbEzqgQ/wnmkkaCWp/[email protected]
Re: [PATCH 3/4] cr_tests/ptree1: wait for background tasks to exit
Quoted 11 lines · Matt Helsley
Quoted 3 lines · Nathan Lynch
It is more reliable and usually faster to wait for the shell's notification that background tasks have exited than it is to assume they have exited after three seconds have passed.
Yes, a wait should normally do the trick here.
What happens if thaw fails and the task to wait for is still frozen? We'd need a "wait or timeout" here to gracefully handle that. However, I suppose it's arguable whether thaw failing is worth worrying about here...
I think it's not, unless this scenario could occur in the absence of kernel or testcase bugs?
PATCH 4/4 cr_tests/ptree1: remove gratuitous sleeps
In reply to a message not in the archiveThese 1-second sleeps don't accomplish anything.
--- process-tree/run-ptree1.sh | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-)
process-tree/run-ptree1.sh +0 -4
@@ -87,8 +87,6 @@ function restart_container cmdline="$RESTART --pids --pidns --wait" $ECHO "\t- $cmdline" - sleep 1 - $cmdline < $CHECKPOINT_FILE >> $SCRIPT_LOG 2>&1 & }
@@ -178,8 +176,6 @@ while [ $cnt -lt 15 ]; do create_fs_snapshot - sleep 1; - checkpoint $pid touch $CHECKPOINT_DONE
Signature · 1 line
1.6.0.6
A message that is not in the archive (sent off-list or not yet received): 1267213914-32219-4-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org
Matt Helsley
Acked-byRe: [PATCH 4/4] cr_tests/ptree1: remove gratuitous sleeps
Quoted 1 line · Nathan Lynch
These 1-second sleeps don't accomplish anything.
Quoted 35 lines
Signed-off-by Nathan Lynch <[email protected]>--- process-tree/run-ptree1.sh | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-)process-tree/run-ptree1.sh +0
-4@@ -87,8 +87,6 @@ function restart_container cmdline="$RESTART --pids --pidns --wait" $ECHO "\t- $cmdline" - sleep 1 - $cmdline < $CHECKPOINT_FILE >> $SCRIPT_LOG 2>&1 & }@@ -178,8 +176,6 @@ while [ $cnt -lt 15 ]; do create_fs_snapshot - sleep 1; - checkpoint $pid touch $CHECKPOINT_DONESignature · 6 lines
1.6.0.6 _______________________________________________ Containers mailing list Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org https://lists.linux-foundation.org/mailman/listinfo/containers