summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/riscv/run_tests.sh65
-rwxr-xr-xtest/run_tests.sh6
2 files changed, 71 insertions, 0 deletions
diff --git a/test/riscv/run_tests.sh b/test/riscv/run_tests.sh
new file mode 100755
index 00000000..9430efec
--- /dev/null
+++ b/test/riscv/run_tests.sh
@@ -0,0 +1,65 @@
+
+#!/usr/bin/env bash
+set -e
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+cd $DIR
+SAILDIR="$DIR/../.."
+
+RED='\033[0;31m'
+GREEN='\033[0;32m'
+YELLOW='\033[0;33m'
+NC='\033[0m'
+
+rm -f $DIR/tests.xml
+
+pass=0
+fail=0
+XML=""
+
+function green {
+ (( pass += 1 ))
+ printf "$1: ${GREEN}$2${NC}\n"
+ XML+=" <testcase name=\"$1\"/>\n"
+}
+
+function yellow {
+ (( fail += 1 ))
+ printf "$1: ${YELLOW}$2${NC}\n"
+ XML+=" <testcase name=\"$1\">\n <error message=\"$2\">$2</error>\n </testcase>\n"
+}
+
+function red {
+ (( fail += 1 ))
+ printf "$1: ${RED}$2${NC}\n"
+ XML+=" <testcase name=\"$1\">\n <error message=\"$2\">$2</error>\n </testcase>\n"
+}
+
+function finish_suite {
+ printf "$1: Passed ${pass} out of $(( pass + fail ))\n\n"
+ XML=" <testsuite name=\"$1\" tests=\"$(( pass + fail ))\" failures=\"${fail}\" timestamp=\"$(date)\">\n$XML </testsuite>\n"
+ printf "$XML" >> $DIR/tests.xml
+ XML=""
+ pass=0
+ fail=0
+}
+
+SAILLIBDIR="$DIR/../../lib/"
+
+printf "<testsuites>\n" >> $DIR/tests.xml
+
+cd $SAILDIR/riscv
+
+printf "Checking specification...\n"
+
+if $SAILDIR/sail prelude.sail riscv_types.sail riscv.sail 1> /dev/null;
+then
+ green "checked RISCV specification" "ok"
+else
+ red "checking RISCV specification" "fail"
+fi
+
+finish_suite "RISCV tests"
+
+prinf "</testsuites>\n" >> $DIR/tests.xml
+
diff --git a/test/run_tests.sh b/test/run_tests.sh
index b31a05ff..fc93929f 100755
--- a/test/run_tests.sh
+++ b/test/run_tests.sh
@@ -22,3 +22,9 @@ printf "* ARM spec tests *\n"
printf "******************************************\n\n"
./test/arm/run_tests.sh
+
+printf "******************************************\n"
+printf "* RISCV spec tests *\n"
+printf "******************************************\n\n"
+
+./test/riscv/run_tests.sh