-
-
Notifications
You must be signed in to change notification settings - Fork 55
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,52 +22,14 @@ Write-Host "# |___/_| |_|\___/|_|\_\___| |_| |___|___/ |_| #" | |
Write-Host "# #" | ||
Write-Host "#####################################################" | ||
|
||
if ($IsIntegrationTest) | ||
{ | ||
$BuildDir = $(GetNewProjectBuildPath) | ||
$ApkFileName = "test.apk" | ||
$ProcessName = "com.DefaultCompany.$(GetNewProjectName)" | ||
|
||
if ($Action -eq "Build") | ||
{ | ||
$buildCallback = { | ||
Write-Host "::group::Gradle build $BuildDir" | ||
Push-Location $BuildDir | ||
try | ||
{ | ||
MakeExecutable "./gradlew" | ||
& ./gradlew --info --no-daemon assembleRelease | ForEach-Object { | ||
Write-Host " $_" | ||
} | ||
if (-not $?) | ||
{ | ||
throw "Gradle execution failed" | ||
} | ||
Copy-Item -Path launcher/build/outputs/apk/release/launcher-release.apk -Destination $ApkFileName | ||
} | ||
finally | ||
{ | ||
Pop-Location | ||
Write-Host "::endgroup::" | ||
} | ||
} | ||
|
||
$symbolServerOutput = RunWithSymbolServer -Callback $buildCallback | ||
CheckSymbolServerOutput 'Android' $symbolServerOutput $UnityVersion | ||
return; | ||
} | ||
} | ||
else | ||
{ | ||
$BuildDir = "samples/artifacts/builds/Android" | ||
$ApkFileName = "IL2CPP_Player.apk" | ||
$ProcessName = "io.sentry.samples.unityofbugs" | ||
} | ||
$BuildDir = $(GetNewProjectBuildPath) | ||
$ApkFileName = "test.apk" | ||
$ProcessName = "com.DefaultCompany.$(GetNewProjectName)" | ||
$TestActivityName = "$ProcessName/com.unity3d.player.UnityPlayerActivity" | ||
$FallBackTestActivityName = "$ProcessName/com.unity3d.player.UnityPlayerGameActivity" | ||
|
||
$_ArtifactsPath = ((Test-Path env:ARTIFACTS_PATH) ? $env:ARTIFACTS_PATH : "./$BuildDir/../test-artifacts/") ` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was mixing relative paths |
||
+ $(Get-Date -Format "HHmmss") | ||
$_ArtifactsPath = (Test-Path env:ARTIFACTS_PATH) ? $env:ARTIFACTS_PATH : (Join-Path $BuildDir "../test-artifacts/" $(Get-Date -Format "HHmmss")) | ||
|
||
function ArtifactsPath | ||
{ | ||
if (-not (Test-Path $_ArtifactsPath)) | ||
|
@@ -332,8 +294,8 @@ function RunTest([string] $Name, [string] $SuccessString, [string] $FailureStrin | |
$logCache = ProcessNewLogs -newLogs $newLogs -lastLogCount ([ref]$lastLogCount) -logCache $logCache | ||
|
||
# The SmokeTester logs "SmokeTester is quitting." in OnApplicationQuit() to reliably inform when tests finish running. | ||
# 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")) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using a log we control (from within |
||
{ | ||
Write-Host "Process finished marker detected. Finish waiting for tests to run." | ||
$processFinished = $true | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,18 +82,16 @@ If (-not(Test-Path -Path "$(GetNewProjectPath)")) | |
./test/Scripts.Integration.Test/configure-sentry.ps1 "$UnityPath" -Platform $Platform -CheckSymbols | ||
} | ||
|
||
# Support rebuilding the integration test project. I.e. if you make changes to the SmokeTester.cs during | ||
If ($Rebuild -or -not(Test-Path -Path $(GetNewProjectBuildPath))) | ||
{ | ||
Write-Host "Building Project" | ||
|
||
If (("iOS", "Android-Export") -contains $Platform) | ||
If ("iOS" -eq $Platform) | ||
{ | ||
# Workaround for having `exportAsGoogleAndroidProject` remain `false` in Unity 6 on first build | ||
# We're exporting an Xcode project and building that in a separate step. | ||
./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$UnityPath" -UnityVersion $UnityVersion -Platform $Platform | ||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we don't need the Android stuff here anymore? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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". |
||
& "./scripts/smoke-test-ios.ps1" Build -IsIntegrationTest -UnityVersion $UnityVersion | ||
} | ||
Else | ||
{ | ||
|
@@ -109,9 +107,9 @@ Switch -Regex ($Platform) | |
{ | ||
./test/Scripts.Integration.Test/run-smoke-test.ps1 -Smoke -Crash | ||
} | ||
"^(Android|Android-Export)$" | ||
"^(Android)$" | ||
{ | ||
./scripts/smoke-test-android.ps1 -IsIntegrationTest | ||
./scripts/smoke-test-android.ps1 | ||
} | ||
"^iOS$" | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're no longer building with this script. Building happens in https://github.com/getsentry/sentry-unity/blob/main/.github/workflows/android-smoke-test-build.yml