File tree Expand file tree Collapse file tree 1 file changed +22
-6
lines changed Expand file tree Collapse file tree 1 file changed +22
-6
lines changed Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
- pkill -9 semu
3
+ function cleanup {
4
+ sleep 1
5
+ pkill -9 semu
6
+ }
4
7
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
7
21
spawn make check
8
22
expect "buildroot login:" { send "root\n" } timeout { exit 1 }
9
23
expect "# " { send "uname -a\n" } timeout { exit 2 }
10
24
expect "riscv32 GNU/Linux" { send "\x01"; send "x" } timeout { exit 3 }
11
25
DONE
12
26
13
27
ret=$?
14
- pkill -9 semu
15
- echo
28
+ cleanup
16
29
17
30
MESSAGES=(" OK!" \
18
31
" Fail to boot" \
19
32
" Fail to login" \
20
33
" Fail to run commands" \
21
34
)
22
35
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
+
24
40
exit ${ret}
You can’t perform that action at this time.
0 commit comments