[Lldb-commits] [lldb] 2a29c3f - [lldb/test] Re-enable TestEvents.py on Darwin and fix crashes

Med Ismail Bennani via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 4 13:35:41 PST 2022


Author: Med Ismail Bennani
Date: 2022-03-04T13:35:07-08:00
New Revision: 2a29c3f72e8d93385be83bd24a993c3bb57ac181

URL: https://github.com/llvm/llvm-project/commit/2a29c3f72e8d93385be83bd24a993c3bb57ac181
DIFF: https://github.com/llvm/llvm-project/commit/2a29c3f72e8d93385be83bd24a993c3bb57ac181.diff

LOG: [lldb/test] Re-enable TestEvents.py on Darwin and fix crashes

This patch re-enables TestEvents.py on Darwin and fixes some crashes
that were happening due to an undefined method.

I ran it 100 times locally with the following command and it passed
every the time:

```
for i in {1..100}; do print $i/100; ./bin/lldb-dotest -p TestEvents.py 2>&1 | rg PASSED; if [ "$?" -eq "1" ]; then break; fi; done
```

Let's see if it still fails non-deterministically on the bots and
eventually also re-enable it on linux.

rdar://37037235

Differential Revision: https://reviews.llvm.org/D120607

Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>

Added: 
    

Modified: 
    lldb/test/API/python_api/event/TestEvents.py

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/python_api/event/TestEvents.py b/lldb/test/API/python_api/event/TestEvents.py
index 95cf5b28c0ca6..33650c49b850a 100644
--- a/lldb/test/API/python_api/event/TestEvents.py
+++ b/lldb/test/API/python_api/event/TestEvents.py
@@ -13,7 +13,6 @@
 
 
 @skipIfLinux   # llvm.org/pr25924, sometimes generating SIGSEGV
- at skipIfDarwin
 class EventAPITestCase(TestBase):
 
     mydir = TestBase.compute_mydir(__file__)
@@ -171,9 +170,9 @@ def run(self):
                 # Let's only try at most 3 times to retrieve any kind of event.
                 while not count > 3:
                     if listener.WaitForEvent(5, event):
-                        self.trace("Got a valid event:", event)
-                        self.trace("Event data flavor:", event.GetDataFlavor())
-                        self.trace("Event type:", lldbutil.state_type_to_str(event.GetType()))
+                        self.context.trace("Got a valid event:", event)
+                        self.context.trace("Event data flavor:", event.GetDataFlavor())
+                        self.context.trace("Event type:", lldbutil.state_type_to_str(event.GetType()))
                         listener.Clear()
                         return
                     count = count + 1
@@ -187,6 +186,7 @@ def run(self):
 
         # Let's start the listening thread to retrieve the event.
         my_thread = MyListeningThread()
+        my_thread.context = self
         my_thread.start()
 
         # Wait until the 'MyListeningThread' terminates.
@@ -256,7 +256,7 @@ def test_add_listener_to_broadcaster(self):
         class MyListeningThread(threading.Thread):
 
             def run(self):
-                self.trace("Running MyListeningThread:", self)
+                self.context.trace("Running MyListeningThread:", self)
 
                 # Regular expression pattern for the event description.
                 pattern = re.compile("data = {.*, state = (.*)}$")
@@ -266,7 +266,7 @@ def run(self):
                 while True:
                     if listener.WaitForEvent(5, event):
                         desc = lldbutil.get_description(event)
-                        self.trace("Event description:", desc)
+                        self.context.trace("Event description:", desc)
                         match = pattern.search(desc)
                         if not match:
                             break


        


More information about the lldb-commits mailing list