2021-12-10 17:49:48 -05:00
|
|
|
#!/usr/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
DIRNAME="$(dirname "$0")"
|
|
|
|
IMAGE="$1"
|
|
|
|
WRAPPER="$2"
|
|
|
|
WRAPPER_ARGS="$3"
|
|
|
|
TEST_EXECUTABLE="$4"
|
|
|
|
TEST_BUILD_DIR="$5"
|
2022-02-09 04:47:50 -05:00
|
|
|
VM_ENV="$6"
|
2021-12-10 17:49:48 -05:00
|
|
|
|
|
|
|
TEST_RESULT_FILE=$(mktemp -p "$TEST_BUILD_DIR" -t test-result-XXXXXX)
|
|
|
|
echo 1 > "$TEST_RESULT_FILE"
|
|
|
|
|
2022-01-25 10:37:05 -05:00
|
|
|
VIRTME_ENV="\
|
|
|
|
HOME=$HOME \
|
|
|
|
LD_LIBRARY_PATH=$LD_LIBRARY_PATH \
|
|
|
|
XDG_DATA_DIRS=$XDG_DATA_DIRS \
|
2022-02-09 04:47:50 -05:00
|
|
|
$VM_ENV \
|
2022-01-25 10:37:05 -05:00
|
|
|
"
|
|
|
|
|
2021-06-28 05:51:57 -04:00
|
|
|
if [ ! -v $MUTTER_DEBUG_FORCE_KMS_MODE ]; then
|
|
|
|
VIRTME_ENV="$VIRTME_ENV MUTTER_DEBUG_FORCE_KMS_MODE=$MUTTER_DEBUG_FORCE_KMS_MODE"
|
|
|
|
fi
|
|
|
|
|
2022-02-09 04:50:43 -05:00
|
|
|
if [[ "$(stat -c '%t:%T' -L /proc/$$/fd/0)" == "0:0" ]]; then
|
|
|
|
mkfifo $XDG_RUNTIME_DIR/fake-stdin.$$
|
|
|
|
exec 0<> $XDG_RUNTIME_DIR/fake-stdin.$$
|
|
|
|
rm -f $XDG_RUNTIME_DIR/fake-stdin.$$
|
|
|
|
fi
|
|
|
|
|
2021-12-10 17:49:48 -05:00
|
|
|
virtme-run \
|
|
|
|
--memory=256M \
|
|
|
|
--rw \
|
|
|
|
--pwd \
|
|
|
|
--kimg "$IMAGE" \
|
2022-02-09 04:54:17 -05:00
|
|
|
--script-sh "sh -c \"env $VIRTME_ENV $DIRNAME/run-kvm-test.sh \\\"$WRAPPER\\\" \\\"$WRAPPER_ARGS\\\" \\\"$TEST_EXECUTABLE\\\" \\\"$TEST_RESULT_FILE\\\"\"" \
|
2022-02-09 04:56:02 -05:00
|
|
|
--qemu-opts -cpu host,pdcm=off -smp 2
|
2021-12-10 17:49:48 -05:00
|
|
|
|
|
|
|
TEST_RESULT="$(cat "$TEST_RESULT_FILE")"
|
|
|
|
rm "$TEST_RESULT_FILE"
|
|
|
|
|
|
|
|
exit "$TEST_RESULT"
|