diff options
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
8 files changed, 54 insertions, 5 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py index cdaf8167711..313734a0400 100644 --- a/lldb/packages/Python/lldbsuite/test/dotest.py +++ b/lldb/packages/Python/lldbsuite/test/dotest.py @@ -1381,6 +1381,28 @@ def isMultiprocessTestRunner(): # test runner return not (is_inferior_test_runner or no_multiprocess_test_runner) +def getVersionForSDK(sdk): + sdk = str.lower(sdk) + full_path = seven.get_command_output('xcrun -sdk %s --show-sdk-path' % sdk) + basename = os.path.basename(full_path) + basename = os.path.splitext(basename)[0] + basename = str.lower(basename) + ver = basename.replace(sdk, '') + return ver + +def getPathForSDK(sdk): + sdk = str.lower(sdk) + full_path = seven.get_command_output('xcrun -sdk %s --show-sdk-path' % sdk) + if os.path.exists(full_path): return full_path + return None + +def setDefaultTripleForPlatform(): + if lldb_platform_name == 'ios-simulator': + triple_str = 'x86_64-apple-ios%s' % (getVersionForSDK('iphonesimulator')) + os.environ['TRIPLE'] = triple_str + return {'TRIPLE':triple_str} + return {} + def run_suite(): global just_do_benchmarks_test global dont_do_dsym_test @@ -1478,6 +1500,7 @@ def run_suite(): if lldb_platform_name: print("Setting up remote platform '%s'" % (lldb_platform_name)) lldb.remote_platform = lldb.SBPlatform(lldb_platform_name) + lldb.remote_platform_name = lldb_platform_name if not lldb.remote_platform.IsValid(): print("error: unable to create the LLDB platform named '%s'." % (lldb_platform_name)) exitTestSuite(1) @@ -1495,10 +1518,17 @@ def run_suite(): else: lldb.platform_url = None - if lldb_platform_working_dir: - print("Setting remote platform working directory to '%s'..." % (lldb_platform_working_dir)) - lldb.remote_platform.SetWorkingDirectory(lldb_platform_working_dir) - + platform_changes = setDefaultTripleForPlatform() + first = True + for key in platform_changes: + if first: + print("Environment variables setup for platform support:") + first = False + print("%s = %s" % (key,platform_changes[key])) + + if lldb_platform_working_dir: + print("Setting remote platform working directory to '%s'..." % (lldb_platform_working_dir)) + lldb.remote_platform.SetWorkingDirectory(lldb_platform_working_dir) lldb.remote_platform_working_dir = lldb_platform_working_dir lldb.DBG.SetSelectedPlatform(lldb.remote_platform) else: diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py b/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py index 0315748ef5b..83906b54630 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py @@ -17,6 +17,7 @@ class ProcessAttachTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) + @skipIfiOSSimulator def test_attach_to_process_by_id(self): """Test attach by process id""" self.build() diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py b/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py index f5e6b71a623..ed9d58f9088 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py @@ -24,6 +24,7 @@ class AttachDeniedTestCase(TestBase): return (err, shell_command.GetStatus(), shell_command.GetOutput()) @skipIfWindows + @skipIfiOSSimulator def test_attach_to_process_by_id_denied(self): """Test attach by process id denied""" self.build() diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/register/TestRegisters.py b/lldb/packages/Python/lldbsuite/test/functionalities/register/TestRegisters.py index d508c357efe..4a2427edf39 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/register/TestRegisters.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/register/TestRegisters.py @@ -24,6 +24,7 @@ class RegisterCommandsTestCase(TestBase): self.dbg.GetSelectedTarget().GetProcess().Destroy() TestBase.tearDown(self) + @skipIfiOSSimulator def test_register_commands(self): """Test commands related to registers, in particular vector registers.""" if not self.getArchitecture() in ['amd64', 'i386', 'x86_64']: @@ -31,6 +32,7 @@ class RegisterCommandsTestCase(TestBase): self.build() self.register_commands() + @skipIfiOSSimulator @skipIfTargetAndroid(archs=["i386"]) # Writing of mxcsr register fails, presumably due to a kernel/hardware problem def test_fp_register_write(self): """Test commands that write to registers, in particular floating-point registers.""" @@ -39,6 +41,7 @@ class RegisterCommandsTestCase(TestBase): self.build() self.fp_register_write() + @skipIfiOSSimulator @expectedFailureAndroid(archs=["i386"]) # "register read fstat" always return 0xffff @skipIfFreeBSD #llvm.org/pr25057 def test_fp_special_purpose_register_read(self): @@ -48,6 +51,7 @@ class RegisterCommandsTestCase(TestBase): self.build() self.fp_special_purpose_register_read() + @skipIfiOSSimulator def test_register_expressions(self): """Test expression evaluation with commands related to registers.""" if not self.getArchitecture() in ['amd64', 'i386', 'x86_64']: @@ -55,6 +59,7 @@ class RegisterCommandsTestCase(TestBase): self.build() self.register_expressions() + @skipIfiOSSimulator def test_convenience_registers(self): """Test convenience registers.""" if not self.getArchitecture() in ['amd64', 'x86_64']: @@ -62,6 +67,7 @@ class RegisterCommandsTestCase(TestBase): self.build() self.convenience_registers() + @skipIfiOSSimulator def test_convenience_registers_with_process_attach(self): """Test convenience registers after a 'process attach'.""" if not self.getArchitecture() in ['amd64', 'x86_64']: @@ -69,6 +75,7 @@ class RegisterCommandsTestCase(TestBase): self.build() self.convenience_registers_with_process_attach(test_16bit_regs=False) + @skipIfiOSSimulator def test_convenience_registers_16bit_with_process_attach(self): """Test convenience registers after a 'process attach'.""" if not self.getArchitecture() in ['amd64', 'x86_64']: diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py b/lldb/packages/Python/lldbsuite/test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py index 6b9eb321a0e..977254343aa 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py @@ -19,6 +19,7 @@ class CreateAfterAttachTestCase(TestBase): # not yet investigated. Revisit once required functionality # is implemented for FreeBSD. @skipIfWindows # Occasionally hangs on Windows, may be same as other issues. + @skipIfiOSSimulator def test_create_after_attach_with_popen(self): """Test thread creation after process attach.""" self.build(dictionary=self.getBuildFlags(use_cpp11=False)) @@ -29,6 +30,7 @@ class CreateAfterAttachTestCase(TestBase): @skipIfRemote @skipIfWindows # Windows doesn't have fork. @expectedFlakeyLinux("llvm.org/pr16229") # 1/100 dosep, build 3546, clang-3.5 x84_64 + @skipIfiOSSimulator def test_create_after_attach_with_fork(self): """Test thread creation after process attach.""" self.build(dictionary=self.getBuildFlags(use_cpp11=False)) diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py index 758824cde5d..5a43cffabc3 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbtest.py +++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py @@ -868,6 +868,10 @@ def skipIfNoSBHeaders(func): func(*args, **kwargs) return wrapper +def skipIfiOSSimulator(func): + """Decorate the item to skip tests that should be skipped on the iOS Simulator.""" + return unittest2.skipIf(hasattr(lldb, 'remote_platform_name') and lldb.remote_platform_name == 'ios-simulator', 'skip on the iOS Simulator')(func) + def skipIfFreeBSD(func): """Decorate the item to skip tests that should be skipped on FreeBSD.""" return skipIfPlatform(["freebsd"])(func) diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules index e72b2d0931e..071aa0e3544 100644 --- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules +++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules @@ -40,7 +40,7 @@ ifneq "$(TRIPLE)" "" triple_space = $(subst -, ,$(TRIPLE)) ARCH =$(word 1, $(triple_space)) TRIPLE_VENDOR =$(word 2, $(triple_space)) - triple_os_and_version =$(shell echo $(word 3, $(triple_space)) | sed -e 's/\(.*\)\([0-9]\.[0-9]\).*/\1 \2/') + triple_os_and_version =$(shell echo $(word 3, $(triple_space)) | sed 's/\([a-z]*\)\(.*\)/\1 \2/') TRIPLE_OS =$(word 1, $(triple_os_and_version)) TRIPLE_VERSION =$(word 2, $(triple_os_and_version)) ifeq "$(TRIPLE_VENDOR)" "apple" @@ -181,6 +181,7 @@ ifeq "$(OS)" "Darwin" else CFLAGS += $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) -I$(LLDB_BASE_DIR)include endif + CFLAGS += -include $(THIS_FILE_DIR)test_common.h $(TRIPLE_CFLAGS) # Use this one if you want to build one part of the result without debug information: diff --git a/lldb/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py b/lldb/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py index ba2f2d46cc0..47c3ba146ce 100644 --- a/lldb/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py +++ b/lldb/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py @@ -30,6 +30,7 @@ class HelloWorldTestCase(TestBase): TestBase.tearDown(self) @add_test_categories(['pyapi']) + @skipIfiOSSimulator def test_with_process_launch_api(self): """Create target, breakpoint, launch a process, and then kill it.""" self.build(dictionary=self.d) @@ -75,6 +76,7 @@ class HelloWorldTestCase(TestBase): @add_test_categories(['pyapi']) @expectedFailureWindows("llvm.org/pr24600") @expectedFailurei386("llvm.org/pr25338") + @skipIfiOSSimulator def test_with_attach_to_process_with_id_api(self): """Create target, spawn a process, and attach to it with process id.""" self.build(dictionary=self.d) @@ -104,6 +106,7 @@ class HelloWorldTestCase(TestBase): @add_test_categories(['pyapi']) @expectedFailureWindows("llvm.org/pr24600") @expectedFailurei386("llvm.org/pr25338") + @skipIfiOSSimulator def test_with_attach_to_process_with_name_api(self): """Create target, spawn a process, and attach to it with process name.""" self.build(dictionary=self.d) |