mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 02:14:37 +00:00
Add --skip-file-rwx-check opt test
Add a simple test using tail to check that processes can't be restored by default when the r/w/x mode of an open file changes, unless --skip-file-rwx-check is used. Signed-off-by: Younes Manton <ymanton@ca.ibm.com>
This commit is contained in:
parent
18fba41255
commit
ad58553d90
4 changed files with 46 additions and 1 deletions
|
|
@ -260,6 +260,7 @@ if [ -n "$TRAVIS" ] || [ -n "$CIRCLECI" ]; then
|
|||
# Error (criu/tty.c:1014): tty: Don't have tty to inherit session from, aborting
|
||||
make -C test/others/shell-job/ run
|
||||
fi
|
||||
make -C test/others/skip-file-rwx-check/ run
|
||||
make -C test/others/rpc/ run
|
||||
|
||||
./test/zdtm.py run -t zdtm/static/env00 --sibling
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ all:
|
|||
$(MAKE) zdtm-freezer
|
||||
.PHONY: all
|
||||
|
||||
TESTS = unix-callback mem-snap rpc libcriu mounts/ext security pipes crit socketpairs overlayfs mnt-ext-dev shell-job
|
||||
TESTS = unix-callback mem-snap rpc libcriu mounts/ext security pipes crit socketpairs overlayfs mnt-ext-dev shell-job skip-file-rwx-check
|
||||
|
||||
other:
|
||||
for t in $(TESTS); do \
|
||||
|
|
|
|||
7
test/others/skip-file-rwx-check/Makefile
Normal file
7
test/others/skip-file-rwx-check/Makefile
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
.PHONY: run clean
|
||||
|
||||
run:
|
||||
./run.sh
|
||||
|
||||
clean:
|
||||
rm -rf testfile *.img dump.log restore-expected-fail.log restore.log stats-dump stats-restore
|
||||
37
test/others/skip-file-rwx-check/run.sh
Executable file
37
test/others/skip-file-rwx-check/run.sh
Executable file
|
|
@ -0,0 +1,37 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
set -o xtrace
|
||||
|
||||
source ../env.sh
|
||||
|
||||
make clean
|
||||
touch testfile
|
||||
chmod +w testfile
|
||||
tail --follow testfile &
|
||||
tailpid=$!
|
||||
if ! "$criu" dump --tree=$tailpid --shell-job --verbosity=4 --log-file=dump.log
|
||||
then
|
||||
kill $tailpid
|
||||
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
|
||||
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
|
||||
fi
|
||||
if ! "$criu" restore --skip-file-rwx-check --restore-detached --shell-job --verbosity=4 --log-file=restore.log
|
||||
then
|
||||
echo "Failed to restore process with reference to a file who's r/w/x perms changed when --skip-file-rwx-check option was used"
|
||||
echo FAIL
|
||||
exit 1
|
||||
fi
|
||||
kill $tailpid
|
||||
echo PASS
|
||||
Loading…
Add table
Add a link
Reference in a new issue