From 7de7fe5d0e3f7f4d28e1dde42df4a7defa564f11 Mon Sep 17 00:00:00 2001 From: Raphael Isemann Date: Tue, 25 Aug 2020 19:53:48 +0200 Subject: [PATCH] [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 --- lldb/test/API/macosx/queues/TestQueues.py | 16 ---------------- lldb/test/API/macosx/queues/main.c | 8 +------- 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/lldb/test/API/macosx/queues/TestQueues.py b/lldb/test/API/macosx/queues/TestQueues.py index e177daa..711c99a 100644 --- a/lldb/test/API/macosx/queues/TestQueues.py +++ b/lldb/test/API/macosx/queues/TestQueues.py @@ -192,7 +192,6 @@ class TestQueues(TestBase): 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 @@ class TestQueues(TestBase): 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 @@ -214,9 +211,6 @@ class TestQueues(TestBase): "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") @@ -249,16 +243,6 @@ class TestQueues(TestBase): "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", stream), diff --git a/lldb/test/API/macosx/queues/main.c b/lldb/test/API/macosx/queues/main.c index 3978b92..2bf390b 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 (); -- 2.7.4