From df64ad62300e06f89061214e7cd8237fd670c015 Mon Sep 17 00:00:00 2001 From: Prashanth Mundkur Date: Thu, 14 Nov 2019 18:22:06 -0800 Subject: Add a script to just run the fdext tests. --- test/run_fp_tests.sh | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100755 test/run_fp_tests.sh (limited to 'test') diff --git a/test/run_fp_tests.sh b/test/run_fp_tests.sh new file mode 100755 index 0000000..abdfad5 --- /dev/null +++ b/test/run_fp_tests.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +set -e + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +cd $DIR +RISCVDIR="$DIR/.." + +RED='\033[0;91m' +GREEN='\033[0;92m' +YELLOW='\033[0;93m' +NC='\033[0m' + +rm -f $DIR/tests.xml + +pass=0 +fail=0 +XML="" + +function green { + (( pass += 1 )) + printf "$1: ${GREEN}$2${NC}\n" + XML+=" \n" +} + +function yellow { + (( fail += 1 )) + printf "$1: ${YELLOW}$2${NC}\n" + XML+=" \n $2\n \n" +} + +function red { + (( fail += 1 )) + printf "$1: ${RED}$2${NC}\n" + XML+=" \n $2\n \n" +} + +function finish_suite { + printf "$1: Passed ${pass} out of $(( pass + fail ))\n\n" + XML=" \n$XML \n" + printf "$XML" >> $DIR/tests.xml + XML="" + pass=0 + fail=0 +} + +SAILLIBDIR="$DIR/../../lib/" + +printf "\n" >> $DIR/tests.xml + +cd $RISCVDIR + +# Do 'make clean' to avoid cross-arch pollution. +make clean + +if make c_emulator/riscv_sim_RV64; +then + green "Building 64-bit RISCV C emulator" "ok" +else + red "Building 64-bit RISCV C emulator" "fail" +fi +for test in $DIR/riscv-tests/rv64u{f,d}*.elf rv64mi-p-csr.elf; do + if timeout 5 $RISCVDIR/c_emulator/riscv_sim_RV64 -p $test > ${test%.elf}.cout 2>&1 && grep -q SUCCESS ${test%.elf}.cout + then + green "C-64 $(basename $test)" "ok" + else + red "C-64 $(basename $test)" "fail" + fi +done +finish_suite "64-bit RISCV C tests" + +printf "\n" >> $DIR/tests.xml -- cgit v1.1