From c0d0fc1e23007df3868c9b4906e71e8ea9b9faa7 Mon Sep 17 00:00:00 2001 From: DmitrievVadim Date: Wed, 27 Mar 2024 16:10:36 +0300 Subject: [PATCH] [OHOS][compiler-rt][test] Added 'OHOS' support to Ubsan tests Issue: https://gitee.com/openharmony/third_party_llvm-project/issues/I9D4T3 Signed-off-by: DmitrievVadim --- .../test/sanitizer_common/ohos_family_commands/ohos_run.py | 4 ++-- compiler-rt/test/ubsan/TestCases/Misc/Linux/lit.local.cfg.py | 2 +- compiler-rt/test/ubsan/TestCases/Misc/no-interception.cpp | 2 ++ .../test/ubsan/TestCases/TypeCheck/Linux/lit.local.cfg.py | 2 +- compiler-rt/test/ubsan/lit.common.cfg.py | 2 +- compiler-rt/test/ubsan_minimal/lit.common.cfg.py | 2 +- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/compiler-rt/test/sanitizer_common/ohos_family_commands/ohos_run.py b/compiler-rt/test/sanitizer_common/ohos_family_commands/ohos_run.py index 675e064fa8ff..6226a4d11c1e 100755 --- a/compiler-rt/test/sanitizer_common/ohos_family_commands/ohos_run.py +++ b/compiler-rt/test/sanitizer_common/ohos_family_commands/ohos_run.py @@ -45,8 +45,8 @@ def build_env(): if san_opt: value += ':abort_on_error=0' if key in ['ASAN_ACTIVATION_OPTIONS', 'SCUDO_OPTIONS'] or san_opt or key == 'LD_LIBRARY_PATH': - if key == 'TSAN_OPTIONS': - # Map TSan suppressions file to device + if key in ['TSAN_OPTIONS', 'UBSAN_OPTIONS']: + # Map TSan or UBSan suppressions file to device value = map_list(value, ':', r'(?<=suppressions=)(.+)', lambda m: (m.group(1), True)) elif key == 'LD_LIBRARY_PATH': # Map LD_LIBRARY_PATH to device diff --git a/compiler-rt/test/ubsan/TestCases/Misc/Linux/lit.local.cfg.py b/compiler-rt/test/ubsan/TestCases/Misc/Linux/lit.local.cfg.py index 57271b8078a4..ce7ce5ddde93 100644 --- a/compiler-rt/test/ubsan/TestCases/Misc/Linux/lit.local.cfg.py +++ b/compiler-rt/test/ubsan/TestCases/Misc/Linux/lit.local.cfg.py @@ -5,5 +5,5 @@ def getRoot(config): root = getRoot(config) -if root.host_os not in ['Linux']: +if root.host_os not in ['Linux', 'OHOS']: # OHOS_LOCAL config.unsupported = True diff --git a/compiler-rt/test/ubsan/TestCases/Misc/no-interception.cpp b/compiler-rt/test/ubsan/TestCases/Misc/no-interception.cpp index c82fed3bf3f6..7d5b40248c61 100644 --- a/compiler-rt/test/ubsan/TestCases/Misc/no-interception.cpp +++ b/compiler-rt/test/ubsan/TestCases/Misc/no-interception.cpp @@ -9,6 +9,8 @@ // Make sure that libc is first in DT_NEEDED. // RUN: %clangxx %s -lc -o %t %ld_flags_rpath_exe // RUN: %run %t 2>&1 | FileCheck %s +// OHOS_LOCAL +// UNSUPPORTED: ohos_family #include diff --git a/compiler-rt/test/ubsan/TestCases/TypeCheck/Linux/lit.local.cfg.py b/compiler-rt/test/ubsan/TestCases/TypeCheck/Linux/lit.local.cfg.py index 57271b8078a4..ce7ce5ddde93 100644 --- a/compiler-rt/test/ubsan/TestCases/TypeCheck/Linux/lit.local.cfg.py +++ b/compiler-rt/test/ubsan/TestCases/TypeCheck/Linux/lit.local.cfg.py @@ -5,5 +5,5 @@ def getRoot(config): root = getRoot(config) -if root.host_os not in ['Linux']: +if root.host_os not in ['Linux', 'OHOS']: # OHOS_LOCAL config.unsupported = True diff --git a/compiler-rt/test/ubsan/lit.common.cfg.py b/compiler-rt/test/ubsan/lit.common.cfg.py index 7108561a92c4..214833e240d6 100644 --- a/compiler-rt/test/ubsan/lit.common.cfg.py +++ b/compiler-rt/test/ubsan/lit.common.cfg.py @@ -68,7 +68,7 @@ config.substitutions.append( ("%gmlt ", " ".join(config.debug_info_flags) + " ") config.suffixes = ['.c', '.cpp', '.m'] # Check that the host supports UndefinedBehaviorSanitizer tests -if config.host_os not in ['Linux', 'Darwin', 'FreeBSD', 'Windows', 'NetBSD', 'SunOS', 'OpenBSD']: +if config.host_os not in ['Linux', 'Darwin', 'FreeBSD', 'Windows', 'NetBSD', 'SunOS', 'OpenBSD', 'OHOS']: # OHOS_LOCAL config.unsupported = True config.available_features.add('arch=' + config.target_arch) diff --git a/compiler-rt/test/ubsan_minimal/lit.common.cfg.py b/compiler-rt/test/ubsan_minimal/lit.common.cfg.py index 39800c968dbf..3455908413f4 100644 --- a/compiler-rt/test/ubsan_minimal/lit.common.cfg.py +++ b/compiler-rt/test/ubsan_minimal/lit.common.cfg.py @@ -30,7 +30,7 @@ config.substitutions.append( ("%clangxx ", build_invocation(clang_ubsan_cxxflags config.suffixes = ['.c', '.cpp'] # Check that the host supports UndefinedBehaviorSanitizerMinimal tests -if config.host_os not in ['Linux', 'FreeBSD', 'NetBSD', 'Darwin', 'OpenBSD', 'SunOS']: # TODO: Windows +if config.host_os not in ['Linux', 'FreeBSD', 'NetBSD', 'Darwin', 'OpenBSD', 'SunOS', 'OHOS']: # OHOS_LOCAL # TODO: Windows config.unsupported = True # Don't target x86_64h if the test machine can't execute x86_64h binaries. -- Gitee