The Android Open Source Project | f805710 | 2009-03-15 16:47:16 -0700 | [diff] [blame] | 1 | #! /bin/bash |
| 2 | |
| 3 | # Copyright (C) 2009 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 | |
Phil Dubach | 9909810 | 2009-03-27 13:29:28 -0700 | [diff] [blame^] | 17 | if [ -z "${ANDROID_ROOT}" ]; then |
The Android Open Source Project | f805710 | 2009-03-15 16:47:16 -0700 | [diff] [blame] | 18 | # CONFIGURATION |
| 19 | # Set this variable to the out/host/<platform> directory of your Android tree. |
Phil Dubach | 5723c12 | 2009-03-26 17:32:36 -0700 | [diff] [blame] | 20 | ANDROID_ROOT=/.../out/host/linux-x86 |
| 21 | fi; |
The Android Open Source Project | f805710 | 2009-03-15 16:47:16 -0700 | [diff] [blame] | 22 | |
Phil Dubach | 9909810 | 2009-03-27 13:29:28 -0700 | [diff] [blame^] | 23 | if [ -z "${CTS_ROOT}" ]; then |
The Android Open Source Project | f805710 | 2009-03-15 16:47:16 -0700 | [diff] [blame] | 24 | # CONFIGURATION |
| 25 | # Set this variable to the root of unzipped CTS directory |
| 26 | CTS_ROOT= |
Phil Dubach | 5723c12 | 2009-03-26 17:32:36 -0700 | [diff] [blame] | 27 | fi; |
| 28 | |
| 29 | # ---------------------------------------------------------------------------- |
| 30 | # END OF CONFIGURATION SECTION |
| 31 | # ---------------------------------------------------------------------------- |
The Android Open Source Project | f805710 | 2009-03-15 16:47:16 -0700 | [diff] [blame] | 32 | |
| 33 | # If ANDROID_ROOT does not exist, complain and exit |
| 34 | if [ ! -d ${ANDROID_ROOT} ]; then |
| 35 | echo "Error: Please set ANDROID_ROOT in $0." |
| 36 | exit |
| 37 | fi |
| 38 | |
| 39 | # If CTS_ROOT not set, assume it's under ANDROID_ROOT |
| 40 | if [ -z "${CTS_ROOT}" ]; then |
Phil Dubach | 9909810 | 2009-03-27 13:29:28 -0700 | [diff] [blame^] | 41 | CTS_ROOT=${ANDROID_ROOT}/cts/android-cts |
The Android Open Source Project | f805710 | 2009-03-15 16:47:16 -0700 | [diff] [blame] | 42 | fi |
| 43 | |
| 44 | if [ ! -d ${CTS_ROOT} ]; then |
| 45 | echo "Error: Can't locate CTS. Have you set the CTS_ROOT in $0?" |
| 46 | exit |
| 47 | fi |
| 48 | |
Phil Dubach | 9909810 | 2009-03-27 13:29:28 -0700 | [diff] [blame^] | 49 | # configuration supplied as single argument |
| 50 | CONFIG= |
| 51 | # configuration supplied with --config option |
| 52 | DDCONFIG= |
| 53 | |
| 54 | if [ $# -eq 1 ]; then |
| 55 | # single argument specifies configuration file |
| 56 | : |
| 57 | else |
| 58 | if [[ "$*" =~ "--config" ]]; then |
| 59 | # --config supplied on command line |
| 60 | : |
| 61 | else |
| 62 | if [ $# -eq 0 ]; then |
| 63 | # no arguments; supply config as single argument |
| 64 | CONFIG=${CTS_ROOT}/repository/host_config.xml |
| 65 | else |
| 66 | # no config; append --config to existing command line |
| 67 | DDCONFIG="--config ${CTS_ROOT}/repository/host_config.xml" |
| 68 | fi; |
| 69 | fi; |
| 70 | fi; |
| 71 | |
| 72 | ANDROID_ROOT=${ANDROID_ROOT} bash ${CTS_ROOT}/tools/cts ${CONFIG} "$@" ${DDCONFIG} |