xref: /isa-l/tools/test_autorun.sh (revision f82746491e572def80fc7ffdcd8fd4aa966c5959)
1#!/usr/bin/env bash
2
3set -e #exit on fail
4
5# Override defaults if exist
6READLINK=readlink
7command -V greadlink >/dev/null 2>&1 && READLINK=greadlink
8
9# Run in build directory
10out="$PWD"
11src=$($READLINK -f $(dirname $0))/..
12cd "$src"
13
14# Echo environment info
15if test -d .git; then
16    branch=$(git describe --always)
17    commitid=$(git rev-parse HEAD)
18    brief=$(git log -1 --format='%s')
19    branch_changes=$(git diff --shortstat)
20fi
21if command -V uname >/dev/null 2>&1; then
22    node=$(uname -n)
23    os_name=$(uname -s)
24    os_all=$(uname -a)
25fi
26
27echo "Test report v1"
28echo "branch:              $branch"
29echo "brief:               $brief"
30echo "commitid:            $commitid"
31echo "node:                $node"
32echo "os_name:             $os_name"
33echo "os_all:              $os_all"
34echo "test_args:           $@"
35echo "changes:             $branch_changes"
36command -V lscpu > /dev/null 2>&1 && lscpu
37
38# Start tests
39
40# Check style first
41./tools/check_format.sh
42
43[ -z "$1" ] && ./tools/test_checks.sh
44
45while [ -n "$1" ]; do
46    case "$1" in
47	check )
48	    ./tools/test_checks.sh
49	    shift ;;
50	ext )
51            # Drop first argument, to pass the rest of the arguments to test_extended.sh
52            shift ;
53	    ./tools/test_extended.sh $@
54	    shift ;;
55	format )
56	    shift ;;
57	all )
58            # Drop first argument, to pass the rest of the arguments to test_extended.sh
59            shift ;
60	    ./tools/test_checks.sh
61	    ./tools/test_extended.sh $@
62	    shift ;;
63	* )
64	    echo $0 undefined option: $1
65	    shift ;;
66    esac
67done
68
69