Skip to content

fix: Android device crash tests #2098

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

Merged
merged 3 commits into from
Apr 9, 2025
Merged

Conversation

bitsandfoxes
Copy link
Contributor

@bitsandfoxes bitsandfoxes commented Apr 7, 2025

Fixes

I'm not exactly sure when or with which version this changes but the crash log switches between

terminating with uncaught exception of type char const*

and

terminating due to uncaught exception of type char const*

Replacing the with with due to.

Instead of relying on the exact wording from the logs from somewhere within Unity, we're relying on the ones from sentry-native (so we can blame ourselves if this breaks in the future).

Cleanup

With the separation into workflows in #1989 we're also no longer exporting a Gradle project that we're then building in a dedicated step. The IsIntegrationTest is a remnant from there.

#skip-changelog.

@bitsandfoxes bitsandfoxes changed the title updated log check fix: Android device crash tests Apr 7, 2025
@bitsandfoxes bitsandfoxes requested a review from vaind April 7, 2025 18:32
$ApkFileName = "test.apk"
$ProcessName = "com.DefaultCompany.$(GetNewProjectName)"

if ($Action -eq "Build")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$TestActivityName = "$ProcessName/com.unity3d.player.UnityPlayerActivity"
$FallBackTestActivityName = "$ProcessName/com.unity3d.player.UnityPlayerGameActivity"

$_ArtifactsPath = ((Test-Path env:ARTIFACTS_PATH) ? $env:ARTIFACTS_PATH : "./$BuildDir/../test-artifacts/") `
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was mixing relative paths ./ with absolute paths $BuildDir. Using Join-Path to resolve this.

# For crash tests, we expect to see a native crash log "terminating with uncaught exception of type char const*".
if (($newLogs | Select-String "SmokeTester is quitting.") -or ($newLogs | Select-String "terminating with uncaught exception of type char const*"))
# For crash tests, we're checking for `sentry-native` logging "crash has been captured" to reliably inform when tests finished running.
if (($newLogs | Select-String "SmokeTester is quitting.") -or ($newLogs | Select-String "crash has been captured"))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a log we control (from within sentry-native) so it won't change with different versions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole script is a utility script to run the scripts used by CI locally.

Remove-Item -Path $(GetNewProjectBuildPath) -Recurse -Force -Confirm:$false

./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$UnityPath" -UnityVersion $UnityVersion -Platform $Platform
& "./scripts/smoke-test-$($Platform -eq 'iOS' ? 'ios' : 'android').ps1" Build -IsIntegrationTest -UnityVersion $UnityVersion
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need the Android stuff here anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That script gluing all the scripts together and letting us "run CI locally".
And no, we're not exporting the Gradle project to manually build it on a different runner. We're relying on the Android Dev environment Unity comes with.

@bitsandfoxes bitsandfoxes merged commit 52dcf32 into main Apr 9, 2025
76 checks passed
@bitsandfoxes bitsandfoxes deleted the fix/android-device-tests branch April 9, 2025 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants