2023-05-18 16:15:54 -05:00
|
|
|
# Build Spike and run a couple of debug tests.
|
2023-02-17 11:32:06 -06:00
|
|
|
|
|
|
|
name: Test OpenOCD against 2 spike configurations
|
|
|
|
|
2023-05-18 16:15:54 -05:00
|
|
|
env:
|
|
|
|
SPIKE_REPO: https://github.com/riscv-software-src/riscv-isa-sim.git
|
|
|
|
SPIKE_REV: master
|
|
|
|
RISCV_TESTS_REPO: https://github.com/riscv-software-src/riscv-tests.git
|
|
|
|
RISCV_TESTS_REV: master
|
|
|
|
TOOLCHAIN_URL: https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v12.2.0-1/xpack-riscv-none-elf-gcc-12.2.0-1-linux-x64.tar.gz
|
|
|
|
|
2023-07-18 12:59:27 -05:00
|
|
|
on:
|
|
|
|
# Run on merges to master to populate the cache with entities that are
|
|
|
|
# accessible by every pull request.
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- riscv
|
|
|
|
pull_request:
|
|
|
|
types: [synchronize, opened, reopened]
|
2023-02-17 11:32:06 -06:00
|
|
|
|
|
|
|
# There is some commented out code below that would be useful in adding this
|
|
|
|
# workflow to other repos. Ideally we can come up with something that would
|
|
|
|
# leave this file almost identical between repos, so they can all easily run
|
|
|
|
# this test suite.
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
test:
|
|
|
|
name: Test debug (Ubuntu)
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-05-18 16:15:54 -05:00
|
|
|
- uses: actions/checkout@v3
|
2023-02-17 11:32:06 -06:00
|
|
|
|
2023-05-18 16:15:54 -05:00
|
|
|
- name: Install packages
|
2023-02-17 11:32:06 -06:00
|
|
|
run: |
|
2023-05-18 16:15:54 -05:00
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install -y device-tree-compiler build-essential
|
2023-02-17 11:32:06 -06:00
|
|
|
|
2023-05-18 16:15:54 -05:00
|
|
|
- name: Get revisions of dependencies
|
2023-02-17 11:32:06 -06:00
|
|
|
run: |
|
2023-05-18 16:15:54 -05:00
|
|
|
SPIKE_COMMIT=$( git ls-remote "$SPIKE_REPO" master | awk '{ print $1; }' )
|
|
|
|
RISC_V_TESTS_COMMIT=$( git ls-remote "$RISCV_TESTS_REPO" master | awk '{ print $1; }' )
|
|
|
|
echo "Revison of Spike: $SPIKE_COMMIT"
|
|
|
|
echo "Revision of RISC-V tests: $RISC_V_TESTS_COMMIT"
|
|
|
|
# Save for later use
|
|
|
|
echo "SPIKE_COMMIT=$SPIKE_COMMIT" >> $GITHUB_ENV
|
|
|
|
echo "RISC_V_TESTS_COMMIT=$RISC_V_TESTS_COMMIT" >> $GITHUB_ENV
|
2023-02-17 11:32:06 -06:00
|
|
|
|
2023-05-18 16:15:54 -05:00
|
|
|
- name: Get the toolchain from cache (if available)
|
|
|
|
id: cache-toolchain
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: /opt/riscv/toolchain
|
|
|
|
key: "toolchain-${{env.TOOLCHAIN_URL}}"
|
|
|
|
|
|
|
|
- name: Get spike from cache (if available)
|
|
|
|
id: cache-spike
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: /opt/riscv/spike
|
|
|
|
key: "spike-${{env.SPIKE_COMMIT}}"
|
|
|
|
|
|
|
|
- if: ${{ steps.cache-toolchain.outputs.cache-hit != 'true' }}
|
|
|
|
name: Download Toolchain (if not cached)
|
|
|
|
run: |
|
|
|
|
mkdir -p /opt/riscv/toolchain
|
|
|
|
wget --progress=dot:giga $TOOLCHAIN_URL -O /tmp/toolchain.tar.gz
|
2023-02-17 11:32:06 -06:00
|
|
|
|
2023-05-18 16:15:54 -05:00
|
|
|
- if: ${{ steps.cache-toolchain.outputs.cache-hit != 'true' }}
|
|
|
|
name: Install Toolchain (if not cached)
|
|
|
|
run: tar zxf /tmp/toolchain.tar.gz --strip-components=1 -C /opt/riscv/toolchain
|
2023-02-17 11:32:06 -06:00
|
|
|
|
2023-05-18 16:15:54 -05:00
|
|
|
- if: ${{ steps.cache-spike.outputs.cache-hit != 'true' }}
|
|
|
|
name: Download Spike source (if not cached)
|
2023-02-17 11:32:06 -06:00
|
|
|
run: |
|
2023-05-18 16:15:54 -05:00
|
|
|
git clone "$SPIKE_REPO"
|
|
|
|
cd riscv-isa-sim
|
|
|
|
git checkout "$SPIKE_COMMIT"
|
|
|
|
git submodule update --init --recursive
|
2023-02-17 11:32:06 -06:00
|
|
|
|
2023-05-18 16:15:54 -05:00
|
|
|
- if: ${{ steps.cache-spike.outputs.cache-hit != 'true' }}
|
|
|
|
name: Build Spike (if not cached)
|
2023-02-17 11:32:06 -06:00
|
|
|
run: |
|
|
|
|
cd riscv-isa-sim
|
2023-05-18 16:15:54 -05:00
|
|
|
mkdir build && cd build
|
|
|
|
../configure --prefix=/opt/riscv/spike
|
2023-02-17 11:32:06 -06:00
|
|
|
make -j"$(nproc 2> /dev/null || sysctl -n hw.ncpu)"
|
|
|
|
make install
|
|
|
|
|
2023-05-18 16:15:54 -05:00
|
|
|
- name: Build OpenOCD
|
|
|
|
run: |
|
|
|
|
#cd riscv-openocd
|
|
|
|
./bootstrap
|
|
|
|
./configure --prefix=/opt/riscv
|
|
|
|
make -j"$(nproc 2> /dev/null || sysctl -n hw.ncpu)"
|
|
|
|
ls -l src/openocd
|
|
|
|
|
|
|
|
# - name: Download OpenOCD
|
|
|
|
# run: |
|
|
|
|
# git clone --recurse-submodules https://github.com/riscv/riscv-openocd.git
|
|
|
|
# cd riscv-openocd
|
|
|
|
# git checkout 43ea20dfbb6c815004a51106a3b2009d7f6c4940
|
|
|
|
|
2023-02-17 11:32:06 -06:00
|
|
|
- name: Download Tests
|
|
|
|
run: |
|
2023-05-18 16:15:54 -05:00
|
|
|
git clone "$RISCV_TESTS_REPO"
|
|
|
|
cd riscv-tests
|
|
|
|
git checkout "$RISCV_TESTS_REV"
|
|
|
|
git submodule update --init --recursive
|
2023-02-17 11:32:06 -06:00
|
|
|
|
2023-07-18 07:20:50 -05:00
|
|
|
- name: Run Spike32 Tests
|
|
|
|
id: spike32-tests
|
2023-02-17 11:32:06 -06:00
|
|
|
run: |
|
|
|
|
cd riscv-tests/debug
|
|
|
|
./gdbserver.py targets/RISC-V/spike32.py --print-failures \
|
2023-05-18 16:15:54 -05:00
|
|
|
--gcc /opt/riscv/toolchain/bin/riscv-none-elf-gcc \
|
|
|
|
--gdb /opt/riscv/toolchain/bin/riscv-none-elf-gdb \
|
|
|
|
--sim_cmd /opt/riscv/spike/bin/spike \
|
2023-02-17 11:32:06 -06:00
|
|
|
--server_cmd $GITHUB_WORKSPACE/src/openocd
|
2023-07-18 07:20:50 -05:00
|
|
|
|
|
|
|
- name: Run Spike64-2 Tests
|
|
|
|
if: success() || steps.spike32-tests.conclusion == 'failure'
|
|
|
|
run: |
|
|
|
|
cd riscv-tests/debug
|
2023-02-17 11:32:06 -06:00
|
|
|
./gdbserver.py targets/RISC-V/spike64-2.py --print-failures \
|
2023-05-18 16:15:54 -05:00
|
|
|
--gcc /opt/riscv/toolchain/bin/riscv-none-elf-gcc \
|
|
|
|
--gdb /opt/riscv/toolchain/bin/riscv-none-elf-gdb \
|
|
|
|
--sim_cmd /opt/riscv/spike/bin/spike \
|
2023-02-17 11:32:06 -06:00
|
|
|
--server_cmd $GITHUB_WORKSPACE/src/openocd
|
2023-05-18 16:15:54 -05:00
|
|
|
|
|
|
|
- name: Archive test logs
|
|
|
|
# Proceed even if there was a failed test
|
|
|
|
if: ${{ success() || failure() }}
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: test-logs
|
|
|
|
path: riscv-tests/debug/logs
|