diff options
Diffstat (limited to 'run-tests.sh')
-rwxr-xr-x | run-tests.sh | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/run-tests.sh b/run-tests.sh new file mode 100755 index 0000000..bbdc73a --- /dev/null +++ b/run-tests.sh @@ -0,0 +1,72 @@ +#!/bin/bash + +# Copyright 2014, ARM Limited +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of ARM Limited nor the names of its contributors may be +# used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +BIN=./pointer_tagging_tests + +if [ ! -x $BIN ]; then + echo "Couldn't find $BIN. Please run 'make' first." + echo "See README.md for details." + exit +fi + +if [ -t 1 ]; then + CLR_PASS="\033[1;32m" + CLR_FAIL="\033[1;31m" + CLR_RESET="\033[m" +else + CLR_PASS="" + CLR_FAIL="" + CLR_RESET="" +fi + +# Filter the test list. +if [ $# == 0 ]; then + TEST_LIST=`$BIN --list` +else + TEST_LIST=`$BIN --list | grep "$1"` +fi +TEST_COUNT=`echo "$TEST_LIST" | wc -l` + +if [ -z "$TEST_LIST" ]; then + echo "No matching tests." + exit +fi + +echo "==== Running $TEST_COUNT tests. ====" +for TEST in $TEST_LIST +do + OUT=`$BIN --test $TEST 2>&1` + if [ $? == 0 ]; then + echo -e "Test '$TEST' ${CLR_PASS}PASSED${CLR_RESET}." + else + echo -e "Test '$TEST' ${CLR_FAIL}FAILED${CLR_RESET}." + if [ -n "$OUT" ]; then + echo -e "Output:\n$OUT\n" + fi + fi +done |