Index: compiler-rt/trunk/test/hwasan/CMakeLists.txt =================================================================== --- compiler-rt/trunk/test/hwasan/CMakeLists.txt +++ compiler-rt/trunk/test/hwasan/CMakeLists.txt @@ -11,6 +11,9 @@ 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) Index: compiler-rt/trunk/test/hwasan/lit.site.cfg.in =================================================================== --- compiler-rt/trunk/test/hwasan/lit.site.cfg.in +++ compiler-rt/trunk/test/hwasan/lit.site.cfg.in @@ -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") Index: compiler-rt/trunk/test/lit.common.cfg =================================================================== --- compiler-rt/trunk/test/lit.common.cfg +++ compiler-rt/trunk/test/lit.common.cfg @@ -276,9 +276,14 @@ 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 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 Index: compiler-rt/trunk/test/lit.common.configured.in =================================================================== --- compiler-rt/trunk/test/lit.common.configured.in +++ compiler-rt/trunk/test/lit.common.configured.in @@ -36,6 +36,8 @@ 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)