[Lldb-commits] [lldb] [lldb][test] Do not check order of elements in SharedCluster test (PR #215529)

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Tue Aug 11 04:46:12 PDT 2026


https://github.com/DavidSpickett created https://github.com/llvm/llvm-project/pull/215529

Fixes #215310

ClusterManager uses a SmallPtrSet to track elements. SmallPtrSet is not intentionally ordered, but its "small" representation is when only using it in the ways that SmallPtrSet does.

When LLVM_REVERSE_ITERATION is ON, the order is reversed which causes this unit test to fail.

>From what I understand, the order is important. So I've changed the test to ignore the element order.

I think the large representation of SmallPtrSet is more likely to be unordered. So the fact that we've been using it in the field since 2022 (33722848fcb5b569ab3a388cae15f31acf9a9c5e) also backs up order not being important.

>From ca5f8b28b09bb0e61154c51ad201fa06d8344190 Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at arm.com>
Date: Tue, 11 Aug 2026 11:38:24 +0000
Subject: [PATCH] [lldb][test] Do not check order of elements in SharedCluster
 test

Fixes #215310

ClusterManager uses a SmallPtrSet to track elements.
SmallPtrSet is not intentionally ordered, but its "small"
representation is when only using it in the ways that
SmallPtrSet does.

When LLVM_REVERSE_ITERATION is ON, the order is reversed
which causes this unit test to fail.

>From what I understand, the order is important. So I've
changed the test to ignore the element order.

I think the large representation of SmallPtrSet is more
likely to be unordered. So the fact that we've been using
it in the field since 2022 (33722848fcb5b569ab3a388cae15f31acf9a9c5e)
also backs up order not being important.
---
 lldb/unittests/Utility/SharedClusterTest.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/unittests/Utility/SharedClusterTest.cpp b/lldb/unittests/Utility/SharedClusterTest.cpp
index 56dd4da2ed91e..ec95afa8d2eed 100644
--- a/lldb/unittests/Utility/SharedClusterTest.cpp
+++ b/lldb/unittests/Utility/SharedClusterTest.cpp
@@ -54,5 +54,5 @@ TEST(SharedCluster, ClusterManager) {
     }
     ASSERT_THAT(Queue, testing::IsEmpty());
   }
-  ASSERT_THAT(Queue, testing::ElementsAre(1, 2));
+  ASSERT_THAT(Queue, testing::UnorderedElementsAre(1, 2));
 }



More information about the lldb-commits mailing list