lit.site.cfg 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. # Configuration file for the 'lit' test runner in Android libbcc
  18. # This file is common to both host and target side tests
  19. import os
  20. # Used to determine the absolute path of a tool. If env_var is set, it
  21. # overrides the default behaviour of searching PATH for binary_name
  22. def inferTool(lit, binary_name, env_var, PATH):
  23. # Determine which tool to use.
  24. tool = os.getenv(env_var)
  25. # If the user set the overriding environment variable, use it
  26. if tool and os.path.isfile(tool):
  27. return tool
  28. # Otherwise look in the path.
  29. tool = lit.util.which(binary_name, PATH)
  30. if not tool:
  31. lit.fatal("couldn't find " + binary_name + " program in " + PATH + " \
  32. , try setting " + env_var + " in your environment")
  33. return os.path.abspath(tool)
  34. # Get the base build directory for the android source tree from environment.
  35. config.build_top = os.getenv('ANDROID_BUILD_TOP')
  36. config.base_build_path = os.path.join(config.build_top, 'out', 'host',
  37. 'linux-x86')
  38. # testFormat: The test format to use to interpret tests.
  39. config.test_format = lit.formats.ShTest()
  40. # Tool used to verify debugger output against expected output in source
  41. config.filecheck = inferTool(lit, 'FileCheck', 'FILECHECK', \
  42. os.path.join(config.base_build_path, 'bin'))
  43. # Invokes GDB and captures output
  44. config.test_bcc_debuginfo = inferTool(lit, 'test_bcc_debuginfo.pl', \
  45. 'TEST_JIT_DEBUGINFO', os.path.join(config.build_top, 'frameworks', \
  46. 'compile', 'libbcc', 'tests', 'debuginfo'))
  47. # GDB
  48. config.gdb = inferTool(lit, 'arm-linux-androideabi-gdb', 'GDB',
  49. config.environment['PATH'])
  50. # GDB python plugin
  51. config.gdb_plugin = inferTool(lit, 'android-commands.py',
  52. 'ANDROID_GDB_PLUGIN', os.path.join(config.build_top, 'frameworks',
  53. 'compile', 'libbcc', 'gdb_plugin'))
  54. config.gdb_plugin_directory = os.path.dirname(config.gdb_plugin)
  55. # Script interpreters that are not python
  56. config.perl = inferTool(lit, 'perl', 'PERL', config.environment['PATH'])
  57. config.sh = inferTool(lit, 'bash', 'BASH', config.environment['PATH'])
  58. # Tools that are specific to running host-side debugger integration tests:
  59. config.clang = inferTool(lit, 'clang', 'CLANG',
  60. os.path.join(config.base_build_path, 'bin')).replace('\\', '/')
  61. config.bcc_driver = inferTool(lit, 'bcc', 'BCC_DRIVER',
  62. os.path.join(config.base_build_path, 'obj', 'EXECUTABLES', \
  63. 'bcc_intermediates')).replace('\\', '/')
  64. # Tools that are specific to running target-side debugger integration tests:
  65. config.build_test_apk = inferTool(lit, 'build_test_apk.sh',
  66. 'BUILD_TEST_APK',
  67. os.path.join(config.build_top, 'frameworks', 'compile', 'libbcc',
  68. 'tests', 'debuginfo'))
  69. #
  70. ## Apply common substitutions
  71. #
  72. config.substitutions.append( ('%Test_jit_debuginfo', config.perl \
  73. + ' ' + config.test_bcc_debuginfo \
  74. + ' ' + config.filecheck + ' ' ) )
  75. #
  76. ## Print common configuration
  77. #
  78. if not lit.quiet:
  79. lit.note('using bash: %r' % config.sh)
  80. lit.note('using perl: %r' % config.perl)
  81. lit.note('using verification script: %r' % config.test_bcc_debuginfo)
  82. lit.note('using FileCheck: %r' % config.filecheck)
  83. lit.note('using GDB: %r' % config.gdb)