1# Copyright (C) 2016 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15'''LLDB-Renderscript test suite configuration file.
16
17This file contains the default test suite config which will be used in the
18case a developer did not supply a custom one.'''
19
20import os
21from tests.harness.decorators import deprecated
22
23
24class Config(object):
25    '''Test suite configuration object.
26
27    The Config class is used by the test suite to abstract the specifics of a
28    user's local setup.  This config can be overridden by specifying a custom
29    config on the command line.'''
30    # pylint: disable=no-self-use
31
32    @property
33    def adb_path(self):
34        '''Path to android debug bridge on the host.'''
35        return 'adb'
36
37    @property
38    def host_port(self):
39        '''Specify host port which lldb-server will be forwarded to.
40
41        Specify the starting host port number that lldb-server (on the target)
42        will be forwarded to on the host. Each successive test will increment
43        onwards from this initial port.'''
44        return 1234
45
46    @property
47    def device_port(self):
48        '''Specify the port number that lldb-server (on the device) listens on.
49
50        When lldb-server is spawned on the device it will listen on this port.
51        Each successive test will increment onwards from this port.'''
52        return 1234
53
54    @property
55    def lldb_server_path_device(self):
56        '''Path to the lldb-server executable on the device.'''
57        return '/data/lldb-server'
58
59    @property
60    def lldb_server_path_host(self):
61        '''Path to the lldb-server executable on host (if using -run-emu).'''
62        return 'lldb-server'
63
64    @property
65    def aosp_product_path(self):
66        '''The path to the "out" folder of the AOSP repository.'''
67        return os.getenv('ANDROID_PRODUCT_OUT')
68
69    @property
70    def log_file_path(self):
71        '''The path to the folder where the log file will be placed.'''
72        return os.path.join(os.getcwd(), 'LLDBTestsuiteLog.txt')
73
74    @property
75    def results_file_path(self):
76        '''Output folder where junit results.xml file will be placed.'''
77        return os.path.join(os.getcwd(), 'results.xml')
78
79    @property
80    def lldb_path(self):
81        '''The path to lldb executable on the host.'''
82        return 'lldb'
83
84    @property
85    def blacklist(self):
86        '''Provide a test blacklist for skipping specific tests.
87
88        To specify the blacklist from the command line the following can be
89        used: --blacklist test1.py test2.py ...'''
90        return []
91
92    @property
93    def verbose(self):
94        '''Flag to indicate whether to store extra output in the logs.'''
95        return False
96
97    @property
98    def device(self):
99        '''Specify the device id of the device to run on.
100
101        When multiple devices or emulators are present, a specific device to
102        use while testing can be indicated here.'''
103        return os.environ.get('ANDROID_SERIAL')
104
105    @property
106    def timeout(self):
107        '''Timeout period for a single command, expressed in seconds'''
108        return 60 * 15
109
110    @property
111    @deprecated()
112    def emu_cmd(self):
113        '''The command line for the emulator (if using -run-emu).'''
114        return os.path.join(os.path.dirname(__file__), '..', '..', '..', '..',
115                            'prebuilts', 'android-emulator', 'linux-x86_64',
116                            'emulator')
117