Skip to content

Commit 041c634

Browse files
committed
Test precompiled binary
1 parent 07fa23e commit 041c634

File tree

2 files changed

+128
-88
lines changed

2 files changed

+128
-88
lines changed

.github/workflows/compile.yml

+121-28
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,126 @@ name: CI
22

33
on: [push, pull_request, workflow_dispatch]
44

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

test/run_tests.sh

+7-60
Original file line numberDiff line numberDiff line change
@@ -47,74 +47,21 @@ 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"
5852

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"
53+
printf "Running 64-bit RISCV tests...\n"
7454

75-
# Do 'make clean' to avoid cross-arch pollution.
76-
make clean
77-
78-
printf "Building 64-bit RISCV specification...\n"
79-
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
88-
then
89-
green "C-64 $(basename $test)" "ok"
90-
else
91-
red "C-64 $(basename $test)" "fail"
92-
fi
56+
riscv_sim_RV64 -p $test #> ${test%.elf}.cout 2>&1 && grep -q SUCCESS ${test%.elf}.cout
57+
# then
58+
# green "C-64 $(basename $test)" "ok"
59+
# else
60+
# red "C-64 $(basename $test)" "fail"
61+
# fi
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)