blob: 6f4fcec43ea9fb1b7e697ace974f8c94c4dbb7d8 [file] [log] [blame]
The Android Open Source Projectf8057102009-03-15 16:47:16 -07001#! /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 Dubach99098102009-03-27 13:29:28 -070017if [ -z "${ANDROID_ROOT}" ]; then
The Android Open Source Projectf8057102009-03-15 16:47:16 -070018# CONFIGURATION
19# Set this variable to the out/host/<platform> directory of your Android tree.
Phil Dubach5723c122009-03-26 17:32:36 -070020ANDROID_ROOT=/.../out/host/linux-x86
21fi;
The Android Open Source Projectf8057102009-03-15 16:47:16 -070022
Phil Dubach99098102009-03-27 13:29:28 -070023if [ -z "${CTS_ROOT}" ]; then
The Android Open Source Projectf8057102009-03-15 16:47:16 -070024# CONFIGURATION
25# Set this variable to the root of unzipped CTS directory
26CTS_ROOT=
Phil Dubach5723c122009-03-26 17:32:36 -070027fi;
28
29# ----------------------------------------------------------------------------
30# END OF CONFIGURATION SECTION
31# ----------------------------------------------------------------------------
The Android Open Source Projectf8057102009-03-15 16:47:16 -070032
33# If ANDROID_ROOT does not exist, complain and exit
34if [ ! -d ${ANDROID_ROOT} ]; then
35 echo "Error: Please set ANDROID_ROOT in $0."
36 exit
37fi
38
39# If CTS_ROOT not set, assume it's under ANDROID_ROOT
40if [ -z "${CTS_ROOT}" ]; then
Phil Dubach99098102009-03-27 13:29:28 -070041 CTS_ROOT=${ANDROID_ROOT}/cts/android-cts
The Android Open Source Projectf8057102009-03-15 16:47:16 -070042fi
43
44if [ ! -d ${CTS_ROOT} ]; then
45 echo "Error: Can't locate CTS. Have you set the CTS_ROOT in $0?"
46 exit
47fi
48
Phil Dubach99098102009-03-27 13:29:28 -070049# configuration supplied as single argument
50CONFIG=
51# configuration supplied with --config option
52DDCONFIG=
53
54if [ $# -eq 1 ]; then
55 # single argument specifies configuration file
56 :
57else
Scott Sua5685342009-04-30 18:36:23 -070058 if [ $(echo "$*" | grep -c -e --config -) -gt 0 ]; then
Phil Dubach99098102009-03-27 13:29:28 -070059 # --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;
70fi;
71
72ANDROID_ROOT=${ANDROID_ROOT} bash ${CTS_ROOT}/tools/cts ${CONFIG} "$@" ${DDCONFIG}