Skip to content

Commit c374e52

Browse files
CYFS3Rbb666
authored andcommitted
ci: detect qemu utest assertions
1 parent bdae0ef commit c374e52

1 file changed

Lines changed: 24 additions & 3 deletions

File tree

.github/workflows/utest_auto_run.yml

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,23 +358,39 @@ jobs:
358358
if: ${{ env.TOOLCHAIN_INSTALLED != '' && success() }}
359359
timeout-minutes: 20
360360
run: |
361+
LOG_FILE="qemu_output_${TEST_QEMU_ARCH}.log"
361362
FAILURE_DETECTED=false
362363
ERROR_LOGS=""
363364
export FAILURE_DETECTED ERROR_LOGS
365+
366+
if [[ ! -f "$LOG_FILE" ]]; then
367+
echo "Error: QEMU log file $LOG_FILE was not created."
368+
exit 1
369+
fi
364370
365371
echo "=========================================================================================="
366372
echo " || || "
367373
echo " || Start automatic running of Utest || "
368374
echo " VV VV "
369375
echo "=========================================================================================="
376+
set +e
370377
timeout 20m bash -c '
371-
tail -n 0 -f "qemu_output_${TEST_QEMU_ARCH}.log" | while IFS= read -r line; do
378+
tail -n +1 -f "$1" | while IFS= read -r line; do
372379
echo "$line"
373380
if [[ "$line" == *"[ FAILED ] [ result ]"* ]]; then
374381
ERROR_LOGS="${ERROR_LOGS}${line}"$'\''\n'\''
375382
FAILURE_DETECTED=true
376383
fi
377384
385+
if [[ "${line,,}" == *"assertion failed"* || "${line,,}" == *"assert failed"* ]]; then
386+
echo "=========================================================================================="
387+
echo " || || "
388+
echo " || Error: Assertion failure detected in QEMU log. || "
389+
echo " VV VV "
390+
echo "=========================================================================================="
391+
exit 1
392+
fi
393+
378394
if [[ "$line" == *"[==========] [ utest ] finished"* ]]; then
379395
if [[ "$FAILURE_DETECTED" == "true" ]]; then
380396
echo "=========================================================================================="
@@ -388,11 +404,12 @@ jobs:
388404
echo "=========================================================================================="
389405
echo " Successed: Utest run completed. Exiting log monitoring "
390406
echo "=========================================================================================="
391-
break
407+
exit 0
392408
fi
393409
done
394-
'
410+
' bash "$LOG_FILE"
395411
monitor_status=$?
412+
set -e
396413
397414
if [[ $monitor_status -eq 124 ]]; then
398415
echo "=========================================================================================="
@@ -404,6 +421,10 @@ jobs:
404421
exit 1
405422
fi
406423
424+
if [[ $monitor_status -ne 0 ]]; then
425+
pkill -f "qemu-system-${TEST_QEMU_ARCH}.*${TEST_BSP_ROOT}/rtthread.bin" || true
426+
fi
427+
407428
exit $monitor_status
408429
# # Post CI status to PR comment
409430
# post-ci-status:

0 commit comments

Comments
 (0)