[Lldb-commits] [lldb] 7de7fe5 - [lldb] Don't ask for QOS_CLASS_UNSPECIFIED queue in TestQueues

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Tue Aug 25 11:14:07 PDT 2020


Author: Raphael Isemann
Date: 2020-08-25T20:13:33+02:00
New Revision: 7de7fe5d0e3f7f4d28e1dde42df4a7defa564f11

URL: https://github.com/llvm/llvm-project/commit/7de7fe5d0e3f7f4d28e1dde42df4a7defa564f11
DIFF: https://github.com/llvm/llvm-project/commit/7de7fe5d0e3f7f4d28e1dde42df4a7defa564f11.diff

LOG: [lldb] Don't ask for QOS_CLASS_UNSPECIFIED queue in TestQueues

TestQueues is curiously failing for me as my queue for QOS_CLASS_UNSPECIFIED
is named "Utility" and not "User Initiated" or "Default". While debugging, this
I noticed that this test isn't actually using this API right from what I understand. The API documentation
for `dispatch_get_global_queue` specifies for the parameter: "You may specify the value
QOS_CLASS_USER_INTERACTIVE, QOS_CLASS_USER_INITIATED, QOS_CLASS_UTILITY, or QOS_CLASS_BACKGROUND."

QOS_CLASS_UNSPECIFIED isn't listed as one of the supported values. swift-corelibs-libdispatch
even checks for this value and returns a DISPATCH_BAD_INPUT. The
libdispatch shipped on macOS seems to also check for QOS_CLASS_UNSPECIFIED and seems to
instead cause a "client crash", but somehow this doesn't trigger in this test and instead we just
get whatever queue

This patch just removes that part of the test as it appears the code is just incorrect.

Reviewed By: jasonmolenda

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

Added: 
    

Modified: 
    lldb/test/API/macosx/queues/TestQueues.py
    lldb/test/API/macosx/queues/main.c

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/macosx/queues/TestQueues.py b/lldb/test/API/macosx/queues/TestQueues.py
index e177daa54fa3..711c99a7d400 100644
--- a/lldb/test/API/macosx/queues/TestQueues.py
+++ b/lldb/test/API/macosx/queues/TestQueues.py
@@ -192,7 +192,6 @@ def queues(self):
         user_initiated_thread = lldb.SBThread()
         user_interactive_thread = lldb.SBThread()
         utility_thread = lldb.SBThread()
-        unspecified_thread = lldb.SBThread()
         background_thread = lldb.SBThread()
         for th in process.threads:
             if th.GetName() == "user initiated QoS":
@@ -201,8 +200,6 @@ def queues(self):
                 user_interactive_thread = th
             if th.GetName() == "utility QoS":
                 utility_thread = th
-            if th.GetName() == "unspecified QoS":
-                unspecified_thread = th
             if th.GetName() == "background QoS":
                 background_thread = th
 
@@ -213,9 +210,6 @@ def queues(self):
             user_interactive_thread.IsValid(),
             "Found user interactive QoS thread")
         self.assertTrue(utility_thread.IsValid(), "Found utility QoS thread")
-        self.assertTrue(
-            unspecified_thread.IsValid(),
-            "Found unspecified QoS thread")
         self.assertTrue(
             background_thread.IsValid(),
             "Found background QoS thread")
@@ -248,16 +242,6 @@ def queues(self):
             stream.GetData(), "Utility",
             "utility QoS thread name is valid")
         stream.Clear()
-        self.assertTrue(
-            unspecified_thread.GetInfoItemByPathAsString(
-                "requested_qos.printable_name",
-                stream),
-            "Get QoS printable string for unspecified QoS thread")
-        qosName = stream.GetData()
-        self.assertTrue(
-            qosName == "User Initiated" or qosName == "Default",
-            "unspecified QoS thread name is valid: " + str(qosName))
-        stream.Clear()
         self.assertTrue(
             background_thread.GetInfoItemByPathAsString(
                 "requested_qos.printable_name",

diff  --git a/lldb/test/API/macosx/queues/main.c b/lldb/test/API/macosx/queues/main.c
index 3978b92bff1a..2bf390b1330a 100644
--- a/lldb/test/API/macosx/queues/main.c
+++ b/lldb/test/API/macosx/queues/main.c
@@ -136,15 +136,9 @@ int main (int argc, const char **argv)
             while (1)
                 sleep (10);
       });
-    dispatch_async (dispatch_get_global_queue(QOS_CLASS_UNSPECIFIED, 0), ^{
-            pthread_setname_np ("unspecified QoS");
-            atomic_fetch_add(&thread_count, 1);
-            while (1)
-                sleep (10);
-      });
 
     // Unfortunately there is no pthread_barrier on darwin.
-    while ((atomic_load(&thread_count) < 13) || (finished_enqueueing_work == 0))
+    while ((atomic_load(&thread_count) < 12) || (finished_enqueueing_work == 0))
         sleep (1);
 
     stopper ();


        


More information about the lldb-commits mailing list