mirror of
https://gitee.com/openharmony/third_party_mesa3d
synced 2024-11-23 07:19:50 +00:00
ci/crosvm: Rename VSOCK_TEMP_DIR -> VM_TEMP_DIR.
It doesn't contain anything about the vsocks, just files shared between the host and the guest. Reviewed-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16485>
This commit is contained in:
parent
b836cd937c
commit
b82f920384
@ -4,7 +4,7 @@ set -e
|
|||||||
|
|
||||||
VSOCK_STDOUT=$1
|
VSOCK_STDOUT=$1
|
||||||
VSOCK_STDERR=$2
|
VSOCK_STDERR=$2
|
||||||
VSOCK_TEMP_DIR=$3
|
VM_TEMP_DIR=$3
|
||||||
|
|
||||||
mount -t proc none /proc
|
mount -t proc none /proc
|
||||||
mount -t sysfs none /sys
|
mount -t sysfs none /sys
|
||||||
@ -12,7 +12,7 @@ mkdir -p /dev/pts
|
|||||||
mount -t devpts devpts /dev/pts
|
mount -t devpts devpts /dev/pts
|
||||||
mount -t tmpfs tmpfs /tmp
|
mount -t tmpfs tmpfs /tmp
|
||||||
|
|
||||||
. ${VSOCK_TEMP_DIR}/crosvm-env.sh
|
. ${VM_TEMP_DIR}/crosvm-env.sh
|
||||||
|
|
||||||
# .gitlab-ci.yml script variable is using relative paths to install directory,
|
# .gitlab-ci.yml script variable is using relative paths to install directory,
|
||||||
# so change to that dir before running `crosvm-script`
|
# so change to that dir before running `crosvm-script`
|
||||||
@ -31,7 +31,7 @@ DMESG_PID=$!
|
|||||||
# Transfer the errors and crosvm-script output via a pair of virtio-vsocks
|
# 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 pipe:${STDERR_FIFO} vsock-listen:${VSOCK_STDERR} &
|
||||||
socat -d -U vsock-listen:${VSOCK_STDOUT} \
|
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
|
system:"stdbuf -eL sh ${VM_TEMP_DIR}/crosvm-script.sh 2> ${STDERR_FIFO}; echo \$? > ${VM_TEMP_DIR}/exit_code",nofork
|
||||||
|
|
||||||
kill ${DMESG_PID}
|
kill ${DMESG_PID}
|
||||||
wait
|
wait
|
||||||
|
@ -21,7 +21,7 @@ THREAD=${DEQP_RUNNER_THREAD:-0}
|
|||||||
# - VSOCK_STDOUT, VSOCK_STDERR: the port numbers the guest should accept
|
# - VSOCK_STDOUT, VSOCK_STDERR: the port numbers the guest should accept
|
||||||
# vsock connections on in order to transfer output messages
|
# vsock connections on in order to transfer output messages
|
||||||
#
|
#
|
||||||
# - VSOCK_TEMP_DIR: the temporary directory path used to pass additional
|
# - VM_TEMP_DIR: the temporary directory path used to pass additional
|
||||||
# context data towards the guest
|
# context data towards the guest
|
||||||
#
|
#
|
||||||
set_vsock_context() {
|
set_vsock_context() {
|
||||||
@ -30,8 +30,8 @@ set_vsock_context() {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
VSOCK_TEMP_DIR="/tmp-vsock.${THREAD}"
|
VM_TEMP_DIR="/tmp-vm.${THREAD}"
|
||||||
mkdir $VSOCK_TEMP_DIR || return 1
|
mkdir $VM_TEMP_DIR || return 1
|
||||||
|
|
||||||
VSOCK_CID=$(((CI_JOB_ID & 0x1ffffff) | ((${THREAD} & 0x7f) << 25)))
|
VSOCK_CID=$(((CI_JOB_ID & 0x1ffffff) | ((${THREAD} & 0x7f) << 25)))
|
||||||
VSOCK_STDOUT=5001
|
VSOCK_STDOUT=5001
|
||||||
@ -50,15 +50,15 @@ set_vsock_context || { echo "Could not generate crosvm vsock CID" >&2; exit 1; }
|
|||||||
|
|
||||||
# Ensure cleanup on script exit
|
# Ensure cleanup on script exit
|
||||||
trap 'exit ${exit_code}' INT TERM
|
trap 'exit ${exit_code}' INT TERM
|
||||||
trap 'exit_code=$?; [ -z "${CROSVM_PID}${SOCAT_PIDS}" ] || kill ${CROSVM_PID} ${SOCAT_PIDS} >/dev/null 2>&1 || true; rm -rf ${VSOCK_TEMP_DIR}' EXIT
|
trap 'exit_code=$?; [ -z "${CROSVM_PID}${SOCAT_PIDS}" ] || kill ${CROSVM_PID} ${SOCAT_PIDS} >/dev/null 2>&1 || true; rm -rf ${VM_TEMP_DIR}' EXIT
|
||||||
|
|
||||||
# Securely pass the current variables to the crosvm environment
|
# Securely pass the current variables to the crosvm environment
|
||||||
echo "Variables passed through:"
|
echo "Variables passed through:"
|
||||||
SCRIPT_DIR=$(readlink -en "${0%/*}")
|
SCRIPT_DIR=$(readlink -en "${0%/*}")
|
||||||
${SCRIPT_DIR}/common/generate-env.sh | tee ${VSOCK_TEMP_DIR}/crosvm-env.sh
|
${SCRIPT_DIR}/common/generate-env.sh | tee ${VM_TEMP_DIR}/crosvm-env.sh
|
||||||
|
|
||||||
# Set the crosvm-script as the arguments of the current script
|
# Set the crosvm-script as the arguments of the current script
|
||||||
echo "$@" > ${VSOCK_TEMP_DIR}/crosvm-script.sh
|
echo "$@" > ${VM_TEMP_DIR}/crosvm-script.sh
|
||||||
|
|
||||||
# Setup networking
|
# Setup networking
|
||||||
/usr/sbin/iptables-legacy -w -t nat -A POSTROUTING -o eth0 -j MASQUERADE
|
/usr/sbin/iptables-legacy -w -t nat -A POSTROUTING -o eth0 -j MASQUERADE
|
||||||
@ -75,7 +75,7 @@ unset DISPLAY
|
|||||||
unset XDG_RUNTIME_DIR
|
unset XDG_RUNTIME_DIR
|
||||||
|
|
||||||
CROSVM_KERN_ARGS="quiet console=null root=my_root rw rootfstype=virtiofs ip=192.168.30.2::192.168.30.1:255.255.255.0:crosvm:eth0"
|
CROSVM_KERN_ARGS="quiet console=null root=my_root rw rootfstype=virtiofs ip=192.168.30.2::192.168.30.1:255.255.255.0:crosvm:eth0"
|
||||||
CROSVM_KERN_ARGS="${CROSVM_KERN_ARGS} init=${SCRIPT_DIR}/crosvm-init.sh -- ${VSOCK_STDOUT} ${VSOCK_STDERR} ${VSOCK_TEMP_DIR}"
|
CROSVM_KERN_ARGS="${CROSVM_KERN_ARGS} init=${SCRIPT_DIR}/crosvm-init.sh -- ${VSOCK_STDOUT} ${VSOCK_STDERR} ${VM_TEMP_DIR}"
|
||||||
|
|
||||||
[ "${CROSVM_GALLIUM_DRIVER}" = "llvmpipe" ] && \
|
[ "${CROSVM_GALLIUM_DRIVER}" = "llvmpipe" ] && \
|
||||||
CROSVM_LIBGL_ALWAYS_SOFTWARE=true || CROSVM_LIBGL_ALWAYS_SOFTWARE=false
|
CROSVM_LIBGL_ALWAYS_SOFTWARE=true || CROSVM_LIBGL_ALWAYS_SOFTWARE=false
|
||||||
@ -91,7 +91,7 @@ crosvm run \
|
|||||||
--shared-dir /:my_root:type=fs:writeback=true:timeout=60:cache=always \
|
--shared-dir /:my_root:type=fs:writeback=true:timeout=60:cache=always \
|
||||||
--host_ip "192.168.30.1" --netmask "255.255.255.0" --mac "AA:BB:CC:00:00:12" \
|
--host_ip "192.168.30.1" --netmask "255.255.255.0" --mac "AA:BB:CC:00:00:12" \
|
||||||
--cid ${VSOCK_CID} -p "${CROSVM_KERN_ARGS}" \
|
--cid ${VSOCK_CID} -p "${CROSVM_KERN_ARGS}" \
|
||||||
/lava-files/${KERNEL_IMAGE_NAME:-bzImage} > ${VSOCK_TEMP_DIR}/crosvm 2>&1 &
|
/lava-files/${KERNEL_IMAGE_NAME:-bzImage} > ${VM_TEMP_DIR}/crosvm 2>&1 &
|
||||||
|
|
||||||
# Wait for crosvm process to terminate
|
# Wait for crosvm process to terminate
|
||||||
CROSVM_PID=$!
|
CROSVM_PID=$!
|
||||||
@ -104,7 +104,7 @@ unset CROSVM_PID
|
|||||||
wait
|
wait
|
||||||
unset SOCAT_PIDS
|
unset SOCAT_PIDS
|
||||||
# The actual return code is the crosvm guest script's exit code
|
# The actual return code is the crosvm guest script's exit code
|
||||||
CROSVM_RET=$(cat ${VSOCK_TEMP_DIR}/exit_code 2>/dev/null)
|
CROSVM_RET=$(cat ${VM_TEMP_DIR}/exit_code 2>/dev/null)
|
||||||
# Force error when the guest script's exit code is not available
|
# Force error when the guest script's exit code is not available
|
||||||
CROSVM_RET=${CROSVM_RET:-1}
|
CROSVM_RET=${CROSVM_RET:-1}
|
||||||
}
|
}
|
||||||
@ -113,7 +113,7 @@ unset CROSVM_PID
|
|||||||
[ ${CROSVM_RET} -eq 0 ] || {
|
[ ${CROSVM_RET} -eq 0 ] || {
|
||||||
set +x
|
set +x
|
||||||
echo "Dumping crosvm output.." >&2
|
echo "Dumping crosvm output.." >&2
|
||||||
cat ${VSOCK_TEMP_DIR}/crosvm >&2
|
cat ${VM_TEMP_DIR}/crosvm >&2
|
||||||
set -x
|
set -x
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user