Docker/oci and thus gitlab-runner, default to a root user inside the namespace, even if its an unprivileged one. This can cause issues and let permission bugs sneak in, as we are functionally root when running the build. Switch the build jobs to run with our new "containeruser" so we avoid much of it. Our user is still in the wheel/sudo group but that's fine as long we don't elevate the privileges unintentionally. Noticeably for the time being, we will need to chown the CI_PROJECT_DIR checkout as the gitlab runner might try to reuse pre-existing and cached volumes of the project checkout. Additionally we need to change the ccache path, so we will avoid the existing cache owned by "root". Close https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2433 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8763>
76 lines
1.8 KiB
Bash
Executable File
76 lines
1.8 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Based on the virtme-run.sh script from the Mutter project:
|
|
# https://gitlab.gnome.org/GNOME/mutter/-/blob/main/src/tests/kvm/virtme-run.sh
|
|
#
|
|
# Run fluster tests in a virtual machine using virtme-ng.
|
|
#
|
|
# $1: A Linux kernel image
|
|
# $2: The test build dir
|
|
# $3: GStreamer source dir
|
|
# $4: The decoder to be run in [vp8, vp9, h.264, h.265, av1]
|
|
# ($@: The test vectors to be skipped)
|
|
|
|
set -e
|
|
|
|
DIRNAME="$(dirname "$0")"
|
|
IMAGE="$1"
|
|
MESON_BUILD_DIR="$2"
|
|
MESON_SOURCE_DIR="$3"
|
|
DECODER="${4}"
|
|
|
|
shift
|
|
shift
|
|
shift
|
|
shift
|
|
|
|
SKIPPED="$@"
|
|
|
|
if [ ! -z "${SKIPPED}" ]; then
|
|
sv="-sv ${SKIPPED}"
|
|
fi
|
|
|
|
TEST_RESULT_FILE=$(mktemp -p "$MESON_BUILD_DIR" -t test-result-XXXXXX)
|
|
echo 1 > "$TEST_RESULT_FILE"
|
|
|
|
VIRTME_ENV="\
|
|
MESON_BUILD_DIR=${MESON_BUILD_DIR} \
|
|
"
|
|
|
|
TEST_SUITES_DIR="${MESON_SOURCE_DIR}/ci/fluster/visl_references"
|
|
|
|
FLUSTER_PATH=/opt/fluster
|
|
TEST_COMMAND="${FLUSTER_PATH}/fluster.py -tsd ${TEST_SUITES_DIR} run -d GStreamer-${DECODER}-V4L2SL-Gst1.0 -f junitxml -so $MESON_BUILD_DIR/fluster-results-${DECODER}.xml ${sv} -t 60"
|
|
|
|
SCRIPT="\
|
|
env $VIRTME_ENV $DIRNAME/run-virt-test.sh \
|
|
\\\"$TEST_COMMAND\\\" \
|
|
\\\"$TEST_RESULT_FILE\\\" \
|
|
"
|
|
|
|
HALF_MEMORY="$(grep MemTotal /proc/meminfo | awk '{print $2}' | xargs -I {} echo "scale=0; 1+{}/1024^2/2" | bc)G"
|
|
|
|
echo Running tests in virtual machine ...
|
|
sudo virtme-run \
|
|
--memory=${HALF_MEMORY} \
|
|
--rw \
|
|
--pwd \
|
|
--kimg "$IMAGE" \
|
|
--script-sh "sh -c \"$SCRIPT\"" \
|
|
-a visl.stable_output=true \
|
|
-a visl.codec_variability=true \
|
|
--show-boot-console --show-command --force-9p \
|
|
--qemu-opts -cpu host,pdcm=off -smp 8
|
|
VM_RESULT=$?
|
|
if [ $VM_RESULT != 0 ]; then
|
|
echo Virtual machine exited with a failure: $VM_RESULT
|
|
else
|
|
echo Virtual machine terminated.
|
|
fi
|
|
TEST_RESULT="$(cat "$TEST_RESULT_FILE")"
|
|
|
|
echo Test result exit status: $TEST_RESULT
|
|
|
|
rm "$TEST_RESULT_FILE"
|
|
exit "$TEST_RESULT"
|