Skip to content

Commit 7732a55

Browse files
committed
Add retry mechanism after deadlock timeout for c910v.
1 parent be9f755 commit 7732a55

File tree

1 file changed

+33
-3
lines changed

1 file changed

+33
-3
lines changed

.github/workflows/c910v.yml

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,39 @@ jobs:
8383
8484
- name: test
8585
run: |
86-
export PATH=$GITHUB_WORKSPACE/qemu-install/bin/:$PATH
87-
qemu-riscv64 ./utest/openblas_utest
88-
qemu-riscv64 ./utest/openblas_utest_ext
86+
run_with_retry() {
87+
local cmd="$1"
88+
local time_out=10
89+
local retries=10
90+
local attempt=0
91+
92+
for ((i=1; i<=retries; i++)); do
93+
attempt=$((i))
94+
if timeout -s 12 --preserve-status $time_out $cmd; then
95+
echo "Command succeeded on attempt $i."
96+
return 0
97+
else
98+
local exit_code=$?
99+
if [ $exit_code -eq 140 ]; then
100+
echo "Attempt $i timed out (retrying...)"
101+
time_out=$((time_out + 5))
102+
else
103+
echo "Attempt $i failed with exit code $exit_code. Aborting workflow."
104+
exit $exit_code
105+
fi
106+
fi
107+
done
108+
echo "All $retries attempts failed, giving up."
109+
echo "Final failure was due to timeout."
110+
echo "Aborting workflow."
111+
exit $exit_code
112+
}
113+
export PATH=$GITHUB_WORKSPACE/qemu-install/bin:$PATH
114+
which qemu-riscv64
115+
export QEMU_BIN=$(which qemu-riscv64)
116+
run_with_retry "$QEMU_BIN ./utest/openblas_utest"
117+
run_with_retry "$QEMU_BIN ./utest/openblas_utest_ext"
118+
89119
OPENBLAS_NUM_THREADS=2 qemu-riscv64 ./ctest/xscblat1
90120
OPENBLAS_NUM_THREADS=2 qemu-riscv64 ./ctest/xdcblat1
91121
OPENBLAS_NUM_THREADS=2 qemu-riscv64 ./ctest/xccblat1

0 commit comments

Comments
 (0)