diff options
Diffstat (limited to 'lib/mesa/.gitlab-ci/crosvm-init.sh')
-rwxr-xr-x | lib/mesa/.gitlab-ci/crosvm-init.sh | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/lib/mesa/.gitlab-ci/crosvm-init.sh b/lib/mesa/.gitlab-ci/crosvm-init.sh index 63124fe0f..15e68f835 100755 --- a/lib/mesa/.gitlab-ci/crosvm-init.sh +++ b/lib/mesa/.gitlab-ci/crosvm-init.sh @@ -1,27 +1,42 @@ #!/bin/sh -set -ex +set -e + +VSOCK_STDOUT=$1 +VSOCK_STDERR=$2 +VSOCK_TEMP_DIR=$3 mount -t proc none /proc mount -t sysfs none /sys -mount -t devtmpfs none /dev || echo possibly already mounted mkdir -p /dev/pts mount -t devpts devpts /dev/pts mount -t tmpfs tmpfs /tmp -. /crosvm-env.sh +. ${VSOCK_TEMP_DIR}/crosvm-env.sh -# / is ro -export PIGLIT_REPLAY_EXTRA_ARGS="$PIGLIT_REPLAY_EXTRA_ARGS --db-path /tmp/replayer-db" +# .gitlab-ci.yml script variable is using relative paths to install directory, +# so change to that dir before running `crosvm-script` +cd "${CI_PROJECT_DIR}" -if sh $CROSVM_TEST_SCRIPT; then - touch /results/success -fi +# The exception is the dEQP binary, as it needs to run from its own directory +[ -z "${DEQP_BIN_DIR}" ] || cd "${DEQP_BIN_DIR}" -sleep 5 # Leave some time to get the last output flushed out +# Use a FIFO to collect relevant error messages +STDERR_FIFO=/tmp/crosvm-stderr.fifo +mkfifo -m 600 ${STDERR_FIFO} -poweroff -d -n -f || true +dmesg --level crit,err,warn -w > ${STDERR_FIFO} & +DMESG_PID=$! + +# Transfer the errors and crosvm-script output via a pair of virtio-vsocks +socat -d -u pipe:${STDERR_FIFO} vsock-listen:${VSOCK_STDERR} & +socat -d -U vsock-listen:${VSOCK_STDOUT} \ + system:"stdbuf -eL sh ${VSOCK_TEMP_DIR}/crosvm-script.sh 2> ${STDERR_FIFO}; echo \$? > ${VSOCK_TEMP_DIR}/exit_code",nofork -sleep 10 # Just in case init would exit before the kernel shuts down the VM +kill ${DMESG_PID} +wait + +sync +poweroff -d -n -f || true -exit 1 +sleep 1 # Just in case init would exit before the kernel shuts down the VM |