1# Run all tests 2 3PROGDIR=`dirname $0` 4PROGDIR=`cd $PROGDIR && pwd` 5 6# Assume that we are under tests/. 7# 8ROOTDIR=`dirname $PROGDIR` 9# 10# Sanity checks: 11# 12if [ -z "$NDK" ] ; then 13 echo "ERROR: Please define NDK in your environment to point to the root of your NDK install." 14 exit 1 15fi 16 17if [ ! -d "$NDK" ] ; then 18 echo "ERROR: Your NDK variable does not point to a directory: $NDK" 19 exit 2 20fi 21 22if [ ! -f "$NDK/ndk-build" -o ! -f "$NDK/build/core/ndk-common.sh" ] ; then 23 echo "ERROR: Your NDK variable does not point to a valid NDK directory: $NDK" 24 exit 3 25fi 26 27if [ ! -d "$NDK/platforms" ] ; then 28 echo "ERROR: Your NDK directory does not have a 'platforms' directory." 29 echo "Please run $NDK/build/tools/build-platforms.sh first !" 30 exit 3 31fi 32 33# 34# Parse options 35# 36JOBS= 37while [ -n "$1" ]; do 38 opt="$1" 39 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` 40 case "$opt" in 41 --help|-h|-\?) 42 OPTION_HELP=yes 43 ;; 44 --verbose) 45 VERBOSE=yes 46 ;; 47 -j*) 48 JOBS="$opt" 49 shift 50 ;; 51 --jobs=*) 52 JOBS="-j$optarg" 53 ;; 54 -*) # unknown options 55 echo "ERROR: Unknown option '$opt', use --help for list of valid ones." 56 exit 1 57 ;; 58 *) # Simply record parameter 59 if [ -z "$PARAMETERS" ] ; then 60 PARAMETERS="$opt" 61 else 62 PARAMETERS="$PARAMETERS $opt" 63 fi 64 ;; 65 esac 66 shift 67done 68 69if [ "$OPTION_HELP" = "yes" ] ; then 70 echo "Usage: $PROGNAME [options]" 71 echo "" 72 echo "Run all NDK automated tests at once." 73 echo "" 74 echo "Valid options:" 75 echo "" 76 echo " --help|-h|-? Print this help" 77 echo " --verbose Enable verbose mode" 78 echo " -j<N> --jobs=<N> Launch parallel builds" 79 echo "" 80 exit 0 81fi 82 83# 84# Create log file 85# 86MYLOG=/tmp/ndk-tests.log 87mkdir -p `dirname $MYLOG` 88rm -f $MYLOG 89echo "NDK automated tests log file" > $MYLOG 90 91if [ "$VERBOSE" = "yes" ] ; then 92run () 93{ 94 $NDK/ndk-build -B $JOBS 2>&1 95} 96else 97run () 98{ 99 $NDK/ndk-build -B $JOBS >> $MYLOG 2>&1 100} 101fi 102