Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Infra] Add check for unexpected test failures in build.sh #14144

Merged
merged 6 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions FirebasePerformance/Tests/Unit/Timer/FPRCounterListTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,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. */
Expand Down
19 changes: 16 additions & 3 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 "$@"
Expand All @@ -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
Expand All @@ -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'
Expand Down
Loading