Skip to content

Commit ace0e7e

Browse files
committed
CI: Automate the runtime checks
This commit aims to automate the validation process by utilizing the 'expect' tool to verify if semu can successfully boot the Linux kernel and run BusyBox as anticipated. Currently, only the "uname" command is executed and its output is checked.
1 parent af0b37a commit ace0e7e

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

.ci/autorun.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env bash
2+
3+
pkill -9 semu
4+
5+
expect <<DONE
6+
set timeout 120
7+
spawn make check
8+
expect "buildroot login:" { send "root\n" } timeout { exit 1 }
9+
expect "# " { send "uname -a\n" } timeout { exit 2 }
10+
expect "riscv32 GNU/Linux" { send "\x01"; send "x" } timeout { exit 3 }
11+
DONE
12+
13+
ret=$?
14+
pkill -9 semu
15+
echo
16+
17+
MESSAGES=("OK!" \
18+
"Fail to boot" \
19+
"Fail to login" \
20+
"Fail to run commands" \
21+
)
22+
23+
echo "${MESSAGES[$ret]}"
24+
exit ${ret}

.github/workflows/main.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@ jobs:
1010
- name: install-dependencies
1111
run: |
1212
sudo apt-get install build-essential device-tree-compiler
13+
sudo apt-get install expect
1314
- name: default build
1415
run: make
1516
shell: bash
17+
- name: automated test
18+
run: .ci/autorun.sh
19+
shell: bash
1620

1721
coding_style:
1822
runs-on: ubuntu-22.04
@@ -21,5 +25,5 @@ jobs:
2125
- name: coding convention
2226
run: |
2327
sudo apt-get install -q -y clang-format-12
24-
sh .ci/check-format.sh
28+
.ci/check-format.sh
2529
shell: bash

0 commit comments

Comments
 (0)