Update TestRegisters for running on Linux (filed llvm.org/pr16301)
authorDaniel Malea <daniel.malea@intel.com>
Wed, 12 Jun 2013 00:13:43 +0000 (00:13 +0000)
committerDaniel Malea <daniel.malea@intel.com>
Wed, 12 Jun 2013 00:13:43 +0000 (00:13 +0000)
- skip the attach cases in TestRegisters.py -- caused slowness/sigabrt
- fixed log file removal function (in case test is run with -# flag)

llvm-svn: 183812

lldb/test/functionalities/register/TestRegisters.py

index ce546eb0ebd516fc5dbf7e2a8a9d4dd84c69d31b..e58ed14724ef0f3c86d09de9df00621935ca78e4 100644 (file)
@@ -45,6 +45,7 @@ class RegisterCommandsTestCase(TestBase):
         self.buildDefault()
         self.convenience_registers()
 
+    @skipIfLinux # llvm.org/pr16301 LLDB occasionally exits with SIGABRT 
     def test_convenience_registers_with_process_attach(self):
         """Test convenience registers after a 'process attach'."""
         if not self.getArchitecture() in ['x86_64']:
@@ -53,6 +54,7 @@ class RegisterCommandsTestCase(TestBase):
         self.convenience_registers_with_process_attach(test_16bit_regs=False)
 
     @expectedFailureLinux("llvm.org/pr14600") # Linux doesn't support 16-bit convenience registers
+    @skipIfLinux # llvm.org/pr16301 LLDB occasionally exits with SIGABRT 
     def test_convenience_registers_16bit_with_process_attach(self):
         """Test convenience registers after a 'process attach'."""
         if not self.getArchitecture() in ['x86_64']:
@@ -74,6 +76,11 @@ class RegisterCommandsTestCase(TestBase):
         self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
             substrs = ['stopped', 'stop reason = breakpoint'])
 
+    def remove_log(self):
+        """ Remove the temporary log file generated by some tests."""
+        if os.path.exists(self.log_file):
+            os.remove(self.log_file)
+
     # platform specific logging of the specified category
     def log_enable(self, category):
         self.platform = ""
@@ -83,11 +90,11 @@ class RegisterCommandsTestCase(TestBase):
             self.platform = "linux"
 
         if self.platform != "":
-            log_file = os.path.join(os.getcwd(), 'TestRegisters.log')
-            self.runCmd("log enable " + self.platform + " " + str(category) + " registers -v -f " + log_file, RUN_SUCCEEDED)
+            self.log_file = os.path.join(os.getcwd(), 'TestRegisters.log')
+            self.runCmd("log enable " + self.platform + " " + str(category) + " registers -v -f " + self.log_file, RUN_SUCCEEDED)
             if not self.has_teardown:
                 self.has_teardown = True
-                self.addTearDownHook(lambda: os.remove(log_file))
+                self.addTearDownHook(self.remove_log)
 
     def register_commands(self):
         """Test commands related to registers, in particular vector registers."""