From c9dcd0844e9f1e7629de3c51ece556b62f8d6c02 Mon Sep 17 00:00:00 2001 From: Nick Cooke Date: Thu, 16 Apr 2026 14:48:19 -0400 Subject: [PATCH 1/3] fix: publishing test failures --- .../SwizzlerTestHelpers/GULRuntimeSnapshot.m | 42 ++++++++++++------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/GoogleUtilities/SwizzlerTestHelpers/GULRuntimeSnapshot.m b/GoogleUtilities/SwizzlerTestHelpers/GULRuntimeSnapshot.m index e358b254..05f82c69 100644 --- a/GoogleUtilities/SwizzlerTestHelpers/GULRuntimeSnapshot.m +++ b/GoogleUtilities/SwizzlerTestHelpers/GULRuntimeSnapshot.m @@ -58,29 +58,43 @@ - (NSString *)description { } - (void)capture { - int numberOfClasses = objc_getClassList(NULL, 0); - Class *classList = (Class *)malloc(numberOfClasses * sizeof(Class)); - numberOfClasses = objc_getClassList(classList, numberOfClasses); + int bufferLen = objc_getClassList(NULL, 0); + if (bufferLen <= 0) { + return; + } + Class *classList = (Class *)calloc(bufferLen, sizeof(Class)); + if (classList == NULL) { + return; + } + int numberOfClasses = objc_getClassList(classList, bufferLen); + int count = MIN(bufferLen, numberOfClasses); // If we should track specific classes, then there's no need to figure out all ObjC classes. if (_classes) { for (Class aClass in _classes) { NSString *classString = NSStringFromClass(aClass); - GULRuntimeClassSnapshot *classSnapshot = - [[GULRuntimeClassSnapshot alloc] initWithClass:aClass]; - _classSnapshots[classString] = classSnapshot; - [classSnapshot capture]; - _runningHash ^= [classSnapshot hash]; + if (classString) { + GULRuntimeClassSnapshot *classSnapshot = + [[GULRuntimeClassSnapshot alloc] initWithClass:aClass]; + _classSnapshots[classString] = classSnapshot; + [classSnapshot capture]; + _runningHash ^= [classSnapshot hash]; + } } } else { - for (int i = 0; i < numberOfClasses; i++) { + for (int i = 0; i < count; i++) { Class aClass = classList[i]; + if (aClass == Nil) { + continue; + } NSString *classString = NSStringFromClass(aClass); - GULRuntimeClassSnapshot *classSnapshot = - [[GULRuntimeClassSnapshot alloc] initWithClass:aClass]; - _classSnapshots[classString] = classSnapshot; - [classSnapshot capture]; - _runningHash ^= [classSnapshot hash]; + if (classString) { + GULRuntimeClassSnapshot *classSnapshot = + [[GULRuntimeClassSnapshot alloc] initWithClass:aClass]; + _classSnapshots[classString] = classSnapshot; + [classSnapshot capture]; + _runningHash ^= [classSnapshot hash]; + } } } free(classList); From 241fb229afaf4160ea58500003053d5916d9e300 Mon Sep 17 00:00:00 2001 From: Nick Cooke <36927374+ncooke3@users.noreply.github.com> Date: Thu, 16 Apr 2026 15:03:15 -0400 Subject: [PATCH 2/3] less flaky sim downloads --- .github/workflows/google-utilities.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/google-utilities.yml b/.github/workflows/google-utilities.yml index c0c40774..1a12413c 100644 --- a/.github/workflows/google-utilities.yml +++ b/.github/workflows/google-utilities.yml @@ -80,9 +80,15 @@ jobs: run: | sudo xcode-select -s '/Applications/Xcode_16.2.app/Contents/Developer' xcodebuild -list - - name: Install Simulator - if: matrix.target == 'iOS' || matrix.target == 'tvOS' - run: xcodebuild -downloadPlatform ${{ matrix.target }} + - name: Install simulator SDKs + if: matrix.target != 'macOS' && matrix.target != 'catalyst' + uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3 + with: + timeout_minutes: 15 + max_attempts: 5 + retry_wait_seconds: 120 + continue_on_error: true + command: xcodebuild -downloadPlatform ${{ matrix.target }} - name: iOS Unit Tests run: scripts/third_party/travis/retry.sh scripts/build.sh GoogleUtilities-Package ${{ matrix.target }} spm From 6e232a67ad0aafe98ebc2635c4f1f48c36767c89 Mon Sep 17 00:00:00 2001 From: Nick Cooke <36927374+ncooke3@users.noreply.github.com> Date: Thu, 16 Apr 2026 16:13:31 -0400 Subject: [PATCH 3/3] Update .github/workflows/google-utilities.yml --- .github/workflows/google-utilities.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/google-utilities.yml b/.github/workflows/google-utilities.yml index 1a12413c..4da4041b 100644 --- a/.github/workflows/google-utilities.yml +++ b/.github/workflows/google-utilities.yml @@ -82,7 +82,7 @@ jobs: xcodebuild -list - name: Install simulator SDKs if: matrix.target != 'macOS' && matrix.target != 'catalyst' - uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3 + uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3 with: timeout_minutes: 15 max_attempts: 5