mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 02:14:37 +00:00
ci: consolidate action-script tests
This patch consolidates the action-script tests into `test/others/action-script` to ensure all tests are executed consistently and reduce duplication. Since we had two tests that appear to do the same thing, we can remove the one that doesn't use zdtm.py. Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
This commit is contained in:
parent
d5c81f8108
commit
f824dc735b
8 changed files with 9 additions and 68 deletions
1
Makefile
1
Makefile
|
|
@ -451,6 +451,7 @@ ruff:
|
|||
test/zdtm.py \
|
||||
test/inhfd/*.py \
|
||||
test/others/rpc/config_file.py \
|
||||
test/others/action-script/check_actions.py \
|
||||
lib/pycriu/images/pb2dict.py \
|
||||
lib/pycriu/images/images.py \
|
||||
scripts/criu-ns \
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
# Check how crit de/encodes images
|
||||
set -e
|
||||
source `dirname $0`/criu-lib.sh
|
||||
# prep
|
||||
rm -f actions_called.txt
|
||||
./test/zdtm.py run -t zdtm/static/env00 --script "$(pwd)/test/show_action.sh" || fail
|
||||
./test/check_actions.py || fail
|
||||
exit 0
|
||||
2
test/others/action-script/.gitignore
vendored
2
test/others/action-script/.gitignore
vendored
|
|
@ -1 +1 @@
|
|||
img-dir-*
|
||||
actions_called.txt
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
run:
|
||||
@make -C .. loop
|
||||
./run.sh
|
||||
|
||||
.PHONY: run
|
||||
|
|
|
|||
|
|
@ -1,2 +0,0 @@
|
|||
#!/bin/bash
|
||||
touch action-hook-"$CRTOOLS_SCRIPT_ACTION"
|
||||
|
|
@ -1,60 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -ebm
|
||||
set -e
|
||||
|
||||
# shellcheck source=test/others/env.sh
|
||||
source ../env.sh || exit 1
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
|
||||
SELFDIR="$(dirname "$(readlink -f "$0")")"
|
||||
SCRIPT="$SELFDIR/action-script.sh"
|
||||
IMGDIR="$SELFDIR/img-dir-$$"
|
||||
rm -f "${SCRIPT_DIR}"/actions_called.txt
|
||||
"${SCRIPT_DIR}"/../../zdtm.py run -t zdtm/static/env00 --script "$SCRIPT_DIR/show_action.sh" || exit 1
|
||||
"${SCRIPT_DIR}"/check_actions.py || exit 1
|
||||
|
||||
rm -rf "$IMGDIR"
|
||||
mkdir "$IMGDIR"
|
||||
|
||||
trap "cleanup" QUIT TERM INT HUP EXIT
|
||||
|
||||
# shellcheck disable=SC2317
|
||||
# https://github.com/koalaman/shellcheck/issues/2660
|
||||
function cleanup()
|
||||
{
|
||||
if [[ -n "$PID" ]]; then
|
||||
kill -9 "$PID"
|
||||
fi
|
||||
}
|
||||
|
||||
PID=$(../loop)
|
||||
if ! $CRIU dump -v4 -o dump.log -t "$PID" -D "$IMGDIR" --action-script "$SCRIPT"; then
|
||||
echo "Failed to checkpoint process $PID"
|
||||
cat dump.log
|
||||
kill -9 "$PID"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! $CRIU restore -v4 -o restore.log -D "$IMGDIR" -d --pidfile test.pidfile --action-script "$SCRIPT"; then
|
||||
echo "CRIU restore failed"
|
||||
echo FAIL
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PID=$(cat "$IMGDIR"/test.pidfile)
|
||||
|
||||
found_missing_file=false
|
||||
hooks=("pre-dump" "post-dump" "pre-restore" "pre-resume" "post-restore" "post-resume")
|
||||
|
||||
for hook in "${hooks[@]}"
|
||||
do
|
||||
if [ ! -e "$IMGDIR/action-hook-$hook" ]; then
|
||||
echo "ERROR: action-hook-$hook does not exist"
|
||||
found_missing_file=true
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$found_missing_file" = true ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo PASS
|
||||
|
||||
rm -rf "$IMGDIR"
|
||||
exit 0
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo "${CRTOOLS_SCRIPT_ACTION} ${CRTOOLS_IMAGE_DIR} ${CRTOOLS_INIT_PID}" \
|
||||
>> "$(dirname $0)/actions_called.txt"
|
||||
>> "$(dirname "$0")/actions_called.txt"
|
||||
Loading…
Add table
Add a link
Reference in a new issue