Commit f8d6dad7 authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

test/app-emu: wait while tasks are dying before starting restore

Otherwise some PID-s may be busy.
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent f2adcc41
#!/bin/bash
source ../../../functions.sh || exit 1
crtools="../../../../crtools"
cleanup_class() {
......@@ -24,6 +26,8 @@ ${crtools} dump -D dump -o dump.log -v 4 --shell-job -t ${pid} || {
exit 1
}
wait_tasks dump
echo "Dumped, restoring and waiting for completion"
${crtools} restore -D dump -o restore.log -v 4 --shell-job -t ${pid} || {
......
#!/bin/bash
source ../../functions.sh || exit 1
crtools="../../../crtools"
cleanup_wd() {
......@@ -35,6 +37,8 @@ ${crtools} dump --shell-job -D dump -o dump.log -v 4 -t ${pid} || {
exit 1
}
wait_tasks dump
echo "Dumped, restoring and waiting for completion"
${crtools} restore --shell-job -D dump -o restore.log -v 4 -t ${pid} || {
......
#!/bin/bash
source ../../functions.sh || exit 1
crtools="../../../crtools"
set -x
......@@ -17,6 +19,8 @@ ${crtools} dump -D dump -o dump.log -v 4 -t ${pid} || {
exit 1
}
wait_tasks dump
echo "Dumped, restoring and waiting for completion"
${crtools} restore -d -D dump -o restore.log -v 4 -t ${pid} || {
......
#!/bin/bash
source ../../functions.sh || exit 1
crtools="../../../crtools"
DEPTH=3
SPAN=5
......@@ -50,6 +52,7 @@ ${crtools} dump --shell-job -D dump -o dump.log -v 4 -t ${pid} || {
exit 1
}
wait_tasks dump
echo "Dump OK, restoring"
${crtools} restore --shell-job -D dump -o restore.log -v 4 -t ${pid} || {
......
set -m
source ../../functions.sh || exit 1
crtools="../../../crtools"
mkdir data
......@@ -13,6 +15,8 @@ $crtools dump -j --tcp-established -D data/ -o dump.log -v 4 -t $pid || {
exit 1
}
wait_tasks dump
$crtools restore -j --tcp-established -D data/ -d -o restore.log -v 4 -t $pid || {
echo "Restore failed"
exit 1
......
# Wait while tasks are dying, otherwise PIDs would be busy.
function wait_tasks()
{
local dump=$1
local pid
for i in $dump/core-*.img; do
pid=`expr "$i" : '.*/core-\([0-9]*\).img'`
while :; do
kill -0 $pid > /dev/null 2>&1 || break;
echo Waiting the process $pid
sleep 0.1
done
done
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment