| 1 |
#!/bin/bash |
| 2 |
############################################################################### |
| 3 |
# Copyright (C) Intel Corporation |
| 4 |
# |
| 5 |
# SPDX-License-Identifier: MIT |
| 6 |
############################################################################### |
| 7 |
# Run the test suite. |
| 8 |
# |
| 9 |
# Scope can be limited by providing subset of tests as argumene from among: |
| 10 |
# lint, unit |
| 11 |
set -o errexit ; set -o nounset |
| 12 |
|
| 13 |
if [ -z "$BASH_VERSION" ]; then |
| 14 |
echo "This script must be run under bash" |
| 15 |
exit 1 |
| 16 |
fi |
| 17 |
|
| 18 |
script_dir="$( cd "$(dirname "${BASH_SOURCE[0]:-$0}")" >/dev/null 2>&1 ; pwd -P )" |
| 19 |
|
| 20 |
source_dir="$(dirname "$script_dir")" |
| 21 |
build_dir="$source_dir/_build" |
| 22 |
|
| 23 |
if [ $# -eq 0 ]; then |
| 24 |
# if no arguments provided enable all testing |
| 25 |
do_lint=true |
| 26 |
do_unit=true |
| 27 |
else |
| 28 |
do_lint=false |
| 29 |
do_unit=false |
| 30 |
fi |
| 31 |
|
| 32 |
while test $# -gt 0 |
| 33 |
do |
| 34 |
case "$1" in |
| 35 |
lint) do_lint=true |
| 36 |
;; |
| 37 |
unit) do_unit=true |
| 38 |
;; |
| 39 |
*) echo "invalid option: '$1'"; |
| 40 |
exit 1 |
| 41 |
;; |
| 42 |
esac |
| 43 |
shift |
| 44 |
done |
| 45 |
|
| 46 |
if [ "$do_lint" = true ] ; then |
| 47 |
"$source_dir/script/lint" |
| 48 |
fi |
| 49 |
|
| 50 |
if [ "$do_unit" = true ] ; then |
| 51 |
ctest --test-dir "$build_dir" --C Release --output-on-failure -T test |
| 52 |
fi |