mirror of
https://github.com/riscv-software-src/riscv-isa-sim.git
synced 2025-10-14 02:07:30 +08:00
Build tests in CI rather than downloading a tarball from github
This commit is contained in:
3
.github/workflows/continuous-integration.yml
vendored
3
.github/workflows/continuous-integration.yml
vendored
@@ -18,7 +18,7 @@ on:
|
||||
jobs:
|
||||
test:
|
||||
name: Test Spike build (Ubuntu)
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
@@ -53,5 +53,4 @@ jobs:
|
||||
git checkout $commit
|
||||
echo "Checking commit $commit"
|
||||
ci-tests/build-spike
|
||||
ci-tests/test-spike
|
||||
done
|
||||
|
6
.github/workflows/debug-smoke.yml
vendored
6
.github/workflows/debug-smoke.yml
vendored
@@ -13,7 +13,7 @@ on:
|
||||
jobs:
|
||||
test:
|
||||
name: Test debug (Ubuntu)
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
@@ -55,10 +55,10 @@ jobs:
|
||||
./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/build/install/bin/spike \
|
||||
--sim_cmd $GITHUB_WORKSPACE/install/bin/spike \
|
||||
--server_cmd $GITHUB_WORKSPACE/riscv-openocd/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/build/install/bin/spike \
|
||||
--sim_cmd $GITHUB_WORKSPACE/install/bin/spike \
|
||||
--server_cmd $GITHUB_WORKSPACE/riscv-openocd/src/openocd
|
||||
|
@@ -1,19 +1,25 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
ROOT=`git rev-parse --show-toplevel`
|
||||
NPROCS="$(nproc 2> /dev/null || sysctl -n hw.ncpu)"
|
||||
HERE=`pwd`
|
||||
CI="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
INSTALL=$HERE/install
|
||||
BUILD=$HERE/build
|
||||
|
||||
rm -rf build
|
||||
rm -rf $INSTALL $BUILD
|
||||
mkdir $INSTALL $BUILD
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
mkdir install
|
||||
# build spike
|
||||
mkdir $BUILD/spike
|
||||
cd $BUILD/spike
|
||||
CFLAGS="-Werror -Wall -Wextra -Wvla"
|
||||
CXXFLAGS="-Wnon-virtual-dtor $CFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS" CFLAGS="$CFLAGS" $DIR/../configure --prefix=`pwd`/install
|
||||
make -j"$(nproc 2> /dev/null || sysctl -n hw.ncpu)"
|
||||
CXXFLAGS="$CXXFLAGS" CFLAGS="$CFLAGS" $ROOT/configure --prefix=$INSTALL
|
||||
make -j$NPROCS
|
||||
make check
|
||||
make install install-hdrs-list.h
|
||||
|
||||
# check that help message prints without error
|
||||
install/bin/spike -h
|
||||
$INSTALL/bin/spike -h
|
||||
|
@@ -1,35 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
rm -rf build
|
||||
|
||||
mkdir -p build/pk && cd "$_"
|
||||
`git rev-parse --show-toplevel`/../riscv-pk/configure --host=riscv64-unknown-elf --with-arch=rv64gc_zifencei
|
||||
make -j4
|
||||
cd -
|
||||
|
||||
mkdir -p build/hello && cd "$_"
|
||||
riscv64-unknown-elf-gcc -O2 -o hello `git rev-parse --show-toplevel`/ci-tests/hello.c
|
||||
cd -
|
||||
|
||||
mkdir -p build/dummy-slliuw && cd "$_"
|
||||
riscv64-unknown-elf-gcc -O2 -o dummy-slliuw `git rev-parse --show-toplevel`/ci-tests/dummy-slliuw.c
|
||||
cd -
|
||||
|
||||
mkdir -p build/dummycsr && cd "$_"
|
||||
riscv64-unknown-elf-gcc -O2 -o customcsr `git rev-parse --show-toplevel`/ci-tests/customcsr.c
|
||||
cd -
|
||||
|
||||
mkdir -p build/atomics && cd "$_"
|
||||
riscv64-unknown-elf-gcc -O2 -o atomics `git rev-parse --show-toplevel`/ci-tests/atomics.c
|
||||
cd -
|
||||
|
||||
|
||||
mv build/pk/pk .
|
||||
mv build/hello/hello .
|
||||
mv build/dummy-slliuw/dummy-slliuw .
|
||||
mv build/dummycsr/customcsr .
|
||||
mv build/atomics/atomics .
|
||||
tar -cf spike-ci.tar pk hello dummy-slliuw customcsr atomics
|
||||
|
||||
rm pk hello dummy-slliuw customcsr atomics
|
@@ -1,26 +1,43 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
ROOT=`git rev-parse --show-toplevel`
|
||||
NPROCS="$(nproc 2> /dev/null || sysctl -n hw.ncpu)"
|
||||
HERE=`pwd`
|
||||
CI="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
INSTALL=$HERE/install
|
||||
BUILD=$HERE/build
|
||||
RUN=$HERE/run
|
||||
|
||||
cd build
|
||||
# build pk
|
||||
rm -rf $BUILD/pk
|
||||
mkdir $BUILD/pk
|
||||
cd $BUILD/pk
|
||||
git clone https://github.com/riscv-software-src/riscv-pk.git
|
||||
riscv-pk/configure --host=riscv64-linux-gnu --prefix=$INSTALL
|
||||
make -j$NPROCS
|
||||
make install
|
||||
|
||||
# run a program and check for correct output
|
||||
mkdir run
|
||||
cd run
|
||||
wget https://github.com/riscv-software-src/riscv-isa-sim/releases/download/dummy-tag-for-ci-storage/spike-ci.tar
|
||||
tar xf spike-ci.tar
|
||||
time ../install/bin/spike --isa=rv64gc pk hello | grep "Hello, world! Pi is approximately 3.141588."
|
||||
../install/bin/spike --log-commits --isa=rv64gc pk atomics 2> /dev/null | grep "First atomic counter is 1000, second is 100"
|
||||
# build tests
|
||||
rm -rf $RUN
|
||||
mkdir $RUN
|
||||
cd $RUN
|
||||
riscv64-linux-gnu-gcc -static -O2 -o hello $CI/hello.c
|
||||
riscv64-linux-gnu-gcc -static -O2 -o dummy-slliuw $CI/dummy-slliuw.c
|
||||
riscv64-linux-gnu-gcc -static -O2 -o customcsr $CI/customcsr.c
|
||||
riscv64-linux-gnu-gcc -static -O2 -o atomics $CI/atomics.c
|
||||
|
||||
# check that including sim.h in an external project works
|
||||
g++ -std=c++2a -I../install/include -L../install/lib $DIR/testlib.cc -lriscv -o test-libriscv
|
||||
g++ -std=c++2a -I../install/include -L../install/lib $DIR/test-customext.cc -lriscv -o test-customext
|
||||
g++ -std=c++2a -I../install/include -L../install/lib $DIR/custom-csr.cc -lriscv -o test-custom-csr
|
||||
g++ -std=c++2a -I$INSTALL/include -L$INSTALL/lib $CI/testlib.cc -lriscv -o test-libriscv
|
||||
g++ -std=c++2a -I$INSTALL/include -L$INSTALL/lib $CI/test-customext.cc -lriscv -o test-customext
|
||||
g++ -std=c++2a -I$INSTALL/include -L$INSTALL/lib $CI/custom-csr.cc -lriscv -o test-custom-csr
|
||||
|
||||
# check that all installed headers are functional
|
||||
g++ -std=c++2a -I../install/include -L../install/lib $DIR/testlib.cc -lriscv -o /dev/null -include ../install-hdrs-list.h
|
||||
g++ -std=c++2a -I$INSTALL/include -L$INSTALL/lib $CI/testlib.cc -lriscv -o /dev/null -include $BUILD/spike/install-hdrs-list.h
|
||||
|
||||
LD_LIBRARY_PATH=../install/lib ./test-libriscv pk hello| grep "Hello, world! Pi is approximately 3.141588."
|
||||
LD_LIBRARY_PATH=../install/lib ./test-customext pk dummy-slliuw | grep "Executed successfully"
|
||||
LD_LIBRARY_PATH=../install/lib ./test-custom-csr pk customcsr | grep "Executed successfully"
|
||||
# run tests
|
||||
time $INSTALL/bin/spike --isa=rv64gc $BUILD/pk/pk hello | grep "Hello, world! Pi is approximately 3.141588."
|
||||
$INSTALL/bin/spike --log-commits --isa=rv64gc $BUILD/pk/pk atomics 2> /dev/null | grep "First atomic counter is 1000, second is 100"
|
||||
LD_LIBRARY_PATH=$INSTALL/lib ./test-libriscv $BUILD/pk/pk hello | grep "Hello, world! Pi is approximately 3.141588."
|
||||
LD_LIBRARY_PATH=$INSTALL/lib ./test-customext $BUILD/pk/pk dummy-slliuw | grep "Executed successfully"
|
||||
LD_LIBRARY_PATH=$INSTALL/lib ./test-custom-csr $BUILD/pk/pk customcsr | grep "Executed successfully"
|
||||
|
Reference in New Issue
Block a user