From d097807bca3f3e6eb30ee38f5a6695e5014a180a Mon Sep 17 00:00:00 2001 From: Sukhikh Alexander Date: Tue, 11 Jun 2024 14:19:00 +0300 Subject: [PATCH 1/2] [compiler-rt] Set right file mode for tests on device, ignore local LD_LIBRARY_PATH on device Issue: https://gitee.com/openharmony/third_party_llvm-project/issues/IA4HAL Signed-off-by: Sukhikh Alexander --- compiler-rt/test/lit.common.cfg.py | 6 +++--- .../sanitizer_common/ohos_family_commands/ohos_common.py | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/compiler-rt/test/lit.common.cfg.py b/compiler-rt/test/lit.common.cfg.py index f3f7153e7340..6fb667ccb6d3 100644 --- a/compiler-rt/test/lit.common.cfg.py +++ b/compiler-rt/test/lit.common.cfg.py @@ -499,10 +499,10 @@ if config.android: adb = os.environ.get('ADB', 'adb') - # These are needed for tests to upload/download temp files, such as - # suppression-files, to device. - config.substitutions.append( ('%device_rundir/', "/data/local/tmp/Output/") ) if not config.host_os == 'OHOS': + # These are needed for tests to upload/download temp files, such as + # suppression-files, to device. + config.substitutions.append( ('%device_rundir/', "/data/local/tmp/Output/") ) config.substitutions.append( ('%push_to_device', "%s -s '%s' push " % (adb, env['ANDROID_SERIAL']) ) ) config.substitutions.append( ('%adb_shell ', "%s -s '%s' shell " % (adb, env['ANDROID_SERIAL']) ) ) config.substitutions.append( ('%device_rm', "%s -s '%s' shell 'rm ' " % (adb, env['ANDROID_SERIAL']) ) ) diff --git a/compiler-rt/test/sanitizer_common/ohos_family_commands/ohos_common.py b/compiler-rt/test/sanitizer_common/ohos_family_commands/ohos_common.py index 88cdb2d5ff44..6b061e9e0f10 100755 --- a/compiler-rt/test/sanitizer_common/ohos_family_commands/ohos_common.py +++ b/compiler-rt/test/sanitizer_common/ohos_family_commands/ohos_common.py @@ -55,7 +55,9 @@ def push_to_device(path): dst_path = host_to_device_path(path) # hdc do not auto create directories on device hdc(['shell', 'mkdir', '-p', os.path.dirname(dst_path)]) - hdc(['file', 'send', '-m', path, dst_path], attempts=5, check_stdout='FileTransfer finish') + hdc(['file', 'send', path, dst_path], attempts=5, check_stdout='FileTransfer finish') + file_mode = oct(os.stat(path).st_mode)[-3:] + hdc(['shell', 'chmod', file_mode, dst_path]) def map_path(path, do_push): if os.path.exists(path): @@ -122,4 +124,4 @@ def get_output_from_args(args): elif arg == '-o': output = args.pop(0) - return output, output_type \ No newline at end of file + return output, output_type -- Gitee From 397b1c5de78da991f7f92de519de30aebe89b82a Mon Sep 17 00:00:00 2001 From: Sukhikh Alexander Date: Tue, 11 Jun 2024 14:19:43 +0300 Subject: [PATCH 2/2] [build] Fail fast if some errors happen during the build Issue: https://gitee.com/openharmony/third_party_llvm-project/issues/IA4HAL Signed-off-by: Sukhikh Alexander --- llvm-build/build.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/llvm-build/build.py b/llvm-build/build.py index c0a88a1ce3f6..00096f0338a5 100755 --- a/llvm-build/build.py +++ b/llvm-build/build.py @@ -1085,7 +1085,7 @@ class LlvmCore(BuildUtils): '-Wl,--gc-sections', '-stdlib=libc++', '--rtlib=compiler-rt', - '-lunwind', + '-lunwind', '-Wl,--dynamicbase', '-Wl,--nxcompat', '-lucrt', @@ -1203,10 +1203,10 @@ class SysrootComposer(BuildUtils): python_execute_dir = os.path.join( self.get_python_dir(), 'bin', self.build_config.LLDB_PYTHON) llvm_gn_args = 'is_llvm_build=true startup_init_with_param_base=true use_thin_lto=false' - subprocess.run([python_execute_dir, hb_build_py, 'build', '--product-name', product_name, '--target-cpu', + self.check_call([python_execute_dir, hb_build_py, 'build', '--product-name', product_name, '--target-cpu', target_cpu, '--build-target', target_name, '--gn-args', gn_args, llvm_gn_args, '--deps-guard=false'], - shell=False, stdout=subprocess.PIPE, cwd=self.build_config.REPOROOT_DIR) + cwd=self.build_config.REPOROOT_DIR) def build_musl_libs(self, product_name, target_cpu, target_name, ohos_lib_dir, sysroot_lib_dir, ld_musl_lib, gn_args=''): @@ -2199,17 +2199,17 @@ class LlvmLibs(BuildUtils): if multilib_suffix: baseline_abi_file_path = self.merge_out_path(self.build_config.LLVM_BUILD_DIR, "libcxx_abidiff", llvm_triple, multilib_suffix, "libc++_shared.abi") - elf_common_path = self.merge_out_path('lib', + elf_common_path = self.merge_out_path('lib', f"libunwind-libcxxabi-libcxx-ndk-{str(llvm_triple)}-{multilib_suffix}", 'lib', llvm_triple, multilib_suffix) else: baseline_abi_file_path = self.merge_out_path(self.build_config.LLVM_BUILD_DIR, "libcxx_abidiff", llvm_triple, "libc++_shared.abi") - elf_common_path = self.merge_out_path('lib', + elf_common_path = self.merge_out_path('lib', f"libunwind-libcxxabi-libcxx-ndk-{str(llvm_triple)}", 'lib', llvm_triple) elf_file_path = self.merge_out_path(elf_common_path, "libc++_shared.so") abi_file_path = self.merge_out_path(elf_common_path, "libc++_shared.abi") - header_dir = self.merge_out_path('lib', + header_dir = self.merge_out_path('lib', f"libunwind-libcxxabi-libcxx-ndk-{str(llvm_triple)}", 'include', "c++", "v1") res = self.run_abi_check(elf_file_path, abi_file_path, baseline_abi_file_path, header_dir) if res: -- Gitee