Skip to content

Commit 78ec6f7

Browse files
committed
CI: Improve error-prone support
The timeout for 'expect' script is reduced to 90 seconds, which should be reasonable for testing purpose.
1 parent a309d9e commit 78ec6f7

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

.ci/autorun.sh

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,40 @@
11
#!/usr/bin/env bash
22

3-
pkill -9 semu
3+
function cleanup {
4+
sleep 1
5+
pkill -9 semu
6+
}
47

5-
expect <<DONE
6-
set timeout 120
8+
function ASSERT {
9+
$*
10+
local RES=$?
11+
if [ $RES -ne 0 ]; then
12+
echo 'Assert failed: "' $* '"'
13+
exit $RES
14+
fi
15+
}
16+
17+
cleanup
18+
19+
ASSERT expect <<DONE
20+
set timeout 90
721
spawn make check
822
expect "buildroot login:" { send "root\n" } timeout { exit 1 }
923
expect "# " { send "uname -a\n" } timeout { exit 2 }
1024
expect "riscv32 GNU/Linux" { send "\x01"; send "x" } timeout { exit 3 }
1125
DONE
1226

1327
ret=$?
14-
pkill -9 semu
15-
echo
28+
cleanup
1629

1730
MESSAGES=("OK!" \
1831
"Fail to boot" \
1932
"Fail to login" \
2033
"Fail to run commands" \
2134
)
2235

23-
echo "${MESSAGES[$ret]}"
36+
COLOR_G='\e[32;01m' # Green
37+
COLOR_N='\e[0m'
38+
printf "\n[ ${COLOR_G}${MESSAGES[$ret]}${COLOR_N} ]\n"
39+
2440
exit ${ret}

0 commit comments

Comments
 (0)