You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
2.3 KiB
53 lines
2.3 KiB
#!/bin/bash
|
|
set -e
|
|
|
|
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
|
|
|
|
# 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
|
|
|
|
# build tests
|
|
rm -rf $RUN
|
|
mkdir -p $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
|
|
riscv64-linux-gnu-gcc -static -O2 -march=rv64gcv -o vector-sum $CI/vector-sum.c
|
|
|
|
# run snippy-based tests
|
|
wget https://github.com/syntacore/snippy/releases/download/snippy-2.1/snippy-x86_64-linux.tar.xz
|
|
tar xf snippy-x86_64-linux.tar.xz
|
|
|
|
# test that snippy runs
|
|
bin/llvm-snippy --version | grep "Snippy version: 2.1.0"
|
|
PATH="$PATH:$RUN/bin" "$ROOT"/ci-tests/run-snippy-tests.sh "$RUN" "$ROOT"/ci-tests/snippy-tests "$INSTALL"/bin/spike
|
|
|
|
# check that including sim.h in an external project works
|
|
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 $CI/testlib.cc -lriscv -o /dev/null -include $BUILD/spike/install-hdrs-list.h
|
|
|
|
# run tests
|
|
time $INSTALL/bin/spike --isa=rv64gc $BUILD/pk/pk hello | grep "Hello, world! Pi is approximately 3.141588."
|
|
time $INSTALL/bin/spike --isa=rv64gcv $BUILD/pk/pk vector-sum | grep "The sum of the first 1000 positive integers is 500500."
|
|
$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"
|
|
|