Skip to content

Commit

Permalink
ci: do not use 'tail' for skip-file-rwx-check test
Browse files Browse the repository at this point in the history
Newer versions of 'tail' rely on inotify and after a restore 'tail' is
unhappy with the state of inotify and just stops.

This replaces 'tail' with a minimal test in C which just keeps a file
open to still be able to test how CRIU reacts if the file mode has
changed.

Signed-off-by: Adrian Reber <[email protected]>
  • Loading branch information
adrianreber committed Nov 30, 2023
1 parent 9d3e71a commit 2b8fe1e
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 8 deletions.
7 changes: 7 additions & 0 deletions test/others/skip-file-rwx-check/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dump.log
restore-expected-fail.log
restore.log
stats-dump
stats-restore
tester
testfile
7 changes: 5 additions & 2 deletions test/others/skip-file-rwx-check/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
.PHONY: run clean

run:
tester: tester.c
$(CC) -Wall $< -o $@

run: tester
./run.sh

clean:
rm -rf testfile *.img dump.log restore-expected-fail.log restore.log stats-dump stats-restore
rm -rf testfile *.img dump.log restore-expected-fail.log restore.log stats-dump stats-restore tester
13 changes: 7 additions & 6 deletions test/others/skip-file-rwx-check/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,22 @@ set -o xtrace
source ../env.sh

make clean
make tester
touch testfile
chmod +w testfile
tail --follow testfile &
tailpid=$!
if ! "$criu" dump --tree=$tailpid --shell-job --verbosity=4 --log-file=dump.log
./tester testfile &
testpid=$!
if ! "$criu" dump --tree=$testpid --shell-job --verbosity=4 --log-file=dump.log
then
kill $tailpid
kill $testpid
echo "Failed to dump process as expected"
echo FAIL
exit 1
fi
chmod -w testfile
if "$criu" restore --restore-detached --shell-job --verbosity=4 --log-file=restore-expected-fail.log
then
kill $tailpid
kill $testpid
echo "Unexpectedly restored process with reference to a file who's r/w/x perms changed when --skip-file-rwx-check option was not used"
echo FAIL
exit 1
Expand All @@ -33,5 +34,5 @@ then
echo FAIL
exit 1
fi
kill $tailpid
kill $testpid
echo PASS
10 changes: 10 additions & 0 deletions test/others/skip-file-rwx-check/tester.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include <fcntl.h>
#include <unistd.h>

int main(int argc, char *argv[])
{
open(argv[1], O_RDONLY | O_APPEND);

while(1)

Check warning on line 8 in test/others/skip-file-rwx-check/tester.c

View workflow job for this annotation

GitHub Actions / build

sleep(1);
}

0 comments on commit 2b8fe1e

Please sign in to comment.