Skip to content

Commit 8d90843

Browse files
committed
Add qemu-eest-workflow
1 parent aebc7dd commit 8d90843

File tree

3 files changed

+119
-3
lines changed

3 files changed

+119
-3
lines changed
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
name: Qemu EESTs on RV32IM
2+
3+
on:
4+
push:
5+
branches: [master, main]
6+
pull_request:
7+
branches: [master, main]
8+
workflow_dispatch:
9+
10+
jobs:
11+
qemu-eest-blockchain:
12+
name: EEST Blockchain Tests via Qemu(riscv32)
13+
runs-on: ubuntu-latest
14+
container: ubuntu:25.10
15+
steps:
16+
- name: Install system dependencies
17+
env:
18+
DEBIAN_FRONTEND: noninteractive
19+
TZ: Etc/UTC
20+
run: |
21+
apt update
22+
apt install -y \
23+
build-essential cmake ninja-build \
24+
git git-lfs \
25+
python3 python3-pip pipx \
26+
qemu-system-riscv \
27+
nodejs npm
28+
pipx install conan
29+
pipx ensurepath
30+
npm i -g xpm
31+
xpm install @xpack-dev-tools/riscv-none-elf-gcc@latest --global --verbose
32+
echo 'export PATH=$HOME/.local/xPacks/@xpack-dev-tools/riscv-none-elf-gcc/15.2.0-1.1/.content/bin:$PATH' >> ~/.bashrc
33+
echo "PATH=$HOME/.local/xPacks/@xpack-dev-tools/riscv-none-elf-gcc/15.2.0-1.1/.content/bin:$PATH" >> $GITHUB_ENV
34+
- name: Verify tool versions
35+
run: |
36+
riscv-none-elf-gcc --version
37+
riscv-none-elf-g++ --version
38+
cmake --version
39+
ninja --version
40+
git --version
41+
git lfs version
42+
python3 --version
43+
ctest --version
44+
45+
- name: Checkout repository
46+
uses: actions/checkout@v4
47+
with:
48+
submodules: recursive
49+
lfs: true
50+
51+
- name: Run EEST blockchain tests
52+
id: run_tests
53+
shell: bash
54+
run: |
55+
set +e
56+
cd qemu_runner && make rv32im_eest_blockchain_tests 2>&1 | tee output.log
57+
exit_code=${PIPESTATUS[0]}
58+
59+
# Parse test results
60+
if grep -q "tests passed" output.log; then
61+
result_line=$(grep "tests passed" output.log | tail -1)
62+
# Extract numbers: "X% tests passed, Y tests failed out of Z"
63+
passed=$(echo "$result_line" | grep -oP '\d+(?=% tests passed)')
64+
failed=$(echo "$result_line" | grep -oP '\d+(?= tests failed)')
65+
total=$(echo "$result_line" | grep -oP '(?<=out of )\d+')
66+
67+
echo "passed_percent=$passed" >> $GITHUB_OUTPUT
68+
echo "failed=$failed" >> $GITHUB_OUTPUT
69+
echo "total=$total" >> $GITHUB_OUTPUT
70+
echo "exit_code=$exit_code" >> $GITHUB_OUTPUT
71+
else
72+
echo "passed_percent=0" >> $GITHUB_OUTPUT
73+
echo "failed=-1" >> $GITHUB_OUTPUT
74+
echo "total=0" >> $GITHUB_OUTPUT
75+
echo "exit_code=$exit_code" >> $GITHUB_OUTPUT
76+
fi
77+
78+
- name: Print test summary
79+
run: |
80+
echo "========================================"
81+
echo " EEST TEST SUMMARY"
82+
echo "========================================"
83+
echo ""
84+
echo "Results: ${{ steps.run_tests.outputs.passed_percent }}% passed, ${{ steps.run_tests.outputs.failed }} failed out of ${{ steps.run_tests.outputs.total }}"
85+
echo "========================================"
86+
87+
- name: Upload test logs
88+
if: always()
89+
uses: actions/upload-artifact@v4
90+
with:
91+
name: eest-test-logs
92+
path: |
93+
output.log
94+
build/eest/Testing/Temporary/LastTest.log
95+
retention-days: 30
96+
97+
- name: Check failure threshold
98+
run: |
99+
failed=${{ steps.run_tests.outputs.failed }}
100+
total=${{ steps.run_tests.outputs.total }}
101+
exit_code=${{ steps.run_tests.outputs.exit_code }}
102+
103+
if [[ "$failed" == "-1" ]]; then
104+
echo "ERROR: Could not parse test results"
105+
exit 1
106+
fi
107+
108+
if (( failed > 5 )); then
109+
echo "Too many failures - ${failed} failed out of ${total}"
110+
echo "failed" > failed.log
111+
exit 1
112+
fi
113+
114+
if (( failed > 0 )); then
115+
echo "WARNING: ${failed} test(s) failed, but within acceptable threshold (<=5)"
116+
else
117+
echo "SUCCESS: All ${total} tests passed!"
118+
fi

qemu_runner/Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
BUILD_DIR := $(CURDIR)/build
2-
CONAN_PROFILE := conan/profiles/rv32im.sp1.profile
3-
CMAKE_TOOLCHAIN := cmake/rv32im.sp1.cmake
42
ELF := $(BUILD_DIR)/z6m_debug
53

64
CONAN_PROFILE = $(CURDIR)/conan/profiles/riscv32im.conan.profile

qemu_runner/conan/profiles/riscv32im.conan.profile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[settings]
22
os=baremetal
33
arch=riscv32
4-
compiler=gcc
4+
compiler=riscv-none-elf-gcc
55
compiler.version=15
66
compiler.libcxx=libstdc++11
77
compiler.cppstd=gnu23

0 commit comments

Comments
 (0)