From fd7d12e3ace62664127f16edfdb02d320f72277c Mon Sep 17 00:00:00 2001 From: Andrew Heard Date: Mon, 18 Nov 2024 18:53:15 -0500 Subject: [PATCH 1/5] [Infra] Add check for unexpected test failures in build.sh --- scripts/build.sh | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/scripts/build.sh b/scripts/build.sh index 67e576ac990..15019bd184c 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -110,10 +110,12 @@ source scripts/check_secrets.sh function RunXcodebuild() { echo xcodebuild "$@" - xcbeautify_cmd=(xcbeautify --renderer github-actions) + xcbeautify_cmd=(xcbeautify --renderer github-actions --disable-logging) result=0 - xcodebuild "$@" | tee xcodebuild.log | "${xcbeautify_cmd[@]}" || result=$? + xcodebuild "$@" | tee xcodebuild.log | "${xcbeautify_cmd[@]}" \ + && CheckUnexpectedFailures xcodebuild.log \ + || result=$? if [[ $result == 65 ]]; then ExportLogs "$@" @@ -122,7 +124,9 @@ function RunXcodebuild() { sleep 5 result=0 - xcodebuild "$@" | tee xcodebuild.log | "${xcbeautify_cmd[@]}" || result=$? + xcodebuild "$@" | tee xcodebuild.log | "${xcbeautify_cmd[@]}" \ + && CheckUnexpectedFailures xcodebuild.log \ + || result=$? fi if [[ $result != 0 ]]; then @@ -138,6 +142,15 @@ function ExportLogs() { python "${scripts_dir}/xcresult_logs.py" "$@" } +function CheckUnexpectedFailures() { + local log_file=$1 + + if grep -Eq "[1-9]\d* failures \([1-9]\d* unexpected\)" "$log_file"; then + echo "xcodebuild failed with unexpected failures." 1>&2 + return 65 + fi +} + if [[ "$xcode_major" -lt 15 ]]; then ios_flags=( -sdk 'iphonesimulator' From 34d5ecaf1fe62ee75698d72c030204ef4a8d3a4c Mon Sep 17 00:00:00 2001 From: Andrew Heard Date: Mon, 18 Nov 2024 19:06:24 -0500 Subject: [PATCH 2/5] Trigger performance CI run to demonstrate error --- .github/workflows/performance.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/performance.yml b/.github/workflows/performance.yml index af24594c944..4f72f7fc6eb 100644 --- a/.github/workflows/performance.yml +++ b/.github/workflows/performance.yml @@ -145,6 +145,7 @@ jobs: path: .build key: ${{ steps.generate_cache_key.outputs.cache_key }} spm: + # TODO: Remove before merging; triggering CI run. # Don't run on private repo unless it is a PR. if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' needs: [spm-package-resolved] From 9ce2dcc63a0bdeb8126ac4555dafca1cfa0b38b7 Mon Sep 17 00:00:00 2001 From: Andrew Heard Date: Mon, 18 Nov 2024 19:23:57 -0500 Subject: [PATCH 3/5] Wrap `FPRCounterListTest` in `#ifdef UNSWIZZLE_AVAILABLE` --- FirebasePerformance/Tests/Unit/Timer/FPRCounterListTest.m | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/FirebasePerformance/Tests/Unit/Timer/FPRCounterListTest.m b/FirebasePerformance/Tests/Unit/Timer/FPRCounterListTest.m index d31cd61c6e1..7691891f9e2 100644 --- a/FirebasePerformance/Tests/Unit/Timer/FPRCounterListTest.m +++ b/FirebasePerformance/Tests/Unit/Timer/FPRCounterListTest.m @@ -19,6 +19,10 @@ #import "FirebasePerformance/Sources/Public/FirebasePerformance/FIRPerformance.h" #import "FirebasePerformance/Sources/Timer/FPRCounterList.h" +// This test requires the UNSWIZZLE_AVAILABLE preprocessor macro to be defined in order to complete +// successfully. See FPRSelectorInstrumentor.m for more details. +#ifdef UNSWIZZLE_AVAILABLE + @interface FPRCounterListTest : XCTestCase @end @@ -162,3 +166,5 @@ - (void)testCounterInitializeWithNegativeValue { } @end + +#endif // UNSWIZZLE_AVAILABLE From d8ec45a7f15435d128ea8b9a18b1979d3cbb4a52 Mon Sep 17 00:00:00 2001 From: Andrew Heard Date: Mon, 18 Nov 2024 19:24:16 -0500 Subject: [PATCH 4/5] Revert "Trigger performance CI run to demonstrate error" This reverts commit 34d5ecaf1fe62ee75698d72c030204ef4a8d3a4c. --- .github/workflows/performance.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/performance.yml b/.github/workflows/performance.yml index 4f72f7fc6eb..af24594c944 100644 --- a/.github/workflows/performance.yml +++ b/.github/workflows/performance.yml @@ -145,7 +145,6 @@ jobs: path: .build key: ${{ steps.generate_cache_key.outputs.cache_key }} spm: - # TODO: Remove before merging; triggering CI run. # Don't run on private repo unless it is a PR. if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request' needs: [spm-package-resolved] From 3923bff3eef59f303a39f80080472e1111074af4 Mon Sep 17 00:00:00 2001 From: Andrew Heard Date: Tue, 19 Nov 2024 10:29:48 -0500 Subject: [PATCH 5/5] Try removing unswizzling when UNSWIZZLE_AVAILABLE is false --- .../Tests/Unit/Timer/FPRCounterListTest.m | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/FirebasePerformance/Tests/Unit/Timer/FPRCounterListTest.m b/FirebasePerformance/Tests/Unit/Timer/FPRCounterListTest.m index 7691891f9e2..00b2c78d38f 100644 --- a/FirebasePerformance/Tests/Unit/Timer/FPRCounterListTest.m +++ b/FirebasePerformance/Tests/Unit/Timer/FPRCounterListTest.m @@ -19,10 +19,6 @@ #import "FirebasePerformance/Sources/Public/FirebasePerformance/FIRPerformance.h" #import "FirebasePerformance/Sources/Timer/FPRCounterList.h" -// This test requires the UNSWIZZLE_AVAILABLE preprocessor macro to be defined in order to complete -// successfully. See FPRSelectorInstrumentor.m for more details. -#ifdef UNSWIZZLE_AVAILABLE - @interface FPRCounterListTest : XCTestCase @end @@ -33,14 +29,18 @@ + (void)setUp { [super setUp]; FIRPerformance *performance = [FIRPerformance sharedInstance]; [performance setDataCollectionEnabled:YES]; +#ifdef UNSWIZZLE_AVAILABLE [[FPRClient sharedInstance] disableInstrumentation]; +#endif // UNSWIZZLE_AVAILABLE } + (void)tearDown { [super tearDown]; FIRPerformance *performance = [FIRPerformance sharedInstance]; [performance setDataCollectionEnabled:NO]; +#ifdef UNSWIZZLE_AVAILABLE [[FPRClient sharedInstance] disableInstrumentation]; +#endif // UNSWIZZLE_AVAILABLE } /** Validates counterlist object creation. */ @@ -166,5 +166,3 @@ - (void)testCounterInitializeWithNegativeValue { } @end - -#endif // UNSWIZZLE_AVAILABLE