Added an option for generating riscv vector tests during regression testing

This commit is contained in:
MichaelJSr 2025-02-17 19:31:11 -08:00
parent 3ce16c5546
commit 91429e600f
4 changed files with 95 additions and 7 deletions

View file

@ -117,7 +117,62 @@ jobs:
strategy:
fail-fast: false
matrix:
name: [regression, opencl, cache, config1, config2, debug, scope, stress, synthesis, vm, vector]
name: [regression, opencl, cache, config1, config2, debug, scope, stress, synthesis, vm]
xlen: [32, 64]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Dependencies
run: |
sudo bash ./ci/install_dependencies.sh
- name: Cache Toolchain Directory
id: cache-toolchain
uses: actions/cache@v4
with:
path: tools
key: ${{ runner.os }}-toolchain-v0.1
restore-keys: |
${{ runner.os }}-toolchain-
- name: Cache Third Party Directory
id: cache-thirdparty
uses: actions/cache@v4
with:
path: third_party
key: ${{ runner.os }}-thirdparty-v0.1
restore-keys: |
${{ runner.os }}-thirdparty-
- name: Download Build Artifact
uses: actions/download-artifact@v4
with:
name: build-${{ matrix.xlen }}
path: build${{ matrix.xlen }}
- name: Run tests
run: |
cd build${{ matrix.xlen }}
source ci/toolchain_env.sh
chmod -R +x . # Ensure all files have executable permissions
if [ "${{ matrix.name }}" == "regression" ]; then
./ci/regression.sh --unittest
./ci/regression.sh --isa
./ci/regression.sh --kernel
./ci/regression.sh --regression
else
./ci/regression.sh --${{ matrix.name }}
fi
vector-tests:
runs-on: ubuntu-22.04
needs: build
strategy:
fail-fast: false
matrix:
name: [vector]
xlen: [32, 64]
steps:

View file

@ -395,7 +395,7 @@ vector()
echo "begin vector tests..."
make -C sim/simx clean && CONFIGS="-DEXT_V_ENABLE" make -C sim/simx
TOOLDIR=@TOOLDIR@ XLEN=@XLEN@ VLEN=256 REG_TESTS=1 ./tests/riscv/riscv-vector-tests/run-test.sh
TOOLDIR=@TOOLDIR@ XLEN=@XLEN@ VLEN=256 REG_TESTS=1 GEN_TESTS=0 ./tests/riscv/riscv-vector-tests/run-test.sh
echo "vector tests done!"
}

View file

@ -0,0 +1,30 @@
#!/bin/bash
PREV_DIR=$(pwd)
sudo apt-get install device-tree-compiler
wget -O- -q https://go.dev/dl/go1.24.0.linux-amd64.tar.gz | tar -xzf -
git clone https://github.com/chipsalliance/riscv-vector-tests.git
cd riscv-vector-tests
wget -O- -q https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2024.04.12/riscv64-elf-ubuntu-22.04-gcc-nightly-2024.04.12-nightly.tar.gz | tar -xzf -
export RISCV=$PREV_DIR/riscv-vector-tests/riscv
export PATH=$PATH:$PREV_DIR/go/bin:$PREV_DIR/riscv-vector-tests/riscv/bin
git clone https://github.com/riscv-software-src/riscv-isa-sim.git
cd riscv-isa-sim
git reset --hard 91793ed7d964aa0031c5a9a31fa05ec3d11b3b0f
mkdir build && cd build
../configure --prefix=$RISCV
make -j$(nproc) && sudo make install
cd ../..
cd env
git clone https://github.com/riscv/riscv-test-env.git
cd ..
make generate-stage1 --environment-overrides VLEN=$VLEN XLEN=$XLEN MODE=machine && make all -j$(nproc) --environment-overrides VLEN=$VLEN XLEN=$XLEN MODE=machine
mv out/v"$VLEN"x"$XLEN"machine/bin/stage2 $PREV_DIR/v"$VLEN"x"$XLEN"
cd $PREV_DIR
sudo rm -rf riscv-vector-tests

View file

@ -64,21 +64,24 @@ fi
cd $SCRIPT_DIR
# Fallback #2: If testcases directory exists, we will use existing testcases
# Fallback #1: If testcases directory exists, use the existing testcases
if [ ! -d "$SCRIPT_DIR/testcases" ]; then
mkdir testcases
cd testcases
# Fallback #3: Otherwise, download testcases
vector_tests
# Fallback #2: Generate testcases
if [ -n "$GEN_TESTS" ] && [ $GEN_TESTS -eq 1 ]; then
/bin/bash ../gen-test.sh
# Fallback #3: Download testcases
else
vector_tests
fi
fi
cd $SCRIPT_DIR/testcases/v$VLEN"x"$XLEN
# Fallback #1: Copy locally generated testcases (assuming they exist)
rm *".ddr4.log"
for testcase in ${testcases[@]}; do
rm "$testcase"*.elf "$testcase"*.bin "$testcase"*.dump "$testcase"*.log
cp -f $SCRIPT_DIR/../../../third_party/riscv-vector-tests/out/v"$VLEN"x"$XLEN"machine/bin/stage2/"$testcase"* .
done
passed=0