Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/checkpoint-restore/criu.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRadostin Stoyanov <rstoyanov@fedoraproject.org>2021-06-09 10:13:00 +0300
committerAndrei Vagin <avagin@gmail.com>2021-09-03 20:31:00 +0300
commit2aa4185a6c3e2a699a76696fb1737e0303a29de0 (patch)
tree6b4f45a4b8567b5126b13e297d858caec0e09e07 /test/others/crit
parent2b78d95e6b3861a1051c960d462d00cad6f7f091 (diff)
test/others: refactor loop process
There are several problems with the loop.sh script. First, the code is duplicated across tests in the so-called 'othres' category. Second, we need to run it with the 'setsid' utility to make sure that it runs in a new session. Third, we have to redirect the standard file descriptors and use the '&' operator to make it run in the background. Finally, obtaining the PID of the 'loop.sh' process resulted in race condition. In this patch we replace the loop.sh script with a program that would address all problems mentioned above. The requirements for this program are as follows. - It must be reusable across tests - It must start a process that is detached from the current shell - It must wait for the process to start and output its PID Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
Diffstat (limited to 'test/others/crit')
-rw-r--r--test/others/crit/Makefile1
-rwxr-xr-xtest/others/crit/loop.sh4
-rwxr-xr-xtest/others/crit/test.sh3
3 files changed, 2 insertions, 6 deletions
diff --git a/test/others/crit/Makefile b/test/others/crit/Makefile
index 75d09b66c..ca296e333 100644
--- a/test/others/crit/Makefile
+++ b/test/others/crit/Makefile
@@ -1,4 +1,5 @@
run: clean
+ @make -C .. loop
./test.sh
clean:
diff --git a/test/others/crit/loop.sh b/test/others/crit/loop.sh
deleted file mode 100755
index 0ab34ce96..000000000
--- a/test/others/crit/loop.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-while :; do
- sleep 1
-done
diff --git a/test/others/crit/test.sh b/test/others/crit/test.sh
index 345f8ce04..0d38043d7 100755
--- a/test/others/crit/test.sh
+++ b/test/others/crit/test.sh
@@ -8,8 +8,7 @@ source ../env.sh
images_list=""
function gen_imgs {
- setsid ./loop.sh < /dev/null &> /dev/null &
- PID=$!
+ PID=$(../loop)
if ! $CRIU dump -v4 -o dump.log -D ./ -t "$PID"; then
echo "Failed to checkpoint process $PID"
cat dump.log