Skip to content

Commit 4eb8f0c

Browse files
committed
Test precompiled binary
1 parent 07fa23e commit 4eb8f0c

File tree

2 files changed

+111
-83
lines changed

2 files changed

+111
-83
lines changed

.github/workflows/compile.yml

+109-28
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,113 @@ name: CI
33
on: [push, pull_request, workflow_dispatch]
44

55
jobs:
6-
build:
7-
runs-on: ubuntu-22.04
6+
test:
7+
strategy:
8+
fail-fast: false
9+
matrix:
10+
include:
11+
# Ubuntu Installations
12+
- name: ubuntu-20.04
13+
os: ubuntu-20.04
14+
container: null
15+
regressionFail: true
16+
- name: ubuntu-22.04
17+
os: ubuntu-22.04
18+
container: null
19+
- name: ubuntu-24.04
20+
os: ubuntu-24.04
21+
container: null
22+
# Debian Installations
23+
- name: debian-12
24+
os: ubuntu-latest
25+
image: debian:12
26+
imageFamily: debian
27+
- name: debian-11
28+
os: ubuntu-latest
29+
image: debian:11
30+
imageFamily: debian
31+
# Red Hat Installations
32+
- name: rocky-8
33+
os: ubuntu-latest
34+
image: rockylinux:8
35+
imageFamily: redhat
36+
regressionFail: true
37+
- name: rocky-9
38+
os: ubuntu-latest
39+
image: rockylinux:9
40+
imageFamily: redhat
41+
- name: almalinux-8
42+
os: ubuntu-latest
43+
image: almalinux:8
44+
imageFamily: redhat
45+
regressionFail: true
46+
- name: almalinux-9
47+
os: ubuntu-latest
48+
image: almalinux:9
49+
imageFamily: redhat
50+
# SUSE Installations
51+
- name: opensuse-15.6
52+
os: ubuntu-latest
53+
image: opensuse/leap:15.6
54+
imageFamily: suse
55+
# User level installation
56+
- name: user-install
57+
os: ubuntu-latest
58+
image: null
59+
user: true
60+
# Custom location installation
61+
- name: custom-install
62+
os: ubuntu-latest
63+
image: null
64+
riscv_path: /home/riscv
65+
# Custom location user level installation
66+
- name: custom-user-install
67+
os: ubuntu-latest
68+
image: null
69+
user: true
70+
riscv_path: $HOME/riscv-toolchain
71+
72+
# run on selected version of ubuntu or on ubuntu-latest with docker image
73+
runs-on: ${{ matrix.os }}
74+
container:
75+
image: ${{ matrix.image }}
76+
options: --privileged --mount type=bind,source=/,target=/host --pid=host --entrypoint /bin/bash # Allow for connection with host
77+
878
steps:
9-
- name: Install packages
10-
run: sudo apt install -y --no-install-recommends zlib1g-dev pkg-config libgmp-dev curl
11-
- name: Check out repository code
12-
uses: actions/checkout@HEAD
13-
with:
14-
submodules: true
15-
- name: Ensure pre-commit checks pass
16-
run: python3 -m pip install pre-commit && pre-commit run --all-files --show-diff-on-failure --color=always
17-
- name: Install sail from binary
18-
run: |
19-
sudo mkdir -p /usr/local
20-
curl --location https://github.com/rems-project/sail/releases/download/0.18-linux-binary/sail.tar.gz | sudo tar xvz --directory=/usr/local --strip-components=1
21-
- name: Build and test simulators
22-
run: test/run_tests.sh
23-
- name: Upload test results
24-
if: always()
25-
uses: actions/upload-artifact@v4
26-
with:
27-
name: tests.xml
28-
path: test/tests.xml
29-
- name: Upload event payload
30-
if: always()
31-
uses: actions/upload-artifact@v4
32-
with:
33-
name: event.json
34-
path: ${{ github.event_path }}
79+
# Docker images need git installed or the checkout action fails
80+
- name: Install Dependencies for Container Image
81+
run: |
82+
if [ ${{ matrix.imageFamily }} == "debian" ]; then
83+
apt-get update
84+
apt-get install -y sudo git curl
85+
elif [ ${{ matrix.imageFamily }} == "redhat" ]; then
86+
dnf install -y sudo git curl
87+
dnf install curl -y --allowerasing || true
88+
elif [ ${{ matrix.imageFamily }} == "suse" ]; then
89+
zypper install -y sudo git curl
90+
else
91+
apt-get update
92+
apt-get install -y sudo git curl
93+
fi
94+
- name: Check out repository code
95+
uses: actions/checkout@HEAD
96+
with:
97+
submodules: true
98+
- name: Install sail from binary
99+
run: |
100+
sudo mkdir -p /usr/local
101+
curl --location https://github.com/user-attachments/files/17933831/riscv_sim_RV64.tar.gz | sudo tar xvz --directory=/usr/local --strip-components=1
102+
- name: Build and test simulators
103+
run: test/run_tests.sh
104+
- name: Upload test results
105+
if: always()
106+
uses: actions/upload-artifact@v4
107+
with:
108+
name: tests.xml
109+
path: test/tests.xml
110+
- name: Upload event payload
111+
if: always()
112+
uses: actions/upload-artifact@v4
113+
with:
114+
name: event.json
115+
path: ${{ github.event_path }}

test/run_tests.sh

+2-55
Original file line numberDiff line numberDiff line change
@@ -47,44 +47,13 @@ function finish_suite {
4747
fail=0
4848
}
4949

50-
SAILLIBDIR="$DIR/../../lib/"
51-
5250
cd $RISCVDIR
5351

54-
# Do 'make clean' to avoid cross-arch pollution.
55-
make clean
56-
57-
printf "Building 32-bit RISCV specification...\n"
58-
59-
if ARCH=RV32 make c_emulator/riscv_sim_RV32;
60-
then
61-
green "Building 32-bit RISCV C emulator" "ok"
62-
else
63-
red "Building 32-bit RISCV C emulator" "fail"
64-
fi
65-
for test in $DIR/riscv-tests/rv32*.elf; do
66-
if timeout 5 $RISCVDIR/c_emulator/riscv_sim_RV32 -p $test > ${test%.elf}.cout 2>&1 && grep -q SUCCESS ${test%.elf}.cout
67-
then
68-
green "C-32 $(basename $test)" "ok"
69-
else
70-
red "C-32 $(basename $test)" "fail"
71-
fi
72-
done
73-
finish_suite "32-bit RISCV C tests"
74-
75-
# Do 'make clean' to avoid cross-arch pollution.
76-
make clean
7752

78-
printf "Building 64-bit RISCV specification...\n"
53+
printf "Running 64-bit RISCV tests...\n"
7954

80-
if make c_emulator/riscv_sim_RV64;
81-
then
82-
green "Building 64-bit RISCV C emulator" "ok"
83-
else
84-
red "Building 64-bit RISCV C emulator" "fail"
85-
fi
8655
for test in $DIR/riscv-tests/rv64*.elf; do
87-
if timeout 5 $RISCVDIR/c_emulator/riscv_sim_RV64 -p $test > ${test%.elf}.cout 2>&1 && grep -q SUCCESS ${test%.elf}.cout
56+
if timeout 5 riscv_sim_RV64 -p $test > ${test%.elf}.cout 2>&1 && grep -q SUCCESS ${test%.elf}.cout
8857
then
8958
green "C-64 $(basename $test)" "ok"
9059
else
@@ -93,28 +62,6 @@ for test in $DIR/riscv-tests/rv64*.elf; do
9362
done
9463
finish_suite "64-bit RISCV C tests"
9564

96-
# Do 'make clean' to avoid cross-arch pollution.
97-
make clean
98-
99-
if ARCH=RV32 make c_emulator/riscv_rvfi_RV32;
100-
then
101-
green "Building 32-bit RISCV RVFI C emulator" "ok"
102-
else
103-
red "Building 32-bit RISCV RVFI C emulator" "fail"
104-
fi
105-
finish_suite "32-bit RISCV RVFI C tests"
106-
107-
# Do 'make clean' to avoid cross-arch pollution.
108-
make clean
109-
110-
if ARCH=RV64 make c_emulator/riscv_rvfi_RV64;
111-
then
112-
green "Building 64-bit RISCV RVFI C emulator" "ok"
113-
else
114-
red "Building 64-bit RISCV RVFI C emulator" "fail"
115-
fi
116-
finish_suite "64-bit RISCV RVFI C tests"
117-
11865
printf "Passed ${all_pass} out of $(( all_pass + all_fail ))\n\n"
11966
XML="<testsuites tests=\"$(( all_pass + all_fail ))\" failures=\"${all_fail}\">\n$SUITES_XML</testsuites>\n"
12067
printf "$XML" > $DIR/tests.xml

0 commit comments

Comments
 (0)