diff options
author | Jan Matyas <50193733+JanMatCodasip@users.noreply.github.com> | 2023-05-18 23:15:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-18 14:15:54 -0700 |
commit | 431deec8c9cc3c56e02f6a21610dbd1b4125a96c (patch) | |
tree | 691793faacf3561da9cca57e5192c29e9e1769ed /.github | |
parent | 461eb65e21953d84bdf011f62a4a5407ad6f7552 (diff) | |
download | riscv-openocd-431deec8c9cc3c56e02f6a21610dbd1b4125a96c.zip riscv-openocd-431deec8c9cc3c56e02f6a21610dbd1b4125a96c.tar.gz riscv-openocd-431deec8c9cc3c56e02f6a21610dbd1b4125a96c.tar.bz2 |
Multiple improvements to Spike smoke-test workflow (#809)
* Multiple improvements to Spike smoke-test workflow
These changes have been made:
- use checkout action v3 (not v2) - silences a Github warning
- cache dependencies to speed-up the process (Spike + toolchain)
- reorder actions so that cached items are handled first
- move dependencies to /opt/riscv for easier caching
- archive logs from the tests (downloadable artifact)
- more descriptive names for some steps
- changed 'apt' to 'apt-get' to supress a warning
Change-Id: I5b8e9200c5d8cbaa3116bac565e009089bb6b36b
Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
* Split cache for spike and toolchain
Change-Id: I423c4ba28e44ec5126786897135fb245e164c664
Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
* Split cache for spike and toolchain - fix cache keys
Change-Id: I907bdb52f402b17a7829ea1d06cd395518de4cd3
Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
* Empty commit to re-trigger the CI
Change-Id: I749d44d8f0dde09ce5adf6e2e1ab5a5324f4018f
Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
---------
Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
Co-authored-by: Jan Matyas <jan.matyas@codasip.com>
Diffstat (limited to '.github')
-rw-r--r-- | .github/workflows/spike-openocd-tests.yml | 121 |
1 files changed, 84 insertions, 37 deletions
diff --git a/.github/workflows/spike-openocd-tests.yml b/.github/workflows/spike-openocd-tests.yml index 0f2bca3..72cc6ea 100644 --- a/.github/workflows/spike-openocd-tests.yml +++ b/.github/workflows/spike-openocd-tests.yml @@ -1,7 +1,14 @@ -# Build spike and run a couple of debug tests. +# Build Spike and run a couple of debug tests. name: Test OpenOCD against 2 spike configurations +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 + on: pull_request # There is some commented out code below that would be useful in adding this @@ -14,63 +21,103 @@ jobs: name: Test debug (Ubuntu) runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - name: Install Dependencies + - name: Install packages run: | - sudo apt install build-essential device-tree-compiler - -# - name: Download OpenOCD -# run: | -# git clone --recurse-submodules https://github.com/riscv/riscv-openocd.git -# cd riscv-openocd -# git checkout 43ea20dfbb6c815004a51106a3b2009d7f6c4940 + sudo apt-get update + sudo apt-get install -y device-tree-compiler build-essential - - name: Build OpenOCD + - name: Get revisions of dependencies run: | - #cd riscv-openocd - ./bootstrap - ./configure - make -j"$(nproc 2> /dev/null || sysctl -n hw.ncpu)" - ls -l src/openocd + 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 - - name: Download Toolchain - run: wget --progress=dot:giga 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 + - 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 - - name: Install Toolchain - run: tar zxf xpack-riscv-none-elf-gcc-12.2.0-1-linux-x64.tar.gz + - 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 - - name: Download spike + - if: ${{ steps.cache-spike.outputs.cache-hit != 'true' }} + name: Download Spike source (if not cached) run: | - git clone --recurse-submodules https://github.com/riscv-software-src/riscv-isa-sim - #cd riscv-isa-sim - #git checkout 43ea20dfbb6c815004a51106a3b2009d7f6c4940 + git clone "$SPIKE_REPO" + cd riscv-isa-sim + git checkout "$SPIKE_COMMIT" + git submodule update --init --recursive - - name: Build Spike + - if: ${{ steps.cache-spike.outputs.cache-hit != 'true' }} + name: Build Spike (if not cached) run: | cd riscv-isa-sim - mkdir build install - cd build - ../configure --prefix=`pwd`/install + mkdir build && cd build + ../configure --prefix=/opt/riscv/spike make -j"$(nproc 2> /dev/null || sysctl -n hw.ncpu)" make install + - 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 + - name: Download Tests run: | - git clone --recurse-submodules https://github.com/riscv-software-src/riscv-tests.git - #cd riscv-tests - #git checkout c84daca8824635b7d896003c78f9c6245997cf7a + git clone "$RISCV_TESTS_REPO" + cd riscv-tests + git checkout "$RISCV_TESTS_REV" + git submodule update --init --recursive - name: Run Tests run: | cd riscv-tests/debug ./gdbserver.py targets/RISC-V/spike32.py --print-failures \ - --gcc $GITHUB_WORKSPACE/xpack-riscv-none-elf-gcc-12.2.0-1/bin/riscv-none-elf-gcc \ - --gdb $GITHUB_WORKSPACE/xpack-riscv-none-elf-gcc-12.2.0-1/bin/riscv-none-elf-gdb \ - --sim_cmd $GITHUB_WORKSPACE/riscv-isa-sim/build/install/bin/spike \ + --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 \ --server_cmd $GITHUB_WORKSPACE/src/openocd ./gdbserver.py targets/RISC-V/spike64-2.py --print-failures \ - --gcc $GITHUB_WORKSPACE/xpack-riscv-none-elf-gcc-12.2.0-1/bin/riscv-none-elf-gcc \ - --gdb $GITHUB_WORKSPACE/xpack-riscv-none-elf-gcc-12.2.0-1/bin/riscv-none-elf-gdb \ - --sim_cmd $GITHUB_WORKSPACE/riscv-isa-sim/build/install/bin/spike \ + --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 \ --server_cmd $GITHUB_WORKSPACE/src/openocd + + - 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 |