[compiler-rt] r351260 - compiler-rt/test: Add a couple of convenience features for Android.
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 15 14:06:49 PST 2019
Author: pcc
Date: Tue Jan 15 14:06:48 2019
New Revision: 351260
URL: http://llvm.org/viewvc/llvm-project?rev=351260&view=rev
Log:
compiler-rt/test: Add a couple of convenience features for Android.
Add a ANDROID_SERIAL_FOR_TESTING CMake variable. This lets you
run the tests with multiple devices attached without having to set
ANDROID_SERIAL.
Add a mechanism for pushing files to the device. Currently most
sanitizers require llvm-symbolizer and the sanitizer runtime to
be pushed to the device. This lets the sanitizer make this happen
automatically before running the tests by specifying the paths in
the lit.site.cfg file.
Differential Revision: https://reviews.llvm.org/D56712
Modified:
compiler-rt/trunk/test/hwasan/CMakeLists.txt
compiler-rt/trunk/test/hwasan/lit.site.cfg.in
compiler-rt/trunk/test/lit.common.cfg
compiler-rt/trunk/test/lit.common.configured.in
Modified: compiler-rt/trunk/test/hwasan/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/hwasan/CMakeLists.txt?rev=351260&r1=351259&r2=351260&view=diff
==============================================================================
--- compiler-rt/trunk/test/hwasan/CMakeLists.txt (original)
+++ compiler-rt/trunk/test/hwasan/CMakeLists.txt Tue Jan 15 14:06:48 2019
@@ -11,6 +11,9 @@ foreach(arch ${HWASAN_TEST_ARCH})
string(TOUPPER ${arch} ARCH_UPPER_CASE)
set(CONFIG_NAME ${ARCH_UPPER_CASE})
+ # FIXME: Set this.
+ set(HWASAN_ANDROID_FILES_TO_PUSH [])
+
configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg)
Modified: compiler-rt/trunk/test/hwasan/lit.site.cfg.in
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/hwasan/lit.site.cfg.in?rev=351260&r1=351259&r2=351260&view=diff
==============================================================================
--- compiler-rt/trunk/test/hwasan/lit.site.cfg.in (original)
+++ compiler-rt/trunk/test/hwasan/lit.site.cfg.in Tue Jan 15 14:06:48 2019
@@ -4,6 +4,7 @@
config.name_suffix = "@HWASAN_TEST_CONFIG_SUFFIX@"
config.target_cflags = "@HWASAN_TEST_TARGET_CFLAGS@"
config.target_arch = "@HWASAN_TEST_TARGET_ARCH@"
+config.android_files_to_push = @HWASAN_ANDROID_FILES_TO_PUSH@
# Load common config for all compiler-rt lit tests.
lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured")
Modified: compiler-rt/trunk/test/lit.common.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lit.common.cfg?rev=351260&r1=351259&r2=351260&view=diff
==============================================================================
--- compiler-rt/trunk/test/lit.common.cfg (original)
+++ compiler-rt/trunk/test/lit.common.cfg Tue Jan 15 14:06:48 2019
@@ -276,9 +276,14 @@ else:
config.substitutions.append( ("%darwin_min_target_with_full_runtime_arc_support", "") )
if config.android:
+ env = os.environ.copy()
+ if config.android_serial:
+ env['ANDROID_SERIAL'] = config.android_serial
+ config.environment['ANDROID_SERIAL'] = config.android_serial
+
adb = os.environ.get('ADB', 'adb')
try:
- android_api_level_str = subprocess.check_output([adb, "shell", "getprop", "ro.build.version.sdk"]).rstrip()
+ android_api_level_str = subprocess.check_output([adb, "shell", "getprop", "ro.build.version.sdk"], env=env).rstrip()
except (subprocess.CalledProcessError, OSError):
lit_config.fatal("Failed to read ro.build.version.sdk (using '%s' as adb)" % adb)
try:
@@ -290,6 +295,12 @@ if config.android:
if android_api_level >= 28:
config.available_features.add('android-28')
+ # Prepare the device.
+ android_tmpdir = '/data/local/tmp/Output'
+ subprocess.check_call([adb, "shell", "mkdir", "-p", android_tmpdir], env=env)
+ for file in config.android_files_to_push:
+ subprocess.check_call([adb, "push", file, android_tmpdir], env=env)
+
if config.host_os == 'Linux':
# detect whether we are using glibc, and which version
# NB: 'ldd' is just one of the tools commonly installed as part of glibc
Modified: compiler-rt/trunk/test/lit.common.configured.in
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lit.common.configured.in?rev=351260&r1=351259&r2=351260&view=diff
==============================================================================
--- compiler-rt/trunk/test/lit.common.configured.in (original)
+++ compiler-rt/trunk/test/lit.common.configured.in Tue Jan 15 14:06:48 2019
@@ -36,6 +36,8 @@ set_default("use_thinlto", False)
set_default("use_lto", config.use_thinlto)
set_default("use_newpm", False)
set_default("android", @ANDROID_PYBOOL@)
+set_default("android_serial", "@ANDROID_SERIAL_FOR_TESTING@")
+set_default("android_files_to_push", [])
set_default("have_rpc_xdr_h", @HAVE_RPC_XDR_H@)
config.available_features.add('target-is-%s' % config.target_arch)
More information about the llvm-commits
mailing list