2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-22 18:07:57 +00:00
Andrey Vagin 1e4b8c8c23 tests: check callback-s for dumping and restoring sockets (v2)
Here are client, server programs and two libraries for dumping client
sockets and syslog socket.

The client can ask server to save a value and then request it later.
We suppose that after dumping and restoring the client will get
the same value.

So the dump callback requests the value and save it in a file.
The restore callback creates a new socket and ask server to save the
value from the file.

v2: open a syslog socket

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-12-20 15:28:53 +04:00

49 lines
846 B
Bash
Executable File

#!/bin/bash
cd `dirname $0`
source ../env.sh || exit 1
rm -rf /tmp/criu.unix.callback.test*
test -f pid && unlink pid
test -f output && unlink output
rm -rf data
mkdir -p data
./unix-server &
srv_pid=$!
for i in `seq 20`; do
test -f /tmp/criu.unix.callback.test && break
sleep 0.1
done
( setsid ./unix-client < /dev/null &> output ) &
while :; do
test -f pid && break
sleep 1
done
pid=`cat pid`
${CRIU} dump --shell-job -D data -o dump.log -v4 --lib `pwd`/lib -t $pid || exit 1
kill $srv_pid
wait $srv_pid
unlink /tmp/criu.unix.callback.test
./unix-server &
srv_pid=$!
for i in `seq 20`; do
test -f /tmp/criu.unix.callback.test && break
sleep 0.1
done
${CRIU} restore --shell-job -D data -o restore.log -v4 --lib `pwd`/lib -d || exit 1
kill $pid
while :; do
cat output | grep PASS && break
sleep 1
done
cat output
kill $srv_pid