Skip to content

Commit

Permalink
CI: Automate the runtime checks
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jserv committed Jan 20, 2024
1 parent af0b37a commit ace0e7e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
24 changes: 24 additions & 0 deletions .ci/autorun.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash

pkill -9 semu

expect <<DONE
set timeout 120
spawn make check
expect "buildroot login:" { send "root\n" } timeout { exit 1 }
expect "# " { send "uname -a\n" } timeout { exit 2 }
expect "riscv32 GNU/Linux" { send "\x01"; send "x" } timeout { exit 3 }
DONE

ret=$?
pkill -9 semu
echo

MESSAGES=("OK!" \
"Fail to boot" \
"Fail to login" \
"Fail to run commands" \
)

echo "${MESSAGES[$ret]}"
exit ${ret}
6 changes: 5 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ jobs:
- name: install-dependencies
run: |
sudo apt-get install build-essential device-tree-compiler
sudo apt-get install expect
- name: default build
run: make
shell: bash
- name: automated test
run: .ci/autorun.sh
shell: bash

coding_style:
runs-on: ubuntu-22.04
Expand All @@ -21,5 +25,5 @@ jobs:
- name: coding convention
run: |
sudo apt-get install -q -y clang-format-12
sh .ci/check-format.sh
.ci/check-format.sh
shell: bash

0 comments on commit ace0e7e

Please sign in to comment.