1# -*- Python -*-
2#
3# Copyright (C) 2012 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
18#
19### Configuration file for target side debugger integration tests
20#
21# Parameters available through lit --param options:
22#   android_sdk - Path to the android SDK directory 
23#   sdk_version - SDK target to pass to 'android' for creating test projects
24#   minimum_sdk - SDK minimum version to embed in AndroidManifest.xml
25
26# If the user is running an individual tests directory, we have to load
27# the libbcc site configuration first
28build_top = getattr(config, 'build_top', None)
29if build_top is None:
30  lit.load_config(config, os.path.join(os.getenv('ANDROID_BUILD_TOP',
31    '../../../../../'), 'frameworks', 'compile', 'libbcc', 'tests',
32    'debuginfo', 'lit.site.cfg'))
33  build_top = config.build_top
34
35# Default SDK path and version
36default_sdk_dir = os.path.join(config.base_build_path, 'sdk', 'android-sdk_' \
37                    + os.getenv('TARGET_BUILD_VARIANT') + '.' \
38                    + os.getenv('USER') + '_linux-x86')
39default_sdk_version = "android-JellyBean"
40default_minimum_sdk = "JellyBean"
41
42# Set up the suite name, extensions that are recognized as testcases, and
43# the target triple string that must be used in cases marked expected failures
44config.name = 'target_renderscript_debug'
45config.suffixes = ['.rs']
46config.target_triple = 'target-bcc'
47
48# Output directory in the android source tree
49if os.getenv('TARGET_BUILD_TYPE', None) == 'debug':
50  config.test_exec_root = os.path.join(config.build_top, 'out', 'debug',
51    'target', 'tests', 'rsdebug')
52else:
53  config.test_exec_root = os.path.join(config.build_top, 'out', 'target',
54    'tests', 'rsdebug')
55
56#
57## Set up SDK path and version
58#
59config.sdk_dir = lit.params.get('android_sdk', default_sdk_dir)
60if not os.path.isdir(config.sdk_dir):
61  lit.fatal("Android SDK directory " + config.sdk_dir + " does " \
62    + "not exist. Check --param android_sdk=<path> lit parameter in test " \
63    + "suite invocation.")
64
65config.sdk_version = lit.params.get('sdk_version', default_sdk_version)
66config.minimum_sdk = lit.params.get('minimum_sdk', default_minimum_sdk)
67
68#
69## Set up environment variables
70#
71
72# Propagate ANDROID_PRODUCT_OUT to child environment
73config.environment['ANDROID_PRODUCT_OUT'] = os.getenv('ANDROID_PRODUCT_OUT')
74config.environment['ANDROID_BUILD_TOP'] = os.getenv('ANDROID_BUILD_TOP')
75
76config.environment['DEBUGGER'] = config.gdb
77config.environment['DEBUGGER_ARGS'] = "-d " + config.gdb_plugin_directory + ' '
78
79if not lit.quiet:
80    lit.note('using Android SDK: %r' % config.sdk_dir)
81    lit.note('using Android SDK Version: %r' % config.sdk_version)
82    lit.note('using test apk builder: %r' % config.build_test_apk)
83    lit.note('using GDB plugin directory: %r' % config.gdb_plugin_directory)
84
85# Apply target-side test macro substitutions
86config.substitutions.append( ('%build_test_apk_opts', ' --sdk ' + config.sdk_dir \
87                                                    + ' --target ' + config.sdk_version \
88                                                    + ' --minsdk ' + config.minimum_sdk))
89config.substitutions.append( ('%build_test_apk', ' ' + config.sh \
90                                               + ' ' + config.build_test_apk + ' '))
91