summaryrefslogtreecommitdiffstats
path: root/tests/debuginfo/lit.site.cfg
blob: ad29ce0c91468a0ad06bde96ef8c932a43b1683c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# -*- Python -*-
#
# Copyright (C) 2012 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# Configuration file for the 'lit' test runner in Android libbcc
# This file is common to both host and target side tests 

import os

# Used to determine the absolute path of a tool. If env_var is set, it
# overrides the default behaviour of searching PATH for binary_name
def inferTool(lit, binary_name, env_var, PATH):
    # Determine which tool to use.
    tool = os.getenv(env_var)

    # If the user set the overriding environment variable, use it
    if tool and os.path.isfile(tool):
        return tool

    # Otherwise look in the path.
    tool = lit.util.which(binary_name, PATH)

    if not tool:
        lit.fatal("couldn't find " + binary_name + " program in " + PATH + " \
                  , try setting " + env_var + " in your environment")

    return os.path.abspath(tool)

# Get the base build directory for the android source tree from environment.
config.build_top = os.getenv('ANDROID_BUILD_TOP')

config.base_build_path = os.path.join(config.build_top, 'out', 'host',
  'linux-x86')

# testFormat: The test format to use to interpret tests.
config.test_format = lit.formats.ShTest()

# Tool used to verify debugger output against expected output in source
config.filecheck = inferTool(lit, 'FileCheck', 'FILECHECK', \
  os.path.join(config.base_build_path, 'bin'))

# Invokes GDB and captures output
config.test_bcc_debuginfo = inferTool(lit, 'test_bcc_debuginfo.pl', \
  'TEST_JIT_DEBUGINFO', os.path.join(config.build_top, 'frameworks', \
  'compile', 'libbcc', 'tests', 'debuginfo'))

# GDB
config.gdb = inferTool(lit, 'arm-linux-androideabi-gdb', 'GDB',
  config.environment['PATH'])

# GDB python plugin
config.gdb_plugin = inferTool(lit, 'android-commands.py',
  'ANDROID_GDB_PLUGIN', os.path.join(config.build_top, 'frameworks',
    'compile', 'libbcc', 'gdb_plugin'))
config.gdb_plugin_directory = os.path.dirname(config.gdb_plugin)

# Script interpreters that are not python
config.perl = inferTool(lit, 'perl', 'PERL', config.environment['PATH'])
config.sh = inferTool(lit, 'bash', 'BASH', config.environment['PATH'])

# Tools that are specific to running host-side debugger integration tests:
config.clang = inferTool(lit, 'clang', 'CLANG',
  os.path.join(config.base_build_path, 'bin')).replace('\\', '/')
config.bcc_driver = inferTool(lit, 'bcc', 'BCC_DRIVER',
  os.path.join(config.base_build_path, 'obj', 'EXECUTABLES', \
    'bcc_intermediates')).replace('\\', '/')

# Tools that are specific to running target-side debugger integration tests:
config.build_test_apk = inferTool(lit, 'build_test_apk.sh',
  'BUILD_TEST_APK',
  os.path.join(config.build_top, 'frameworks', 'compile', 'libbcc',
    'tests', 'debuginfo'))

#
## Apply common substitutions
#
config.substitutions.append( ('%Test_jit_debuginfo', config.perl \
                                + ' ' + config.test_bcc_debuginfo \
                                + ' ' + config.filecheck + ' ' ) )

#
## Print common configuration
#
if not lit.quiet:
    lit.note('using bash: %r' % config.sh)
    lit.note('using perl: %r' % config.perl)
    lit.note('using verification script: %r' % config.test_bcc_debuginfo)
    lit.note('using FileCheck: %r' % config.filecheck)
    lit.note('using GDB: %r' % config.gdb)