Skip to content

Commit

Permalink
Test precompiled binary
Browse files Browse the repository at this point in the history
  • Loading branch information
jordancarlin committed Nov 28, 2024
1 parent 07fa23e commit 2377657
Show file tree
Hide file tree
Showing 2 changed files with 123 additions and 88 deletions.
144 changes: 116 additions & 28 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,121 @@ name: CI

on: [push, pull_request, workflow_dispatch]

defaults:
run:
shell: bash

jobs:
build:
runs-on: ubuntu-22.04
test:
strategy:
fail-fast: false
matrix:
include:
# Ubuntu Installations
- name: ubuntu-20.04
os: ubuntu-20.04
container: null
regressionFail: true
- name: ubuntu-22.04
os: ubuntu-22.04
container: null
- name: ubuntu-24.04
os: ubuntu-24.04
container: null
# Debian Installations
- name: debian-12
os: ubuntu-latest
image: debian:12
imageFamily: debian
- name: debian-11
os: ubuntu-latest
image: debian:11
imageFamily: debian
# Red Hat Installations
- name: rocky-8
os: ubuntu-latest
image: rockylinux:8
imageFamily: redhat
regressionFail: true
- name: rocky-9
os: ubuntu-latest
image: rockylinux:9
imageFamily: redhat
- name: almalinux-8
os: ubuntu-latest
image: almalinux:8
imageFamily: redhat
regressionFail: true
- name: almalinux-9
os: ubuntu-latest
image: almalinux:9
imageFamily: redhat
# SUSE Installations
- name: opensuse-15.6
os: ubuntu-latest
image: opensuse/leap:15.6
imageFamily: suse
# User level installation
- name: user-install
os: ubuntu-latest
image: null
user: true
# Custom location installation
- name: custom-install
os: ubuntu-latest
image: null
riscv_path: /home/riscv
# Custom location user level installation
- name: custom-user-install
os: ubuntu-latest
image: null
user: true
riscv_path: $HOME/riscv-toolchain

# run on selected version of ubuntu or on ubuntu-latest with docker image
runs-on: ${{ matrix.os }}
container:
image: ${{ matrix.image }}
options: --privileged --mount type=bind,source=/,target=/host --pid=host --entrypoint /bin/bash # Allow for connection with host

steps:
- name: Install packages
run: sudo apt install -y --no-install-recommends zlib1g-dev pkg-config libgmp-dev curl
- name: Check out repository code
uses: actions/checkout@HEAD
with:
submodules: true
- name: Ensure pre-commit checks pass
run: python3 -m pip install pre-commit && pre-commit run --all-files --show-diff-on-failure --color=always
- name: Install sail from binary
run: |
sudo mkdir -p /usr/local
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
- name: Build and test simulators
run: test/run_tests.sh
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: tests.xml
path: test/tests.xml
- name: Upload event payload
if: always()
uses: actions/upload-artifact@v4
with:
name: event.json
path: ${{ github.event_path }}
# Docker images need git installed or the checkout action fails
- name: Install Dependencies for Container Image
run: |
if [ ${{ matrix.imageFamily }} == "debian" ]; then
apt-get update
apt-get install -y sudo git curl tar
elif [ ${{ matrix.imageFamily }} == "redhat" ]; then
dnf install -y sudo git tar
dnf install curl -y --allowerasing || true
elif [ ${{ matrix.imageFamily }} == "suse" ]; then
zypper install -y sudo git curl tar
else
sudo apt-get update
sudo apt-get install -y git curl tar
fi
- name: Check out repository code
uses: actions/checkout@HEAD
with:
submodules: true
- name: Install sail from binary
run: |
sudo mkdir -p /usr/local
curl --location https://github.com/user-attachments/files/17933831/riscv_sim_RV64.tar.gz | sudo tar xvz --directory=/usr/local/bin
# export PATH=$PATH:/usr/local/bin
- name: check install
run: which riscv_sim_RV64
- name: Build and test simulators
run: test/run_tests.sh
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: tests.xml
path: test/tests.xml
- name: Upload event payload
if: always()
uses: actions/upload-artifact@v4
with:
name: event.json
path: ${{ github.event_path }}
67 changes: 7 additions & 60 deletions test/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,74 +47,21 @@ function finish_suite {
fail=0
}

SAILLIBDIR="$DIR/../../lib/"

cd $RISCVDIR

# Do 'make clean' to avoid cross-arch pollution.
make clean

printf "Building 32-bit RISCV specification...\n"

if ARCH=RV32 make c_emulator/riscv_sim_RV32;
then
green "Building 32-bit RISCV C emulator" "ok"
else
red "Building 32-bit RISCV C emulator" "fail"
fi
for test in $DIR/riscv-tests/rv32*.elf; do
if timeout 5 $RISCVDIR/c_emulator/riscv_sim_RV32 -p $test > ${test%.elf}.cout 2>&1 && grep -q SUCCESS ${test%.elf}.cout
then
green "C-32 $(basename $test)" "ok"
else
red "C-32 $(basename $test)" "fail"
fi
done
finish_suite "32-bit RISCV C tests"
printf "Running 64-bit RISCV tests...\n"

# Do 'make clean' to avoid cross-arch pollution.
make clean

printf "Building 64-bit RISCV specification...\n"

if make c_emulator/riscv_sim_RV64;
then
green "Building 64-bit RISCV C emulator" "ok"
else
red "Building 64-bit RISCV C emulator" "fail"
fi
for test in $DIR/riscv-tests/rv64*.elf; do
if timeout 5 $RISCVDIR/c_emulator/riscv_sim_RV64 -p $test > ${test%.elf}.cout 2>&1 && grep -q SUCCESS ${test%.elf}.cout
then
green "C-64 $(basename $test)" "ok"
else
red "C-64 $(basename $test)" "fail"
fi
riscv_sim_RV64 -p $test #> ${test%.elf}.cout 2>&1 && grep -q SUCCESS ${test%.elf}.cout
# then
# green "C-64 $(basename $test)" "ok"
# else
# red "C-64 $(basename $test)" "fail"
# fi
done
finish_suite "64-bit RISCV C tests"

# Do 'make clean' to avoid cross-arch pollution.
make clean

if ARCH=RV32 make c_emulator/riscv_rvfi_RV32;
then
green "Building 32-bit RISCV RVFI C emulator" "ok"
else
red "Building 32-bit RISCV RVFI C emulator" "fail"
fi
finish_suite "32-bit RISCV RVFI C tests"

# Do 'make clean' to avoid cross-arch pollution.
make clean

if ARCH=RV64 make c_emulator/riscv_rvfi_RV64;
then
green "Building 64-bit RISCV RVFI C emulator" "ok"
else
red "Building 64-bit RISCV RVFI C emulator" "fail"
fi
finish_suite "64-bit RISCV RVFI C tests"

printf "Passed ${all_pass} out of $(( all_pass + all_fail ))\n\n"
XML="<testsuites tests=\"$(( all_pass + all_fail ))\" failures=\"${all_fail}\">\n$SUITES_XML</testsuites>\n"
printf "$XML" > $DIR/tests.xml
Expand Down

0 comments on commit 2377657

Please sign in to comment.