summaryrefslogtreecommitdiff
path: root/test/cheri
diff options
context:
space:
mode:
authorRobert Norton2018-03-15 13:27:07 +0000
committerRobert Norton2018-03-15 13:27:07 +0000
commit860034499374a4791371c3a2176497f45b2621a0 (patch)
tree62ac86717ab42023ebab7ffe9bb8576ddd344922 /test/cheri
parent3896c50644568214c06014eb54d27f86f3d446f3 (diff)
add test that cheri specs build (ocaml).
Diffstat (limited to 'test/cheri')
-rwxr-xr-xtest/cheri/run_tests.sh73
1 files changed, 73 insertions, 0 deletions
diff --git a/test/cheri/run_tests.sh b/test/cheri/run_tests.sh
new file mode 100755
index 00000000..29128a6d
--- /dev/null
+++ b/test/cheri/run_tests.sh
@@ -0,0 +1,73 @@
+#!/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 "Building CHERI 256 specification...\n"
+
+if make -C $SAILDIR/cheri cheri ;
+then
+ green "Building CHERI 256 specification" "ok"
+else
+ red "Building CHERI 256 specification" "fail"
+fi
+
+printf "Building CHERI 128 specification...\n"
+
+if make -C $SAILDIR/cheri cheri128 ;
+then
+ green "Building CHERI 128 specification" "ok"
+else
+ red "Building CHERI 128 specification" "fail"
+fi
+
+finish_suite "CHERI tests"
+
+printf "</testsuites>\n" >> $DIR/tests.xml
+