1#!/usr/bin/env sh
2
3set -e
4
5HERE=`dirname $0`
6cd $HERE/..
7ROOT=`pwd`
8
9DBGDIR=$ROOT/build/Debug
10RELDIR=$ROOT/build/Release
11
12if [ "$1" = "--debug" ]; then
13    DEBUG=$1
14    echo "running debug build"
15    shift
16fi
17
18if [ "$1" != "--no-clean" ]; then
19    echo "cleaning build before tests ..."
20    $ROOT/scripts/cleanall.sh
21else
22    shift
23fi
24
25echo "building before tests ..."
26$ROOT/scripts/build.sh $DEBUG
27
28echo "running test in debug build ..."
29cd $DBGDIR && ctest $ROOT
30
31if [ "$DEBUG" != "--debug" ]; then
32echo "running test in release build ..."
33cd $RELDIR && ctest $ROOT
34echo "TEST PASSED"
35else
36    echo "DEBUG TEST PASSED"
37fi
38
39if [ ! -e ${ROOT}/build/reflection_enabled ]; then
40    echo "(reflection disabled, skipping affected test and example)"
41fi
42
43