[Lldb-commits] [lldb] r248889 - Fix TestAttachDenied on linux

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 30 03:59:39 PDT 2015


Author: labath
Date: Wed Sep 30 05:59:39 2015
New Revision: 248889

URL: http://llvm.org/viewvc/llvm-project?rev=248889&view=rev
Log:
Fix TestAttachDenied on linux

This test was timing out because the test inferior was forking a child, which was not terminated
correctly. The test contained provisions to terminate this child, but these were no longer
working. The idea was to wake up upon receiving SIGTERM and then kill the child. However, this
was failing because the test first tried to use SIGHUP, which ended up killing the inferior.

Fix: make sure we catch SIGHUP also.

Modified:
    lldb/trunk/test/functionalities/process_attach/attach_denied/TestAttachDenied.py
    lldb/trunk/test/functionalities/process_attach/attach_denied/main.cpp

Modified: lldb/trunk/test/functionalities/process_attach/attach_denied/TestAttachDenied.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/process_attach/attach_denied/TestAttachDenied.py?rev=248889&r1=248888&r2=248889&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/process_attach/attach_denied/TestAttachDenied.py (original)
+++ lldb/trunk/test/functionalities/process_attach/attach_denied/TestAttachDenied.py Wed Sep 30 05:59:39 2015
@@ -21,7 +21,6 @@ class AttachDeniedTestCase(TestBase):
         return (err, shell_command.GetStatus(), shell_command.GetOutput())
 
     @skipIfWindows
-    @skipIfLinux # hanging after reviews D13124 change went in
     def test_attach_to_process_by_id_denied(self):
         """Test attach by process id denied"""
         self.build()

Modified: lldb/trunk/test/functionalities/process_attach/attach_denied/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/process_attach/attach_denied/main.cpp?rev=248889&r1=248888&r2=248889&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/process_attach/attach_denied/main.cpp (original)
+++ lldb/trunk/test/functionalities/process_attach/attach_denied/main.cpp Wed Sep 30 05:59:39 2015
@@ -54,7 +54,7 @@ bool writePid (const char* file_name, co
     return res;
 }
 
-void sigterm_handler (int)
+void signal_handler (int)
 {
 }
 
@@ -75,8 +75,10 @@ int main (int argc, char const *argv[])
 
     if (pid > 0)
     {
-        // Make pause call to return when SIGTERM is received.
-        signal (SIGTERM, sigterm_handler);
+        // Make pause call to return when a signal is received. Normally this happens when the
+        // test runner tries to terminate us.
+        signal (SIGHUP, signal_handler);
+        signal (SIGTERM, signal_handler);
         if (ptrace (ATTACH_REQUEST, pid, NULL, 0) == -1)
         {
             fprintf (stderr, "ptrace(ATTACH) failed: %s\n", strerror (errno));




More information about the lldb-commits mailing list