diff --git a/lldb/packages/Python/lldbsuite/test/builders/builder.py b/lldb/packages/Python/lldbsuite/test/builders/builder.py index cb82dd4c98817b356a6297ff55245a2600432462..fdd3b35ca5de06e7a4cc95cf31cb53b903b3779c 100644 --- a/lldb/packages/Python/lldbsuite/test/builders/builder.py +++ b/lldb/packages/Python/lldbsuite/test/builders/builder.py @@ -68,17 +68,19 @@ class Builder: make system. """ - # If d is None or an empty mapping, just return an empty list. + # OHOS_LOCAL begin if not d: - return [] + d = {} - def setOrAppendVariable(k, v): - append_vars = ["CFLAGS", "CFLAGS_EXTRAS", "LD_EXTRAS"] - if k in append_vars and k in os.environ: - v = os.environ[k] + " " + v - return '%s=%s' % (k, v) + pattern = '%s=%s' + append_vars = ["CFLAGS", "CFLAGS_EXTRAS", "LD_EXTRAS"] + for var in append_vars: + val = (d.get(var, '') + ' ' + os.getenv(var, '')).strip() + if val: + d[var] = val - cmdline = [setOrAppendVariable(k, v) for k, v in list(d.items())] + cmdline = [pattern % (k, v) for k, v in d.items()] + # OHOS_LOCAL end return cmdline diff --git a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py b/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py index 317f19bd712f69042c3fde8e956f3c8e91764a06..fbd6e809ef708097ef63d593a9e86a89cf65c7cc 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py +++ b/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py @@ -54,9 +54,51 @@ def _run_adb_command(cmd, device_id): stdout, stderr = p.communicate() return p.returncode, stdout, stderr +# OHOS_LOCAL begin + +def getHostPlatform(): + """Returns the host platform running the test suite.""" + # Attempts to return a platform name matching a target Triple platform. + if sys.platform.startswith('linux'): + return 'linux' + elif sys.platform.startswith('win32') or sys.platform.startswith('cygwin'): + return 'windows' + elif sys.platform.startswith('darwin'): + return 'macosx' + elif sys.platform.startswith('freebsd'): + return 'freebsd' + elif sys.platform.startswith('netbsd'): + return 'netbsd' + else: + return sys.platform + +def getPlatform(): + """Returns the target platform which the tests are running on.""" + # Use the Apple SDK to determine the platform if set. + if configuration.apple_sdk: + platform = configuration.apple_sdk + dot = platform.find('.') + if dot != -1: + platform = platform[:dot] + if platform == 'iphoneos': + platform = 'ios' + return platform + + platform = configuration.lldb_platform_name + if platform is None: + platform = "host" + if platform == "qemu-user": + platform = "host" + if platform == "host": + return getHostPlatform() + if platform.startswith("remote-"): + if platform == "remote-android": + return "linux" + return platform[7:] + return platform def target_is_android(): - return configuration.lldb_platform_name == "remote-android" + return getPlatform() == "android" def android_device_api(): if not hasattr(android_device_api, 'result'): @@ -101,49 +143,10 @@ def finalize_build_dictionary(dictionary): return dictionary -def getHostPlatform(): - """Returns the host platform running the test suite.""" - # Attempts to return a platform name matching a target Triple platform. - if sys.platform.startswith('linux'): - return 'linux' - elif sys.platform.startswith('win32') or sys.platform.startswith('cygwin'): - return 'windows' - elif sys.platform.startswith('darwin'): - return 'macosx' - elif sys.platform.startswith('freebsd'): - return 'freebsd' - elif sys.platform.startswith('netbsd'): - return 'netbsd' - else: - return sys.platform - - def getDarwinOSTriples(): return lldbplatform.translate(lldbplatform.darwin_all) -def getPlatform(): - """Returns the target platform which the tests are running on.""" - # Use the Apple SDK to determine the platform if set. - if configuration.apple_sdk: - platform = configuration.apple_sdk - dot = platform.find('.') - if dot != -1: - platform = platform[:dot] - if platform == 'iphoneos': - platform = 'ios' - return platform - - platform = configuration.lldb_platform_name - if platform is None: - platform = "host" - if platform == "qemu-user": - platform = "host" - if platform == "host": - return getHostPlatform() - if platform.startswith("remote-"): - return platform[7:] - return platform - +# OHOS_LOCAL end def platformIsDarwin(): """Returns true if the OS triple for the selected platform is any valid apple OS""" diff --git a/lldb/test/API/commands/expression/import-std-module/forward_decl_from_module/TestForwardDeclFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/forward_decl_from_module/TestForwardDeclFromStdModule.py index 943aa5b77725281e1a6a95e0e5fbab67bdf6d2cf..6adf016727cc8345ffce0b33e9626cc61c403c11 100644 --- a/lldb/test/API/commands/expression/import-std-module/forward_decl_from_module/TestForwardDeclFromStdModule.py +++ b/lldb/test/API/commands/expression/import-std-module/forward_decl_from_module/TestForwardDeclFromStdModule.py @@ -37,4 +37,4 @@ class TestCase(TestBase): # Both `std::vector` and the type of the member have forward # declarations before their definitions. self.expect("expr --raw -- v", - substrs=['(std::__1::vector) $0 = {', 'f = nullptr', '}']) + patterns=[r'\(std::__[^:]*::vector\) \$0 = {', 'f = nullptr', '}']) diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr/TestDataFormatterLibcxxSharedPtr.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr/TestDataFormatterLibcxxSharedPtr.py index 663058e07653ce72f722e225659c11c17b2a9c2c..c646fccc2f5eb85dd9ff46cbf60594e5d40f78da 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr/TestDataFormatterLibcxxSharedPtr.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr/TestDataFormatterLibcxxSharedPtr.py @@ -68,7 +68,7 @@ class TestCase(TestBase): valobj = self.expect_var_path("sp_user", type="std::shared_ptr") self.assertRegex( valobj.summary, - "^std(::__1)?::shared_ptr::element_type @ 0x0*[1-9a-f][0-9a-f]+( strong=1)? weak=1", + "^std(::__[^:]*)?::shared_ptr::element_type @ 0x0*[1-9a-f][0-9a-f]+( strong=1)? weak=1", ) self.assertNotEqual(valobj.child[0].unsigned, 0) diff --git a/lldb/test/API/functionalities/thread/signal_during_breakpoint_step/TestSignalStepOverHandlerWithBreakpoint.py b/lldb/test/API/functionalities/thread/signal_during_breakpoint_step/TestSignalStepOverHandlerWithBreakpoint.py index ddafffdbd39d5d09245f1077ce47ec7b0b872b9a..84445b868b88dfdc3355c00496dedd0222070611 100644 --- a/lldb/test/API/functionalities/thread/signal_during_breakpoint_step/TestSignalStepOverHandlerWithBreakpoint.py +++ b/lldb/test/API/functionalities/thread/signal_during_breakpoint_step/TestSignalStepOverHandlerWithBreakpoint.py @@ -104,6 +104,9 @@ class TestSignalStepOverHandlerWithBreakpoint(SignalDuringBreakpointStepTestCase # Atomic sequences are not supported yet for MIPS in LLDB. # (Copied from concurrent_events/TestConcurrentSignalBreak.py) @skipIf(triple='^mips') + # Currently, lldb might skip the next stop when stepping out of the func, + # if the single-stepping is not emulated + @skipIf(archs=no_match(['arm'])) # Currently on arm, lldb might get wrong return addresses from a signal handler # and fail with 'could not create return address breakpoint' @skipIf(archs='arm') @@ -114,6 +117,9 @@ class TestSignalStepOverHandlerWithBreakpoint(SignalDuringBreakpointStepTestCase # Atomic sequences are not supported yet for MIPS in LLDB. # (Copied from concurrent_events/TestConcurrentSignalBreak.py) @skipIf(triple='^mips') + # Currently, lldb might skip the next stop when stepping out of the func, + # if the single-stepping is not emulated + @skipIf(archs=no_match(['arm'])) def test_breakpoint_inside_handler_continue(self): self.set_up_step_over_handler_with_breakpoint() self.set_up_and_iterate(self.action, True, self.check_handler_bp_continue) @@ -121,6 +127,9 @@ class TestSignalStepOverHandlerWithBreakpoint(SignalDuringBreakpointStepTestCase # Atomic sequences are not supported yet for MIPS in LLDB. # (Copied from concurrent_events/TestConcurrentSignalBreak.py) @skipIf(triple='^mips') + # Currently, lldb might skip the next stop when stepping out of the func, + # if the single-stepping is not emulated + @skipIf(archs=no_match(['arm'])) def test_breakpoint_inside_handler_continue_to_breakpoint(self): self.set_up_step_over_handler_with_breakpoint() self.set_up_and_iterate(self.action, False, self.check_handler_bp_continue)