mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 09:18:04 +02:00
ci/crosvm: Sanitize CROSVM_RET in crosvm-runner.sh
When crosvm crashes, the `exit_code` file might not exist or might contain unexpected garbage (multi-line output or spaces). Because $CROSVM_RET was unquoted in comparisons, this led to intermittent "too many arguments" bash syntax errors, which masked the true failure. Signed-off-by: Valentine Burley <valentine.burley@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41124>
This commit is contained in:
parent
c22e4022a8
commit
96ae27069d
1 changed files with 4 additions and 2 deletions
|
|
@ -150,15 +150,17 @@ crosvm --no-syslog run \
|
|||
section_start crosvm_results "Processing crosvm results"
|
||||
CROSVM_RET=$?
|
||||
|
||||
[ ${CROSVM_RET} -eq 0 ] && {
|
||||
[ "${CROSVM_RET}" -eq 0 ] && {
|
||||
# The actual return code is the crosvm guest script's exit code
|
||||
CROSVM_RET=$(cat ${VM_TEMP_DIR}/exit_code 2>/dev/null)
|
||||
# Sanitize it to a single integer
|
||||
CROSVM_RET=$(echo "$CROSVM_RET" | grep -o '^[0-9]\+' | head -n 1)
|
||||
# Force error when the guest script's exit code is not available
|
||||
CROSVM_RET=${CROSVM_RET:-1}
|
||||
}
|
||||
|
||||
# Show crosvm output on error to help with debugging
|
||||
[ ${CROSVM_RET} -eq 0 ] || {
|
||||
[ "${CROSVM_RET}" -eq 0 ] || {
|
||||
{ set +x; } 2>/dev/null
|
||||
echo "Dumping crosvm output.." >&2
|
||||
cat ${VM_TEMP_DIR}/crosvm >&2
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue