Skip to content

Commit db77a77

Browse files
authored
[Infra] Add check for unexpected test failures in build.sh (#14144)
1 parent 380a861 commit db77a77

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

FirebasePerformance/Tests/Unit/Timer/FPRCounterListTest.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,18 @@ + (void)setUp {
2929
[super setUp];
3030
FIRPerformance *performance = [FIRPerformance sharedInstance];
3131
[performance setDataCollectionEnabled:YES];
32+
#ifdef UNSWIZZLE_AVAILABLE
3233
[[FPRClient sharedInstance] disableInstrumentation];
34+
#endif // UNSWIZZLE_AVAILABLE
3335
}
3436

3537
+ (void)tearDown {
3638
[super tearDown];
3739
FIRPerformance *performance = [FIRPerformance sharedInstance];
3840
[performance setDataCollectionEnabled:NO];
41+
#ifdef UNSWIZZLE_AVAILABLE
3942
[[FPRClient sharedInstance] disableInstrumentation];
43+
#endif // UNSWIZZLE_AVAILABLE
4044
}
4145

4246
/** Validates counterlist object creation. */

scripts/build.sh

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,12 @@ source scripts/check_secrets.sh
110110
function RunXcodebuild() {
111111
echo xcodebuild "$@"
112112

113-
xcbeautify_cmd=(xcbeautify --renderer github-actions)
113+
xcbeautify_cmd=(xcbeautify --renderer github-actions --disable-logging)
114114

115115
result=0
116-
xcodebuild "$@" | tee xcodebuild.log | "${xcbeautify_cmd[@]}" || result=$?
116+
xcodebuild "$@" | tee xcodebuild.log | "${xcbeautify_cmd[@]}" \
117+
&& CheckUnexpectedFailures xcodebuild.log \
118+
|| result=$?
117119

118120
if [[ $result == 65 ]]; then
119121
ExportLogs "$@"
@@ -122,7 +124,9 @@ function RunXcodebuild() {
122124
sleep 5
123125

124126
result=0
125-
xcodebuild "$@" | tee xcodebuild.log | "${xcbeautify_cmd[@]}" || result=$?
127+
xcodebuild "$@" | tee xcodebuild.log | "${xcbeautify_cmd[@]}" \
128+
&& CheckUnexpectedFailures xcodebuild.log \
129+
|| result=$?
126130
fi
127131

128132
if [[ $result != 0 ]]; then
@@ -138,6 +142,15 @@ function ExportLogs() {
138142
python "${scripts_dir}/xcresult_logs.py" "$@"
139143
}
140144

145+
function CheckUnexpectedFailures() {
146+
local log_file=$1
147+
148+
if grep -Eq "[1-9]\d* failures \([1-9]\d* unexpected\)" "$log_file"; then
149+
echo "xcodebuild failed with unexpected failures." 1>&2
150+
return 65
151+
fi
152+
}
153+
141154
if [[ "$xcode_major" -lt 15 ]]; then
142155
ios_flags=(
143156
-sdk 'iphonesimulator'

0 commit comments

Comments
 (0)