2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-23 02:17:22 +00:00
KKrypt 34e2b02219 Optimized shell code with <'s (instead of cat + |)
This patch optimizes shell code as reading a single file as input using a 'cat' command to a program.

It is considered to be a Useless Use of Cat (UUOC).

It's more efficient to simply use redirection.

However, in some cases, even using the redirection operator '<' seems unnecessary.

Signed-off-by: KKrypt <sankalpacharya1211@gmail.com>
2023-04-15 21:17:21 -07:00

49 lines
819 B
Bash
Executable File

#!/bin/bash -x
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 -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 -D data -o restore.log -v4 --lib `pwd`/lib -d || exit 1
kill $pid
while :; do
grep PASS output && break
sleep 1
done
cat output
kill $srv_pid