From 7a7f5e0925df7a72138a8d645f14b8ad6bd06f09 Mon Sep 17 00:00:00 2001 From: Lyupa Anastasia Date: Wed, 3 Jul 2024 16:49:39 +0300 Subject: [PATCH] [test][Sanitizer] Fix running tests with adb Issue: https://gitee.com/openharmony/third_party_llvm-project/issues/IAAEFI Signed-off-by: Lyupa Anastasia --- compiler-rt/CMakeLists.txt | 5 +++-- compiler-rt/test/lit.common.cfg.py | 2 ++ .../sanitizer_common/android_commands/android_common.py | 1 + .../sanitizer_common/android_commands/android_compile.py | 7 ++++++- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt index ff5eb2399de6..e8ba657bbc49 100644 --- a/compiler-rt/CMakeLists.txt +++ b/compiler-rt/CMakeLists.txt @@ -117,8 +117,9 @@ if ("${COMPILER_RT_DEFAULT_TARGET_TRIPLE}" MATCHES ".*android.*") set(ANDROID_API_LEVEL ${CMAKE_MATCH_2}) endif() -# We define OHOS for ohos targets for now -if (OHOS) +# We define OHOS for ohos targets for now. By default we use devices with hdc connection to test OHOS +# targets. It's also possible to use devices with adb connection which is enabled via ANDROID. +if (OHOS AND NOT ANDROID) set(OHOS_FAMILY 1) endif() diff --git a/compiler-rt/test/lit.common.cfg.py b/compiler-rt/test/lit.common.cfg.py index f3f7153e7340..b30fa67a0515 100644 --- a/compiler-rt/test/lit.common.cfg.py +++ b/compiler-rt/test/lit.common.cfg.py @@ -523,6 +523,8 @@ if config.android: # FIXME: Replace with appropriate version when availible. if android_api_level > 30 or (android_api_level == 30 and android_api_codename == 'S'): config.available_features.add('android-thread-properties-api') + else: + config.environment['OHOS_REMOTE_DYN_LINKER'] = os.environ.get('OHOS_REMOTE_DYN_LINKER') # Prepare the device. android_tmpdir = '/data/local/tmp/Output' diff --git a/compiler-rt/test/sanitizer_common/android_commands/android_common.py b/compiler-rt/test/sanitizer_common/android_commands/android_common.py index 81caae8741c2..53e364f8e24b 100644 --- a/compiler-rt/test/sanitizer_common/android_commands/android_common.py +++ b/compiler-rt/test/sanitizer_common/android_commands/android_common.py @@ -3,6 +3,7 @@ import time ANDROID_TMPDIR = '/data/local/tmp/Output' ADB = os.environ.get('ADB', 'adb') +DYN_LINKER = os.environ.get('OHOS_REMOTE_DYN_LINKER') # OHOS_LOCAL verbose = False if os.environ.get('ANDROID_RUN_VERBOSE') == '1': diff --git a/compiler-rt/test/sanitizer_common/android_commands/android_compile.py b/compiler-rt/test/sanitizer_common/android_commands/android_compile.py index 8f657d32be56..3b65e0edf2c8 100755 --- a/compiler-rt/test/sanitizer_common/android_commands/android_compile.py +++ b/compiler-rt/test/sanitizer_common/android_commands/android_compile.py @@ -24,7 +24,12 @@ if output == None: print("No output file name!") sys.exit(1) -ret = subprocess.call(sys.argv[1:]) +# OHOS_LOCAL begin +append_args = [] +if DYN_LINKER: + append_args.append('-Wl,--dynamic-linker=' + DYN_LINKER) +ret = subprocess.call(sys.argv[1:] + append_args) +# OHOS_LOCAL end if ret != 0: sys.exit(ret) -- Gitee