diff --git a/.github/workflows/build-spike.yml b/.github/workflows/build-spike.yml index 442e825e..9f613cd2 100644 --- a/.github/workflows/build-spike.yml +++ b/.github/workflows/build-spike.yml @@ -8,10 +8,10 @@ on: jobs: verilator: name: Build Spike - runs-on: ubuntu-latest + runs-on: [self-hosted, Linux, X64, gcp-custom-runners] + container: centos:8 env: TOOL_NAME: spike - TOOL_VERSION: d70ea67d DEBIAN_FRONTEND: "noninteractive" steps: @@ -39,8 +39,12 @@ jobs: - name: Install prerequisities if: ${{ steps.cache.outputs.cache-hit != 'true' }} run: | - sudo apt -qqy update && sudo apt -qqy --no-install-recommends install \ - git build-essential cmake ccache device-tree-compiler + sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* + sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* + sed -i 's/enabled=0/enabled=1/g' /etc/yum.repos.d/CentOS-Linux-PowerTools.repo + yum update -y + yum install -y epel-release + yum install -y git dtc ccache gcc gcc-c++ make - name: Build Spike if: ${{ steps.cache.outputs.cache-hit != 'true' }} @@ -51,7 +55,7 @@ jobs: export CC="ccache gcc" export CXX="ccache g++" pushd spike - git checkout ${{ env.TOOL_VERSION }} + git checkout ${TOOL_VERSION:-d70ea67d} mkdir build cd build ../configure --prefix=/opt/spike diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 3d8e3013..0cf3f727 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -4,31 +4,113 @@ on: push: pull_request: +env: + TOOL_VERSION: d70ea67d + jobs: - build-spike: - uses: ./.github/workflows/build-spike.yml - test-pyflow: + # build-spike: + # uses: ./.github/workflows/build-spike.yml + + # test-pyflow: + # runs-on: ubuntu-latest + # env: + # TEST: riscv_arithmetic_basic_test + # steps: + # - uses: actions/checkout@v4 + + # - name: Install dependencies + # run: sudo apt-get -qqy update && sudo apt-get -qqy install gcc-riscv64-linux-gnu git build-essential device-tree-compiler + + # - name: Setup python + # # python dependencies cannot be properly downloaded with new versions of python + # uses: actions/setup-python@v4 + # with: + # python-version: '3.9' + + # - name: Install python dependencies + # run: python3 -m pip install -r requirements.txt + + # - name: Build spike + # run: | + # git clone https://github.com/riscv-software-src/riscv-isa-sim spike + # mkdir -p spike/build + # cd spike/build + # git checkout $TOOL_VERSION + # ../configure --prefix=/opt/spike + # make -j`nproc` + # make install + # cd - + + # - name: Set variables + # run: | + # echo "RISCV_GCC=riscv64-linux-gnu-gcc" >> $GITHUB_ENV + # echo "RISCV_OBJCOPY=riscv64-linux-gnu-objcopy" >> $GITHUB_ENV + # echo "SPIKE_PATH=/opt/spike/bin" >> $GITHUB_ENV + # echo "PYTHONPATH=pygen" >> $GITHUB_ENV + + # - name: Generate Tests + # run: | + # set -eo pipefail + # python3 run.py --simulator pyflow \ + # --test $TEST --iss spike \ + # --start_seed 999 --iterations 1 --batch_size 1 \ + # --isa rv32imc --mabi ilp32 --steps gen -v -o test 2>&1 | tee test/generate.log + + # - name: Patch Tests + # run: find test/asm_test -name "*.S" -exec python3 .github/scripts/code_fixup.py -i {} -o {} \; + + # - name: Run tests + # run: | + # set -eo pipefail + # python3 run.py --simulator pyflow \ + # --test $TEST --iss spike --iss_timeout 60 \ + # --start_seed 999 --iterations 1 --batch_size 1 \ + # --isa rv32imc --mabi ilp32 --steps gcc_compile,iss_sim -v -o test 2>&1 | tee -a test/generate.log + + # - name: Upload logs + # uses: actions/upload-artifact@v3 + # if: always() + # with: + # path: | + # test/asm_test/*.log + # test/*.log + + test-riscv: + name: Test riscv + runs-on: [ self-hosted, Linux, X64, gcp-custom-runners ] + # needs: [build-spike] + container: centos:8 strategy: fail-fast: false matrix: test: - riscv_arithmetic_basic_test - runs-on: ubuntu-latest - needs: [build-spike] + # - riscv_rand_instr_test + # - riscv_jump_stress_test + # - riscv_loop_test + # - riscv_rand_jump_test + # - riscv_mmu_stress_test + # - riscv_no_fence_test + # - riscv_illegal_instr_test + # - riscv_ebreak_test + # - riscv_ebreak_debug_mode_test + # - riscv_full_interrupt_test + # - riscv_unaligned_load_store_test + # - riscv_non_compressed_instr_test + # - riscv_hint_instr_test + # - riscv_pmp_test + env: + GHA_EXTERNAL_DISK: additional-tools steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v3 - - name: Install dependencies - run: sudo apt-get -qqy update && sudo apt-get -qqy install gcc-riscv64-linux-gnu device-tree-compiler + - name: Prepare Environment + run: _secret_environment - - name: Setup python - # python dependencies cannot be properly downloaded with new versions of python - uses: actions/setup-python@v4 - with: - python-version: '3.9' - - - name: Install python dependencies - run: python3 -m pip install -r requirements.txt + - name: Setup Python 3.9 + run: | + yum update -y && yum install -y python39 + python3.9 -m pip install -r requirements.txt - name: Setup Cache Metadata id: cache_metadata @@ -51,23 +133,18 @@ jobs: key: ${{ env.cache_spike_key }} restore-keys: ${{ env.cache_spike_restore_key }} - - name: Set variables + - name: Set Variables run: | - echo "RISCV_GCC=riscv64-linux-gnu-gcc" >> $GITHUB_ENV - echo "RISCV_OBJCOPY=riscv64-linux-gnu-objcopy" >> $GITHUB_ENV echo "SPIKE_PATH=/opt/spike/bin" >> $GITHUB_ENV - echo "PYTHONPATH=pygen" >> $GITHUB_ENV + echo "RISCV_DV_ROOT=$PWD" >> $GITHUB_ENV - name: Generate Tests - run: | - set -eo pipefail - python3 run.py --simulator pyflow \ - --test ${{ matrix.test }} --iss spike \ - --start_seed 999 --iterations 1 --batch_size 1 \ - --isa rv32imc --mabi ilp32 --steps gen -v -o test 2>&1 | tee test/generate.log + run: _secret_riscv + env: + RISCV_TEST: ${{ matrix.test }} - name: Patch Tests - run: find test/asm_test -name "*.S" -exec python3 .github/scripts/code_fixup.py -i {} -o {} \; + run: find test/asm_test -name "*.S" -exec python3.9 .github/scripts/code_fixup.py -i {} -o {} \; - name: Run tests run: | @@ -84,3 +161,4 @@ jobs: path: | test/asm_test/*.log test/*.log +