1 #!/bin/bash 2 3 # Copyright (C) 2015 The Android Open Source Project 4 # 5 # Licensed under the Apache License, Version 2.0 (the "License"); 6 # you may not use this file except in compliance with the License. 7 # You may obtain a copy of the License at 8 # 9 # http://www.apache.org/licenses/LICENSE-2.0 10 # 11 # Unless required by applicable law or agreed to in writing, software 12 # distributed under the License is distributed on an "AS IS" BASIS, 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 # See the License for the specific language governing permissions and 15 # limitations under the License. 16 17 # Helper script for running unit tests for compatibility libraries 18 19 checkFile() { 20 if [ ! -f "$1" ]; then 21 echo "Unable to locate $1" 22 exit 23 fi; 24 } 25 26 # check if in Android build env 27 if [ ! -z ${ANDROID_BUILD_TOP} ]; then 28 HOST=`uname` 29 if [ "$HOST" == "Linux" ]; then 30 OS="linux-x86" 31 elif [ "$HOST" == "Darwin" ]; then 32 OS="darwin-x86" 33 else 34 echo "Unrecognized OS" 35 exit 36 fi; 37 fi; 38 39 JAR_DIR=${ANDROID_HOST_OUT}/framework 40 TF_CONSOLE=com.android.tradefed.command.Console 41 42 ############### Run the cts tests ############### 43 JARS=" 44 compatibility-host-util\ 45 cts-tradefed\ 46 ddmlib-prebuilt\ 47 hosttestlib\ 48 CtsDeqpTestCases\ 49 CtsDeqpRunnerTests\ 50 tradefed" 51 JAR_PATH= 52 for JAR in $JARS; do 53 checkFile ${JAR_DIR}/${JAR}.jar 54 JAR_PATH=${JAR_PATH}:${JAR_DIR}/${JAR}.jar 55 done 56 57 TEST_CLASSES=" 58 com.drawelements.deqp.runner.DeqpTestRunnerTest" 59 60 for CLASS in ${TEST_CLASSES}; do 61 java $RDBG_FLAG -cp ${JAR_PATH} ${TF_CONSOLE} run singleCommand host -n --class ${CLASS} "$@" 62 done 63