diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index cc031f721..a3a625f43 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -85,24 +85,24 @@ jobs:
# ./test/Scripts.Tests/test-pack-contents.ps1 accept
run: ./test/Scripts.Tests/test-pack-contents.ps1
- # This produces the `samples/IntegrationTest` as `smoke-test-${{ matrix.unity-version }}`.
- smoke-test-create:
- name: Create ${{ matrix.unity-version }} Smoke Test Project
+ # This produces the `samples/IntegrationTest` as `test-${{ matrix.unity-version }}`.
+ test-create:
+ name: Create ${{ matrix.unity-version }} Test Project
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
needs: [create-unity-matrix]
secrets: inherit
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix) }}
- uses: ./.github/workflows/smoke-test-create.yml
+ uses: ./.github/workflows/test-create.yml
with:
unity-version: ${{ matrix.unity-version }}
-
- # A Linux, docker-based build to prepare a WebGL player. The tests run in `smoke-test-run`.
- smoke-test-build-webgl:
- name: Build ${{ matrix.platform }} ${{ matrix.unity-version }} Smoke Test
+
+ # A Linux, docker-based build to prepare a WebGL player. The tests run in `test-run-webgl`.
+ test-build-webgl:
+ name: Build ${{ matrix.platform }} ${{ matrix.unity-version }} Test
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
- needs: [smoke-test-create, create-unity-matrix]
+ needs: [test-create, create-unity-matrix]
runs-on: ubuntu-latest
strategy:
fail-fast: false
@@ -111,7 +111,6 @@ jobs:
platform: ["WebGL"]
include:
- platform: WebGL
- check_symbols: true
build_platform: WebGL
env:
UNITY_PATH: docker exec unity unity-editor
@@ -149,7 +148,7 @@ jobs:
- name: Download IntegrationTest project
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
- name: smoke-test-${{ matrix.unity-version }}
+ name: test-${{ matrix.unity-version }}
- name: Extract project archive
run: tar -xvzf test-project.tar.gz
@@ -172,7 +171,7 @@ jobs:
- name: Build without Sentry SDK
if: steps.cache-build-nosentry.outputs.cache-hit != 'true'
- run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform "$env:BUILD_PLATFORM" -CheckSymbols:$false -BuildDirName "Build-NoSentry"
+ run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform "$env:BUILD_PLATFORM" -BuildDirName "Build-NoSentry"
env:
BUILD_PLATFORM: ${{ matrix.build_platform }}
@@ -189,16 +188,15 @@ jobs:
run: ./test/Scripts.Integration.Test/add-sentry.ps1 -UnityPath "$env:UNITY_PATH" -PackagePath "test-package-release"
- name: Configure Sentry
- run: ./test/Scripts.Integration.Test/configure-sentry.ps1 -UnityPath "$env:UNITY_PATH" -Platform "$env:BUILD_PLATFORM" -CheckSymbols -TestMode "integration"
+ run: ./test/Scripts.Integration.Test/configure-sentry.ps1 -UnityPath "$env:UNITY_PATH" -Platform "$env:BUILD_PLATFORM"
env:
BUILD_PLATFORM: ${{ matrix.build_platform }}
SENTRY_DSN: ${{ secrets.SENTRY_TEST_DSN }}
- name: Build Project
- run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform "$env:BUILD_PLATFORM" -CheckSymbols:$([System.Convert]::ToBoolean($env:CHECK_SYMBOLS)) -UnityVersion "$env:UNITY_VERSION"
+ run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform "$env:BUILD_PLATFORM" -UnityVersion "$env:UNITY_VERSION"
env:
BUILD_PLATFORM: ${{ matrix.build_platform }}
- CHECK_SYMBOLS: ${{ matrix.check_symbols }}
UNITY_VERSION: ${{ matrix.unity-version }}
- name: Compare build sizes
@@ -241,24 +239,24 @@ jobs:
# Lower retention period - we only need this to retry CI.
retention-days: 14
- smoke-test-build-android:
- name: Build Android ${{ matrix.unity-version }} Smoke Test
+ test-build-android:
+ name: Build Android ${{ matrix.unity-version }} Test
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
- needs: [smoke-test-create, create-unity-matrix]
+ needs: [test-create, create-unity-matrix]
secrets: inherit
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix) }}
- uses: ./.github/workflows/smoke-test-build-android.yml
+ uses: ./.github/workflows/test-build-android.yml
with:
unity-version: ${{ matrix.unity-version }}
- smoke-test-run-android:
+ test-run-android:
name: Run Android ${{ matrix.unity-version }} Integration Test
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
- needs: [smoke-test-build-android, create-unity-matrix]
+ needs: [test-build-android, create-unity-matrix]
secrets: inherit
- uses: ./.github/workflows/smoke-test-run-android.yml
+ uses: ./.github/workflows/test-run-android.yml
with:
unity-version: ${{ matrix.unity-version }}
api-level: ${{ matrix.api-level }}
@@ -271,38 +269,38 @@ jobs:
api-level: [30]
init-type: ["runtime", "buildtime"]
- smoke-test-build-ios:
- name: Build iOS ${{ matrix.unity-version }} Smoke Test
+ test-build-ios:
+ name: Build iOS ${{ matrix.unity-version }} Test
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
- needs: [smoke-test-create, create-unity-matrix]
+ needs: [test-create, create-unity-matrix]
secrets: inherit
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix) }}
- uses: ./.github/workflows/smoke-test-build-ios.yml
+ uses: ./.github/workflows/test-build-ios.yml
with:
unity-version: ${{ matrix.unity-version }}
- smoke-test-compile-ios:
- name: Compile iOS ${{ matrix.unity-version }} Smoke Test
+ test-compile-ios:
+ name: Compile iOS ${{ matrix.unity-version }} Test
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
- needs: [smoke-test-build-ios, create-unity-matrix]
+ needs: [test-build-ios, create-unity-matrix]
secrets: inherit
strategy:
fail-fast: false
matrix:
unity-version: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix).unity-version }}
init-type: ["runtime", "buildtime"]
- uses: ./.github/workflows/smoke-test-compile-ios.yml
+ uses: ./.github/workflows/test-compile-ios.yml
with:
unity-version: ${{ matrix.unity-version }}
init-type: ${{ matrix.init-type }}
- smoke-test-run-ios:
+ test-run-ios:
name: Run iOS ${{ matrix.unity-version }} Integration Test
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
- needs: [smoke-test-compile-ios, create-unity-matrix]
- uses: ./.github/workflows/smoke-test-run-ios.yml
+ needs: [test-compile-ios, create-unity-matrix]
+ uses: ./.github/workflows/test-run-ios.yml
with:
unity-version: ${{ matrix.unity-version }}
ios-version: ${{ matrix.ios-version }}
@@ -324,69 +322,69 @@ jobs:
# Also make sure to match the versions available here:
# - https://github.com/actions/runner-images/blob/main/images/macos/macos-14-Readme.md
- smoke-test-run-webgl:
+ test-run-webgl:
name: Run WebGL ${{ matrix.unity-version }} Integration Test
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
- needs: [smoke-test-build-webgl, create-unity-matrix]
+ needs: [test-build-webgl, create-unity-matrix]
secrets: inherit
strategy:
fail-fast: false
matrix:
unity-version: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix).unity-version }}
- uses: ./.github/workflows/smoke-test-run-webgl.yml
+ uses: ./.github/workflows/test-run-webgl.yml
with:
unity-version: ${{ matrix.unity-version }}
- smoke-test-build-linux:
+ test-build-linux:
name: Build Linux ${{ matrix.unity-version }} Integration Test
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
- needs: [smoke-test-create, create-unity-matrix]
+ needs: [test-create, create-unity-matrix]
secrets: inherit
strategy:
fail-fast: false
matrix:
unity-version: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix).unity-version }}
- uses: ./.github/workflows/smoke-test-build-linux.yml
+ uses: ./.github/workflows/test-build-linux.yml
with:
unity-version: ${{ matrix.unity-version }}
- smoke-test-build-windows:
+ test-build-windows:
name: Build Windows ${{ matrix.unity-version }} Integration Test
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
- needs: [smoke-test-create, create-unity-matrix]
+ needs: [test-create, create-unity-matrix]
secrets: inherit
strategy:
fail-fast: false
matrix:
unity-version: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix).unity-version }}
- uses: ./.github/workflows/smoke-test-build-windows.yml
+ uses: ./.github/workflows/test-build-windows.yml
with:
unity-version: ${{ matrix.unity-version }}
- smoke-test-run-linux:
+ test-run-linux:
name: Run Linux ${{ matrix.unity-version }} Integration Test
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
- needs: [smoke-test-build-linux, create-unity-matrix]
+ needs: [test-build-linux, create-unity-matrix]
secrets: inherit
strategy:
fail-fast: false
matrix:
unity-version: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix).unity-version }}
- uses: ./.github/workflows/smoke-test-run-desktop.yml
+ uses: ./.github/workflows/test-run-desktop.yml
with:
unity-version: ${{ matrix.unity-version }}
platform: linux
- smoke-test-run-windows:
+ test-run-windows:
name: Run Windows ${{ matrix.unity-version }} Integration Test
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
- needs: [smoke-test-build-windows, create-unity-matrix]
+ needs: [test-build-windows, create-unity-matrix]
secrets: inherit
strategy:
fail-fast: false
matrix:
unity-version: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix).unity-version }}
- uses: ./.github/workflows/smoke-test-run-desktop.yml
+ uses: ./.github/workflows/test-run-desktop.yml
with:
unity-version: ${{ matrix.unity-version }}
platform: windows
@@ -395,7 +393,7 @@ jobs:
name: Build Size
runs-on: ubuntu-latest
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
- needs: [smoke-test-build-webgl, smoke-test-build-android, smoke-test-compile-ios, smoke-test-build-linux, smoke-test-build-windows]
+ needs: [test-build-webgl, test-build-android, test-compile-ios, test-build-linux, test-build-windows]
steps:
- name: Checkout
uses: actions/checkout@v3
diff --git a/.github/workflows/smoke-test-build-android.yml b/.github/workflows/test-build-android.yml
similarity index 91%
rename from .github/workflows/smoke-test-build-android.yml
rename to .github/workflows/test-build-android.yml
index 999d30021..6ccde026e 100644
--- a/.github/workflows/smoke-test-build-android.yml
+++ b/.github/workflows/test-build-android.yml
@@ -1,4 +1,4 @@
-name: "SmokeTest: Build Android"
+name: "Test: Build Android"
on:
workflow_call:
inputs:
@@ -40,7 +40,7 @@ jobs:
- name: Download IntegrationTest project
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
- name: smoke-test-${{ env.UNITY_VERSION }}
+ name: test-${{ env.UNITY_VERSION }}
- name: Extract project archive
run: tar -xvzf test-project.tar.gz
@@ -63,7 +63,7 @@ jobs:
- name: Build without Sentry SDK
if: steps.cache-build-nosentry.outputs.cache-hit != 'true'
- run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform "Android" -CheckSymbols:$false -BuildDirName "Build-NoSentry"
+ run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform "Android" -BuildDirName "Build-NoSentry"
- name: Download UPM package
uses: vaind/download-artifact@e7141b6a94ef28aa3d828b52830cfa1f406a1848 # v4-with-wait-timeout
@@ -78,12 +78,12 @@ jobs:
run: ./test/Scripts.Integration.Test/add-sentry.ps1 -UnityPath "$env:UNITY_PATH" -PackagePath "test-package-release"
- name: Configure Sentry
- run: ./test/Scripts.Integration.Test/configure-sentry.ps1 -UnityPath "$env:UNITY_PATH" -Platform "Android" -CheckSymbols -TestMode "integration"
+ run: ./test/Scripts.Integration.Test/configure-sentry.ps1 -UnityPath "$env:UNITY_PATH" -Platform "Android"
env:
SENTRY_DSN: ${{ secrets.SENTRY_TEST_DSN }}
- name: Export APK - Runtime Initialization
- run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform "Android" -CheckSymbols:$true -UnityVersion "$env:UNITY_VERSION"
+ run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform "Android" -UnityVersion "$env:UNITY_VERSION"
- name: Compare build sizes (Runtime)
run: ./test/Scripts.Integration.Test/measure-build-size.ps1 -Path1 "samples/IntegrationTest/Build-NoSentry" -Path2 "samples/IntegrationTest/Build" -Platform "Android" -UnityVersion "$env:UNITY_VERSION"
@@ -110,7 +110,7 @@ jobs:
Set-Content $optionsPath $content
- name: Export APK - Build-Time Initialization
- run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform "Android" -CheckSymbols:$true -UnityVersion "$env:UNITY_VERSION"
+ run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform "Android" -UnityVersion "$env:UNITY_VERSION"
- name: Upload .apk
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
diff --git a/.github/workflows/smoke-test-build-ios.yml b/.github/workflows/test-build-ios.yml
similarity index 92%
rename from .github/workflows/smoke-test-build-ios.yml
rename to .github/workflows/test-build-ios.yml
index ff193d36b..b4baaec74 100644
--- a/.github/workflows/smoke-test-build-ios.yml
+++ b/.github/workflows/test-build-ios.yml
@@ -1,4 +1,4 @@
-name: "SmokeTest: Build iOS"
+name: "Test: Build iOS"
on:
workflow_call:
inputs:
@@ -46,7 +46,7 @@ jobs:
- name: Download IntegrationTest project
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
- name: smoke-test-${{ env.UNITY_VERSION }}
+ name: test-${{ env.UNITY_VERSION }}
- name: Extract project archive
run: tar -xvzf test-project.tar.gz
@@ -69,7 +69,7 @@ jobs:
- name: Build without Sentry SDK
if: steps.cache-build-nosentry.outputs.cache-hit != 'true'
- run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform "iOS" -CheckSymbols:$false -BuildDirName "Build-NoSentry"
+ run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform "iOS" -BuildDirName "Build-NoSentry"
- name: Create archive for build without Sentry
shell: bash
@@ -97,13 +97,13 @@ jobs:
run: ./test/Scripts.Integration.Test/add-sentry.ps1 -UnityPath "$env:UNITY_PATH" -PackagePath "test-package-release"
- name: Configure Sentry
- run: ./test/Scripts.Integration.Test/configure-sentry.ps1 -UnityPath "$env:UNITY_PATH" -Platform "$env:BUILD_PLATFORM" -CheckSymbols -TestMode "integration"
+ run: ./test/Scripts.Integration.Test/configure-sentry.ps1 -UnityPath "$env:UNITY_PATH" -Platform "$env:BUILD_PLATFORM"
env:
BUILD_PLATFORM: ${{ matrix.build_platform }}
SENTRY_DSN: ${{ secrets.SENTRY_TEST_DSN }}
- name: Build Project with runtime initialization
- run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform "$env:BUILD_PLATFORM" -CheckSymbols:$false -UnityVersion "$env:UNITY_VERSION"
+ run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform "$env:BUILD_PLATFORM" -UnityVersion "$env:UNITY_VERSION"
env:
BUILD_PLATFORM: ${{ matrix.build_platform }}
@@ -132,7 +132,7 @@ jobs:
Set-Content $optionsPath $content
- name: Build Project with build-time initialization
- run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform "$env:BUILD_PLATFORM" -CheckSymbols:$false -UnityVersion "$env:UNITY_VERSION"
+ run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform "$env:BUILD_PLATFORM" -UnityVersion "$env:UNITY_VERSION"
env:
BUILD_PLATFORM: ${{ matrix.build_platform }}
diff --git a/.github/workflows/smoke-test-build-linux.yml b/.github/workflows/test-build-linux.yml
similarity index 93%
rename from .github/workflows/smoke-test-build-linux.yml
rename to .github/workflows/test-build-linux.yml
index 39f095017..0b8f034f0 100644
--- a/.github/workflows/smoke-test-build-linux.yml
+++ b/.github/workflows/test-build-linux.yml
@@ -1,4 +1,4 @@
-name: "IntegrationTest: Build Linux"
+name: "Test: Build Linux"
on:
workflow_call:
inputs:
@@ -51,7 +51,7 @@ jobs:
- name: Download IntegrationTest project
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
- name: smoke-test-${{ env.UNITY_VERSION }}
+ name: test-${{ env.UNITY_VERSION }}
- name: Extract project archive
run: tar -xvzf test-project.tar.gz
@@ -74,7 +74,7 @@ jobs:
- name: Build without Sentry SDK
if: steps.cache-build-nosentry.outputs.cache-hit != 'true'
- run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform Linux -CheckSymbols:$false -BuildDirName "Build-NoSentry"
+ run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform Linux -BuildDirName "Build-NoSentry"
- name: Download UPM package
uses: vaind/download-artifact@e7141b6a94ef28aa3d828b52830cfa1f406a1848 # v4-with-wait-timeout
@@ -89,12 +89,12 @@ jobs:
run: ./test/Scripts.Integration.Test/add-sentry.ps1 -UnityPath "$env:UNITY_PATH" -PackagePath "test-package-release"
- name: Configure Sentry
- run: ./test/Scripts.Integration.Test/configure-sentry.ps1 -UnityPath "$env:UNITY_PATH" -Platform Linux -TestMode "integration"
+ run: ./test/Scripts.Integration.Test/configure-sentry.ps1 -UnityPath "$env:UNITY_PATH" -Platform Linux
env:
SENTRY_DSN: ${{ secrets.SENTRY_TEST_DSN }}
- name: Build with Sentry SDK
- run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform Linux -CheckSymbols:$false -UnityVersion "$env:UNITY_VERSION"
+ run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform Linux -UnityVersion "$env:UNITY_VERSION"
- name: Compare build sizes
run: ./test/Scripts.Integration.Test/measure-build-size.ps1 -Path1 "samples/IntegrationTest/Build-NoSentry" -Path2 "samples/IntegrationTest/Build" -Platform Linux -UnityVersion "$env:UNITY_VERSION"
diff --git a/.github/workflows/smoke-test-build-windows.yml b/.github/workflows/test-build-windows.yml
similarity index 92%
rename from .github/workflows/smoke-test-build-windows.yml
rename to .github/workflows/test-build-windows.yml
index cd569b8df..2e40baf13 100644
--- a/.github/workflows/smoke-test-build-windows.yml
+++ b/.github/workflows/test-build-windows.yml
@@ -1,4 +1,4 @@
-name: "IntegrationTest: Build Windows"
+name: "Test: Build Windows"
on:
workflow_call:
inputs:
@@ -42,7 +42,7 @@ jobs:
- name: Download IntegrationTest project
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
- name: smoke-test-${{ env.UNITY_VERSION }}
+ name: test-${{ env.UNITY_VERSION }}
- name: Extract project archive
run: tar -xvzf test-project.tar.gz
@@ -65,7 +65,7 @@ jobs:
- name: Build without Sentry SDK
if: steps.cache-build-nosentry.outputs.cache-hit != 'true'
- run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform Windows -CheckSymbols:$false -BuildDirName "Build-NoSentry"
+ run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform Windows -BuildDirName "Build-NoSentry"
- name: Download UPM package
uses: vaind/download-artifact@e7141b6a94ef28aa3d828b52830cfa1f406a1848 # v4-with-wait-timeout
@@ -80,12 +80,12 @@ jobs:
run: ./test/Scripts.Integration.Test/add-sentry.ps1 -UnityPath "$env:UNITY_PATH" -PackagePath "test-package-release"
- name: Configure Sentry
- run: ./test/Scripts.Integration.Test/configure-sentry.ps1 -UnityPath "$env:UNITY_PATH" -Platform Windows -TestMode "integration"
+ run: ./test/Scripts.Integration.Test/configure-sentry.ps1 -UnityPath "$env:UNITY_PATH" -Platform Windows
env:
SENTRY_DSN: ${{ secrets.SENTRY_TEST_DSN }}
- name: Build with Sentry SDK
- run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform Windows -CheckSymbols:$false -UnityVersion "$env:UNITY_VERSION"
+ run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform Windows -UnityVersion "$env:UNITY_VERSION"
- name: Compare build sizes
run: ./test/Scripts.Integration.Test/measure-build-size.ps1 -Path1 "samples/IntegrationTest/Build-NoSentry" -Path2 "samples/IntegrationTest/Build" -Platform Windows -UnityVersion "$env:UNITY_VERSION"
diff --git a/.github/workflows/smoke-test-compile-ios.yml b/.github/workflows/test-compile-ios.yml
similarity index 93%
rename from .github/workflows/smoke-test-compile-ios.yml
rename to .github/workflows/test-compile-ios.yml
index ba31718c9..770492304 100644
--- a/.github/workflows/smoke-test-compile-ios.yml
+++ b/.github/workflows/test-compile-ios.yml
@@ -1,4 +1,4 @@
-name: "SmokeTest: Compile iOS"
+name: "Test: Compile iOS"
on:
workflow_call:
inputs:
@@ -47,7 +47,7 @@ jobs:
- name: Compile Xcode project without Sentry
if: ${{ inputs.init-type == 'runtime' && steps.cache-compiled-nosentry.outputs.cache-hit != 'true' }}
- run: ./scripts/smoke-test-ios.ps1 Build -UnityVersion "${env:UNITY_VERSION}" -iOSMinVersion "17.0"
+ run: ./scripts/compile-xcode-project.ps1 -iOSMinVersion "17.0"
timeout-minutes: 20
- name: Save compiled app without Sentry
@@ -65,8 +65,8 @@ jobs:
- name: Extract app project
run: tar -xvzf "test-app-$env:INIT_TYPE.tar.gz"
- - name: iOS smoke test
- run: ./scripts/smoke-test-ios.ps1 Build -IsIntegrationTest -UnityVersion "${env:UNITY_VERSION}" -iOSMinVersion "17.0"
+ - name: iOS test
+ run: ./scripts/compile-xcode-project.ps1 -iOSMinVersion "17.0"
timeout-minutes: 20
- name: Upload integration-test project on failure
diff --git a/.github/workflows/smoke-test-create.yml b/.github/workflows/test-create.yml
similarity index 96%
rename from .github/workflows/smoke-test-create.yml
rename to .github/workflows/test-create.yml
index c73550f55..8e7ba861c 100644
--- a/.github/workflows/smoke-test-create.yml
+++ b/.github/workflows/test-create.yml
@@ -1,4 +1,4 @@
-name: "SmokeTest: Create Project"
+name: "Test: Create Project"
on:
workflow_call:
inputs:
@@ -57,7 +57,7 @@ jobs:
- name: Upload project
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
- name: smoke-test-${{ env.UNITY_VERSION }}
+ name: test-${{ env.UNITY_VERSION }}
if-no-files-found: error
path: test-project.tar.gz
# Lower retention period - we only need this to retry CI.
diff --git a/.github/workflows/smoke-test-run-android.yml b/.github/workflows/test-run-android.yml
similarity index 99%
rename from .github/workflows/smoke-test-run-android.yml
rename to .github/workflows/test-run-android.yml
index 7abb585b1..b73168f32 100644
--- a/.github/workflows/smoke-test-run-android.yml
+++ b/.github/workflows/test-run-android.yml
@@ -1,4 +1,4 @@
-name: "SmokeTest: Run Android"
+name: "Test: Run Android"
on:
workflow_call:
inputs:
diff --git a/.github/workflows/smoke-test-run-desktop.yml b/.github/workflows/test-run-desktop.yml
similarity index 98%
rename from .github/workflows/smoke-test-run-desktop.yml
rename to .github/workflows/test-run-desktop.yml
index 2049caf26..283312350 100644
--- a/.github/workflows/smoke-test-run-desktop.yml
+++ b/.github/workflows/test-run-desktop.yml
@@ -1,4 +1,4 @@
-name: "IntegrationTest: Run Desktop"
+name: "Test: Run Desktop"
on:
workflow_call:
inputs:
diff --git a/.github/workflows/smoke-test-run-ios.yml b/.github/workflows/test-run-ios.yml
similarity index 98%
rename from .github/workflows/smoke-test-run-ios.yml
rename to .github/workflows/test-run-ios.yml
index 7d53b345c..e3e320c4f 100644
--- a/.github/workflows/smoke-test-run-ios.yml
+++ b/.github/workflows/test-run-ios.yml
@@ -1,4 +1,4 @@
-name: "IntegrationTest: Run iOS"
+name: "Test: Run iOS"
on:
workflow_call:
inputs:
diff --git a/.github/workflows/smoke-test-run-webgl.yml b/.github/workflows/test-run-webgl.yml
similarity index 97%
rename from .github/workflows/smoke-test-run-webgl.yml
rename to .github/workflows/test-run-webgl.yml
index 441e6d61e..5afc4fc9c 100644
--- a/.github/workflows/smoke-test-run-webgl.yml
+++ b/.github/workflows/test-run-webgl.yml
@@ -1,4 +1,4 @@
-name: "IntegrationTest: Run WebGL"
+name: "Test: Run WebGL"
on:
workflow_call:
inputs:
diff --git a/CLAUDE.md b/CLAUDE.md
index 910fc3276..2b4e0201d 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -113,12 +113,12 @@ The CI system uses modular, reusable workflows in `.github/workflows/`:
| `ci.yml` | Main pipeline - triggers on push/PR |
| `build.yml` | Reusable build workflow |
| `sdk.yml` | Native SDK builds (Android, Linux, Windows, Cocoa) |
-| `smoke-test-create.yml` | Creates integration test projects |
-| `smoke-test-build-android.yml` | Builds Android test apps |
-| `smoke-test-run-android.yml` | Runs Android tests on emulator |
-| `smoke-test-build-ios.yml` | Builds iOS test apps |
-| `smoke-test-compile-ios.yml` | Compiles iOS Xcode projects |
-| `smoke-test-run-ios.yml` | Runs iOS tests on simulator |
+| `test-create.yml` | Creates integration test projects |
+| `test-build-android.yml` | Builds Android test apps |
+| `test-run-android.yml` | Runs Android tests on emulator |
+| `test-build-ios.yml` | Builds iOS test apps |
+| `test-compile-ios.yml` | Compiles iOS Xcode projects |
+| `test-run-ios.yml` | Runs iOS tests on simulator |
| `release.yml` | Manual release preparation |
| `update-deps.yml` | Scheduled dependency updates (daily) |
| `create-unity-matrix.yml` | Generates test matrix |
@@ -160,7 +160,6 @@ Key targets defined in `Directory.Build.targets`:
| `BuildCocoaSDK` | Downloads iOS/macOS SDKs from releases |
| `UnityEditModeTest` | Runs edit-mode unit tests |
| `UnityPlayModeTest` | Runs play-mode tests |
-| `UnitySmokeTestStandalonePlayerIL2CPP` | Runs smoke tests |
### Artifact Caching
@@ -177,7 +176,7 @@ Key targets defined in `Directory.Build.targets`:
3. Validate UPM package contents
4. Create integration test projects
5. Build for WebGL, Linux, Android, iOS, Windows
-6. Run smoke tests and crash tests
+6. Run integration tests and crash tests
7. Measure build sizes
**On Main Branch:**
@@ -506,7 +505,6 @@ Key options:
| Edit Mode | `dotnet msbuild /t:UnityEditModeTest` | `test/Sentry.Unity.Tests/` |
| Play Mode | `dotnet msbuild /t:UnityPlayModeTest` | `test/Sentry.Unity.Tests/` |
| Editor Tests | `dotnet msbuild /t:UnityEditModeTest` | `test/Sentry.Unity.Editor.Tests/` |
-| Smoke Tests | `dotnet msbuild /t:UnitySmokeTestStandalonePlayerIL2CPP` | Integration tests |
| Integration | `integration-test.ps1` | `test/Scripts.Integration.Test/` |
### Running All Tests
@@ -532,7 +530,6 @@ Located in `test/Scripts.Integration.Test/`:
| `add-sentry.ps1` | Adds Sentry package to project |
| `configure-sentry.ps1` | Configures Sentry in test project |
| `build-project.ps1` | Builds for target platform |
-| `run-smoke-test.ps1` | Executes smoke and crash tests |
| `measure-build-size.ps1` | Compares build size with/without SDK |
| `integration-test.ps1` | Full local integration test |
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 143910a2c..33d881249 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -99,7 +99,7 @@ dotnet msbuild /t:"UnityPlayModeTest;UnityEditModeTest" /p:Configuration=Release
Or use the TestRunner window inside the Unity Editor.
-### Integration and Smoke Tests
+### Integration Tests
Run integration tests locally using the same scripts as CI:
diff --git a/Directory.Build.targets b/Directory.Build.targets
index b1a65ad05..772f0fe96 100644
--- a/Directory.Build.targets
+++ b/Directory.Build.targets
@@ -346,13 +346,6 @@ Related: https://forum.unity.com/threads/6572-debugger-agent-unable-to-listen-on
-
-
-
-
-
-
-
@@ -384,11 +377,6 @@ Related: https://forum.unity.com/threads/6572-debugger-agent-unable-to-listen-on
-
-
-
-
-
diff --git a/scripts/compile-xcode-project.ps1 b/scripts/compile-xcode-project.ps1
new file mode 100644
index 000000000..c07cfe054
--- /dev/null
+++ b/scripts/compile-xcode-project.ps1
@@ -0,0 +1,36 @@
+param (
+ [string] $iOSMinVersion = ""
+)
+
+. $PSScriptRoot/../test/Scripts.Integration.Test/common.ps1
+
+$ProjectName = "Unity-iPhone"
+$XcodeArtifactPath = "samples/IntegrationTest/Build"
+$ArchivePath = "$XcodeArtifactPath/archive"
+
+MakeExecutable "$XcodeArtifactPath/MapFileParser.sh"
+MakeExecutable "$XcodeArtifactPath/sentry-cli-Darwin-universal"
+
+If (-not $IsMacOS)
+{
+ Write-Log "This script should only be run on a MacOS." -ForegroundColor Yellow
+}
+
+Write-Host "::group::Building iOS project"
+try
+{
+ xcodebuild `
+ -project "$XcodeArtifactPath/$ProjectName.xcodeproj" `
+ -scheme "Unity-iPhone" `
+ -configuration "Release" `
+ -sdk "iphonesimulator" `
+ -destination "platform=iOS Simulator,OS=$iOSMinVersion" `
+ -destination "platform=iOS Simulator,OS=latest" `
+ -parallel-testing-enabled YES `
+ -derivedDataPath "$ArchivePath/$ProjectName" `
+ | Write-Host
+}
+finally
+{
+ Write-Host "::endgroup::"
+}
diff --git a/scripts/smoke-test-android.ps1 b/scripts/smoke-test-android.ps1
deleted file mode 100644
index 260ac2988..000000000
--- a/scripts/smoke-test-android.ps1
+++ /dev/null
@@ -1,427 +0,0 @@
-param (
- [Parameter(Position = 0)]
- [string] $Action = "",
- [Switch] $IsIntegrationTest,
- [Switch] $WarnIfFlaky,
- [string] $UnityVersion = ""
-)
-
-if (-not $Global:NewProjectPathCache)
-{
- . $PSScriptRoot/../test/Scripts.Integration.Test/globals.ps1
-}
-
-. $PSScriptRoot/../test/Scripts.Integration.Test/common.ps1
-
-# GITHUB_WORKSPACE is the root folder where the project is stored.
-Write-Host "#####################################################"
-Write-Host "# ___ __ __ ___ _ _____ _____ ___ ____ _____ #"
-Write-Host "# / __| \/ |/ _ \| |/ / __|_ _| __|/ __|_ _| #"
-Write-Host "# \__ \ |\/| | (_) | ' <| _| | | | _| \__ \ | | #"
-Write-Host "# |___/_| |_|\___/|_|\_\___| |_| |___|___/ |_| #"
-Write-Host "# #"
-Write-Host "#####################################################"
-
-$BuildDir = $(GetNewProjectBuildPath)
-$ApkFileName = "test.apk"
-$ProcessName = "io.sentry.unity.integrationtest"
-$TestActivityName = $null # Detected after install via dumpsys
-
-$_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))
- {
- New-Item $_ArtifactsPath -ItemType Directory | Out-Null
- }
- $_ArtifactsPath.Replace('\', '/')
-}
-
-function TakeScreenshot([string] $deviceId)
-{
- $file = "/data/local/tmp/screen$(Get-Date -Format "HHmmss").png"
- adb -s $deviceId shell "screencap -p $file"
- adb -s $deviceId pull $file (ArtifactsPath)
- adb -s $deviceId shell "rm $file"
-}
-
-function GetDeviceUiLog([string] $deviceId, [string] $deviceApi)
-{
- if ($deviceApi -eq "21")
- {
- $dumpFile = "/data/local/tmp/window_dump.xml"
- adb -s $deviceId exec-out uiautomator dump $dumpFile
- adb -s $deviceId shell cat $dumpFile
- }
- else
- {
- adb -s $deviceId exec-out uiautomator dump /dev/tty
- }
-}
-
-function LogCat([string] $deviceId, [string] $appPID)
-{
- if ([string]::IsNullOrEmpty($appPID))
- {
- adb -s $device logcat -d
- }
- elseif ($deviceApi -eq "21")
- {
- adb -s $device shell "logcat -d | grep -E '\( *$appPID\)'"
- }
- else
- {
- adb -s $device logcat -d --pid=$appPID
- }
-}
-
-function PidOf([string] $deviceId, [string] $processName)
-{
- $startTime = Get-Date
- $timeout = New-TimeSpan -Seconds 60
-
- while ((Get-Date) - $startTime -lt $timeout)
- {
- if ($deviceApi -eq "21")
- {
- # `pidof` doesn't exist - take second column from the `ps` output for the given process instead.
- $processId = (adb -s $deviceId shell "ps | grep '$processName'") -Split " +" | Select-Object -Skip 1 -First 1
- }
- else
- {
- $processId = adb -s $deviceId shell pidof $processName
- }
-
- if (-not [string]::IsNullOrWhiteSpace($processId))
- {
- return $processId
- }
-
- Write-Log "Process '$processName' not found, retrying in 2 seconds..."
- Start-Sleep -Seconds 2
- }
-
- Write-Log "Could not find PID for process '$processName' after 60 seconds" -ForegroundColor Red
- return $null
-}
-
-function OnError([string] $deviceId, [string] $deviceApi, [string] $appPID)
-{
- Write-Log "Dumping logs for $device"
- Write-Host "::group::logcat"
- LogCat $deviceId $appPID
- Write-Host "::endgroup::"
- LogCat $deviceId $null | Out-File "$(ArtifactsPath)/logcat.txt"
- Write-Host "::group::UI XML Log"
- GetDeviceUiLog $device $deviceApi
- Write-Host "::endgroup::"
- TakeScreenshot $device
-}
-
-# Filter device list
-$RawAdbDeviceList = adb devices
-
-$DeviceList = @()
-foreach ($device in $RawAdbDeviceList)
-{
- If ($device.EndsWith("device"))
- {
- $DeviceList += $device.Replace("device", '').Trim()
- }
-}
-
-$DeviceCount = $DeviceList.Count
-If ($DeviceCount -eq 0)
-{
- Write-Error "It seems like no devices were found $RawAdbDeviceList"
- exit 1
-}
-Else
-{
- Write-Log "Found $DeviceCount devices: $DeviceList"
-}
-
-# Check if APK was built.
-If (-not (Test-Path -Path "$BuildDir/$ApkFileName" ))
-{
- Write-Error "Expected APK on $BuildDir/$ApkFileName but it was not found."
- exit 1
-}
-
-
-### START TEST
-
-# Pick the first device available
-$device = $DeviceList[0]
-adb -s $device logcat -c
-
-$deviceApi = "$(adb -s $device shell getprop ro.build.version.sdk)".Trim()
-$deviceSdk = "$(adb -s $device shell getprop ro.build.version.release)".Trim()
-Write-Log "`nChecking device $device with SDK '$deviceSdk' and API '$deviceApi'"
-
-# Uninstall previous installation
-$stdout = adb -s $device shell "pm list packages -f"
-if ($null -ne ($stdout | Select-String $ProcessName))
-{
- Write-Log "Uninstalling previous $ProcessName."
- $stdout = adb -s $device uninstall $ProcessName
-}
-
-# Move device to home screen
-$stdout = adb -s $device shell input keyevent KEYCODE_HOME
-
-# Install the test app
-$adbInstallRetry = 5
-do
-{
- Write-Log "Installing test app"
- $stdout = (adb -s $device install -r $BuildDir/$ApkFileName 2>&1)
-
- if ($stdout.Contains("Broken pipe"))
- {
- Write-Warning "Failed to comunicate with the Device, retrying..."
- Start-Sleep 3
- $adbInstallRetry--
- }
-} while ($adbInstallRetry -gt 1 -and $stdout.Contains("Broken pipe"))
-
-# Validate the installation
-If ($stdout -contains "Success")
-{
- Write-Log "Successfully installed APK"
-}
-else
-{
- OnError $device $deviceApi
- Write-Error "Failed to install APK: $stdout."
- return 1
-}
-
-# Detect the launcher activity from the installed package
-$dumpOutput = adb -s $device shell dumpsys package $ProcessName 2>&1 | Out-String
-if ($dumpOutput -match "com.unity3d.player.UnityPlayerGameActivity") {
- $TestActivityName = "$ProcessName/com.unity3d.player.UnityPlayerGameActivity"
-} else {
- $TestActivityName = "$ProcessName/com.unity3d.player.UnityPlayerActivity"
-}
-Write-Log "Detected activity: $TestActivityName"
-
-function ProcessNewLogs([array]$newLogs, [ref]$lastLogCount, [array]$logCache) {
- if ($newLogs) {
- $currentLogs = @($newLogs) # Force array creation even for single line
- if ($currentLogs.Count -gt $lastLogCount.Value) {
- $newLines = $currentLogs[$lastLogCount.Value..($currentLogs.Count-1)]
- $lastLogCount.Value = $currentLogs.Count
-
- if ($newLines) {
- $logCache += $newLines
- }
- }
- }
- return $logCache
-}
-
-function RunTest([string] $Name, [string] $SuccessString, [string] $FailureString)
-{
- Write-Host "::group::Test: '$name'"
-
- Write-Log "Clearing logcat from '$device'"
- adb -s $device logcat -c
-
- # Force-stop any existing app instances to ensure clean state.
- # This is especially important after crash tests where zombie processes may linger.
- Write-Log "Force-stopping any existing '$ProcessName' instances"
- adb -s $device shell am force-stop $ProcessName
- Start-Sleep -Milliseconds 500
-
- Write-Log "Setting configuration"
-
- # Mark the full-screen notification as acknowledged
- adb -s $device shell "settings put secure immersive_mode_confirmations confirmed"
- adb -s $device shell "input keyevent KEYCODE_HOME"
-
- Write-Log "Starting app '$TestActivityName'"
-
- # Start the adb command as a background job so we can wait for it to finish with a timeout
- $job = Start-Job -ScriptBlock {
- param($device, $activityName, $Name)
- & adb -s $device shell am start -n $activityName -e test $Name -W 2>&1
- } -ArgumentList $device, $TestActivityName, $Name
-
- # Wait for the job to complete or to timeout
- $completed = Wait-Job $job -Timeout 60
- if ($null -eq $completed) {
- Stop-Job $job
- Remove-Job $job -Force
- Write-Log "Activity start timed out after 60 seconds"
- return $false
- }
-
- Receive-Job $job | Out-Null
- Remove-Job $job
-
- Write-Log "Activity started successfully"
-
- $appPID = PidOf $device $ProcessName
- if ($null -eq $appPID)
- {
- Write-Host "::endgroup::"
- Write-Log "Retrieving process ID failed. Skipping test." -ForegroundColor Red
- return $false
- }
-
- Write-Log "Retrieved ID for '$ProcessName': $appPID"
-
- Write-Log "Waiting for tests to run..."
-
- $processFinished = $false
- $logCache = @()
- $startTime = Get-Date
- $timeout = New-TimeSpan -Seconds 500
- $lastLogCount = 0
-
- # Wait for the tests to run and the game process to complete
- while ((Get-Date) - $startTime -lt $timeout)
- {
- $newLogs = adb -s $device logcat -d --pid=$appPID
- $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'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"))
- {
- Write-Log "Process finished marker detected. Finish waiting for tests to run."
- $processFinished = $true
- break
- }
-
- Start-Sleep -Seconds 1
- }
-
- if ($processFinished)
- {
- Write-Log "'$Name' test finished running."
- }
- else
- {
- Write-Log "'$Name' tests timed out. See logcat for more details."
- }
-
- Write-Host "::endgroup::"
-
- # Fetch the latest logs from the device
- $logCache = ProcessNewLogs -newLogs $newLogs -lastLogCount ([ref]$lastLogCount) -logCache $logCache
-
- Write-Host "::group::logcat"
- $logCache | ForEach-Object { Write-Host $_ }
- Write-Host "::endgroup::"
-
- $lineWithSuccess = $logCache | Select-String $SuccessString
- $lineWithFailure = $logCache | Select-String $FailureString
-
- if ($null -ne $lineWithSuccess)
- {
- Write-Log "'$Name' test passed." -ForegroundColor Green
- return $true
- }
- elseif ($null -ne $lineWithFailure)
- {
- Write-Log "'$Name' test failed. See logcat for more details." -ForegroundColor Red
- return $false
- }
-
- Write-Log "'$Name' test execution failed." -ForegroundColor Red
- return $false
-}
-
-function RunTestWithRetry([string] $Name, [string] $SuccessString, [string] $FailureString, [int] $MaxRetries = 3)
-{
- for ($retryCount = 0; $retryCount -lt $MaxRetries; $retryCount++)
- {
- if ($retryCount -gt 0)
- {
- Write-Log "Retry attempt $retryCount for test '$Name'"
- Start-Sleep -Seconds 2 # Brief pause between retries
- }
-
- Write-Log "Running test attempt $($retryCount + 1)/$MaxRetries"
- $result = RunTest -Name $Name -SuccessString $SuccessString -FailureString $FailureString
-
- if ($result)
- {
- Write-Log "'$Name' test passed on attempt $($retryCount + 1)." -ForegroundColor Green
- return $true
- }
-
- if ($retryCount + 1 -lt $MaxRetries)
- {
- Write-Log "'$Name' test failed. Retrying..." -ForegroundColor Yellow
- continue
- }
-
- Write-Log "'$Name' test failed after $MaxRetries attempts." -ForegroundColor Red
- return $false
- }
-
- return $false
-}
-
-$results = @{
- smokeTestPassed = $false
- hasntCrashedTestPassed = $false
- crashTestPassed = $false
- hasCrashTestPassed = $false
-}
-
-$results.smoketestPassed = RunTestWithRetry -Name "smoke" -SuccessString "SMOKE TEST: PASS" -FailureString "SMOKE TEST: FAIL" -MaxRetries 3
-$results.hasntCrashedTestPassed = RunTestWithRetry -Name "hasnt-crashed" -SuccessString "HASNT-CRASHED TEST: PASS" -FailureString "HASNT-CRASHED TEST: FAIL" -MaxRetries 3
-
-try
-{
- CrashTestWithServer -SuccessString "POST /api/12345/envelope/ HTTP/1.1`" 200 -b'1f8b08000000000000" -CrashTestCallback {
- $results.crashTestPassed = RunTest -Name "crash" -SuccessString "CRASH TEST: Issuing a native crash" -FailureString "CRASH TEST: FAIL"
- $results.hasCrashTestPassed = RunTest -Name "has-crashed" -SuccessString "HAS-CRASHED TEST: PASS" -FailureString "HAS-CRASHED TEST: FAIL"
- }
-}
-catch
-{
- Write-Log "Caught exception: $_"
- Write-Log $_.ScriptStackTrace
- OnError $device $deviceApi
- exit 1
-}
-
-$failed = $false
-
-if (-not $results.smoketestPassed)
-{
- Write-Log "Smoke test failed"
- $failed = $true
-}
-
-if (-not $results.hasntCrashedTestPassed)
-{
- Write-Log "HasntCrashed test failed"
- $failed = $true
-}
-
-if (-not $results.crashTestPassed)
-{
- Write-Log "Crash test failed"
- $failed = $true
-}
-
-if (-not $results.hasCrashTestPassed)
-{
- Write-Log "HasCrashed test failed"
- $failed = $true
-}
-
-if ($failed)
-{
- exit 1
-}
-
-Write-Log "All tests passed" -ForegroundColor Green
-exit 0
diff --git a/scripts/smoke-test-ios.ps1 b/scripts/smoke-test-ios.ps1
deleted file mode 100644
index 9fb992984..000000000
--- a/scripts/smoke-test-ios.ps1
+++ /dev/null
@@ -1,330 +0,0 @@
-param (
- [string] $Action,
- [string] $SelectedRuntime,
- [Int32] $DevicesToRun = 1,
- [Switch] $IsIntegrationTest,
- [string] $UnityVersion = "",
- [string] $iOSMinVersion = ""
-)
-# $Action: 'Build' for build only
-# 'Test' for Smoke test only
-# null for building and testing
-# $SelectedRuntime: the runtime to be run,
-# 'latest' for runing the test with the latest runtime
-# 'iOS ' to run on the specified runtime ex: iOS 12.4
-# $DevicesToRun: the amount of devices to run
-# '0' or empty will run on 1 device, otherwise on the specified amount.
-
-. $PSScriptRoot/../test/Scripts.Integration.Test/common.ps1
-
-Write-Log "Args received Action=$Action, SelectedRuntime=$SelectedRuntime, IsIntegrationTest=$IsIntegrationTest"
-
-$ProjectName = "Unity-iPhone"
-$XcodeArtifactPath = "samples/IntegrationTest/Build"
-$ArchivePath = "$XcodeArtifactPath/archive"
-$AppPath = "$XcodeArtifactPath/IntegrationTest.app"
-$AppName = "com.DefaultCompany.IntegrationTest"
-
-Class AppleDevice
-{
- [String]$Name
- [String]$UUID
- [boolean]$TestFailed
- [boolean]$TestSkipped
-
- Parse([String]$unparsedDevice)
- {
- # Example of unparsed device:
- # iPhone 11 (D3762152-4648-4734-A409-15855F84587A) (Shutdown)
- $unparsedDevice = $unparsedDevice.Trim()
- $result = [regex]::Match($unparsedDevice, "(?.+) \((?[0-9A-Fa-f\-]{36})")
- if ($result.Success -eq $False)
- {
- Throw "$unparsedDevice is not a valid iOS device"
- }
- $this.Name = $result.Groups["model"].Value
- $this.UUID = $result.Groups["uuid"].Value
- }
-}
-
-function Build()
-{
- MakeExecutable "$XcodeArtifactPath/MapFileParser.sh"
- MakeExecutable "$XcodeArtifactPath/sentry-cli-Darwin-universal"
-
- $buildCallback = {
-
- Write-Host "::group::Building iOS project"
- try
- {
- xcodebuild `
- -project "$XcodeArtifactPath/$ProjectName.xcodeproj" `
- -scheme "Unity-iPhone" `
- -configuration "Release" `
- -sdk "iphonesimulator" `
- -destination "platform=iOS Simulator,OS=$iOSMinVersion" `
- -destination "platform=iOS Simulator,OS=latest" `
- -parallel-testing-enabled YES `
- -derivedDataPath "$ArchivePath/$ProjectName" `
- | Write-Host
- }
- finally
- {
- Write-Host "::endgroup::"
- }
- }
-
- if ($IsIntegrationTest)
- {
- $symbolServerOutput = RunWithSymbolServer -Callback $buildCallback
- CheckSymbolServerOutput 'IOS' $symbolServerOutput $UnityVersion
- }
- else
- {
- $buildCallback.Invoke()
- }
-}
-
-function Test
-{
- Write-Log "Retrieving list of available simulators" -ForegroundColor Green
- $deviceListRaw = xcrun simctl list devices
- Write-Host "::group::Available simulators:"
- $deviceListRaw | Write-Host
- Write-Host "::endgroup::"
-
- [AppleDevice[]]$deviceList = @()
-
- Write-Log "Picking simulator based on selected runtime" -ForegroundColor Green
-
- # Find the index of the selected runtime
- $runtimeIndex = ($deviceListRaw | Select-String "-- $SelectedRuntime --").LineNumber
- If ($null -eq $runtimeIndex)
- {
- $deviceListRaw | Write-Host
- throw " Runtime (-- $SelectedRuntime --) not found"
- }
-
- foreach ($device in $deviceListRaw[$runtimeIndex..($deviceListRaw.Count - 1)])
- {
- If ($device.StartsWith("--"))
- {
- # Reached at the end of the iOS list
- break
- }
- $dev = [AppleDevice]::new()
- $dev.Parse($device)
- $deviceList += $dev
- }
-
- $deviceCount = $DeviceList.Count
-
- Write-Host "::group::Found $deviceCount devices on version $SelectedRuntime" -ForegroundColor Green
- ForEach ($device in $deviceList)
- {
- Write-Host "$($device.Name) - $($device.UUID)"
- }
- Write-Host "::endgroup::"
-
- $devicesRan = 0
- ForEach ($device in $deviceList)
- {
- If ($devicesRan -ge $DevicesToRun)
- {
- # Write-Log "Skipping Simulator $($device.Name) UUID $($device.UUID)" -ForegroundColor Green
- $device.TestSkipped = $true
- continue
- }
- $devicesRan++
- Write-Log "Starting Simulator $($device.Name) UUID $($device.UUID)" -ForegroundColor Green
- xcrun simctl boot $($device.UUID)
- Write-Log -NoNewline "Installing Smoke Test on $($device.Name): "
- If (!(Test-Path $AppPath))
- {
- Write-Error "App doesn't exist at the expected path $AppPath. Did you forget to run Build first?"
- }
- xcrun simctl install $($device.UUID) "$AppPath"
- Write-Log "OK" -ForegroundColor Green
-
- function RunTest([string] $Name, [string] $SuccessString, [int] $TimeoutSeconds = 180)
- {
- Write-Log "Test: '$Name'"
- Write-Log "Launching '$Name' test on '$($device.Name)'" -ForegroundColor Green
-
- # Use Start-Process with output redirection and timeout to prevent hanging
- # when the app crashes (which is expected for crash tests)
- $outFile = New-TemporaryFile
- $errFile = New-TemporaryFile
- $consoleOut = @()
-
- try
- {
- $process = Start-Process "xcrun" `
- -ArgumentList "simctl", "launch", "--console-pty", $device.UUID, $AppName, "--test", $Name `
- -NoNewWindow -PassThru `
- -RedirectStandardOutput $outFile `
- -RedirectStandardError $errFile
-
- $timedOut = $null
- $process | Wait-Process -Timeout $TimeoutSeconds -ErrorAction SilentlyContinue -ErrorVariable timedOut
-
- if ($timedOut)
- {
- Write-Log "Test '$Name' timed out after $TimeoutSeconds seconds - stopping process" -ForegroundColor Yellow
- $process | Stop-Process -Force -ErrorAction SilentlyContinue
- }
-
- # Read captured output
- $consoleOut = @(Get-Content $outFile -ErrorAction SilentlyContinue) + `
- @(Get-Content $errFile -ErrorAction SilentlyContinue)
- }
- finally
- {
- Remove-Item $outFile -ErrorAction SilentlyContinue
- Remove-Item $errFile -ErrorAction SilentlyContinue
- }
-
- if ("$SuccessString" -eq "")
- {
- $SuccessString = "$($Name.ToUpper()) TEST: PASS"
- }
-
- Write-Host "::group::$($device.Name) Console Output"
- foreach ($consoleLine in $consoleOut)
- {
- Write-Host $consoleLine
- }
- Write-Host "::endgroup::"
-
- Write-Log -NoNewline "'$Name' test STATUS: "
- $stdout = $consoleOut | Select-String $SuccessString
- If ($null -ne $stdout)
- {
- Write-Log "PASSED" -ForegroundColor Green
- }
- Else
- {
- $device.TestFailed = $True
- Write-Log "FAILED" -ForegroundColor Red
- throw "Test '$Name' failed - success string '$SuccessString' not found in output"
- }
- }
-
- function RunTestSuiteWithRetry([int] $MaxRetries = 3)
- {
- for ($attempt = 1; $attempt -le $MaxRetries; $attempt++)
- {
- Write-Log "Test suite attempt $attempt/$MaxRetries" -ForegroundColor Cyan
-
- if ($attempt -gt 1)
- {
- # Reset simulator state between retries
- Write-Log "Reinstalling app to reset state..." -ForegroundColor Yellow
- xcrun simctl uninstall $($device.UUID) $AppName 2>$null
- Start-Sleep -Seconds 2
- xcrun simctl install $($device.UUID) "$AppPath"
- Start-Sleep -Seconds 2
- }
-
- $device.TestFailed = $false
-
- try
- {
- RunTest "smoke"
- RunTest "hasnt-crashed"
-
- # Note: mobile apps post the crash on the second app launch, so we must run both as part of the "CrashTestWithServer"
- CrashTestWithServer -SuccessString "POST /api/12345/envelope/ HTTP/1.1`" 200 -b'1f8b08000000000000" -CrashTestCallback {
- RunTest "crash" "CRASH TEST: Issuing a native crash"
- RunTest "has-crashed"
- }
-
- Write-Log "All tests passed on attempt $attempt/$MaxRetries" -ForegroundColor Green
- return # Success!
- }
- catch
- {
- Write-Log "Test suite attempt $attempt failed: $_" -ForegroundColor Yellow
-
- if ($attempt -lt $MaxRetries)
- {
- Write-Log "Will retry..." -ForegroundColor Yellow
- continue
- }
-
- # Final attempt failed
- throw
- }
- }
- }
-
- RunTestSuiteWithRetry -MaxRetries 3
-
- Write-Log -NoNewline "Removing Smoke Test from $($device.Name): "
- xcrun simctl uninstall $($device.UUID) $AppName
- Write-Log "OK" -ForegroundColor Green
-
- Write-Log -NoNewline "Requesting shutdown for $($device.Name): "
- # Do not wait for the Simulator to close and continue testing the other simulators.
- Start-Process xcrun -ArgumentList "simctl shutdown `"$($device.UUID)`""
- Write-Log "OK" -ForegroundColor Green
- }
-
- $testFailed = $false
- Write-Log "Test result"
- foreach ($device in $deviceList)
- {
- Write-Log -NoNewline "$($device.Name) UUID $($device.UUID): "
- If ($device.TestFailed)
- {
- Write-Log "FAILED" -ForegroundColor Red
- $testFailed = $true
- }
- ElseIf ($device.TestSkipped)
- {
- Write-Log "SKIPPED" -ForegroundColor Gray
- }
- Else
- {
- Write-Log "PASSED" -ForegroundColor Green
- }
- }
- Write-Log "End of test."
-
- If ($testFailed -eq $true)
- {
- Throw "One or more tests failed."
- }
-}
-
-function LatestRuntime
-{
- $runtimes = xcrun simctl list runtimes iOS
- $lastRuntime = $runtimes | Select-Object -Last 1
- $result = [regex]::Match($lastRuntime, "(?iOS [0-9.]+)")
- if ($result.Success -eq $False)
- {
- Throw "Last runtime was not found, result: $result"
- }
- $lastRuntimeParsed = $result.Groups["runtime"].Value
- Write-Log "Using latest runtime = $lastRuntimeParsed"
- return $lastRuntimeParsed
-}
-
-# MAIN
-If (-not $IsMacOS)
-{
- Write-Log "This script should only be run on a MacOS." -ForegroundColor Yellow
-}
-If ($null -eq $action -Or $action -eq "Build")
-{
- Build
-}
-If ($null -eq $action -Or $action -eq "Test")
-{
- If ($SelectedRuntime -eq "latest" -Or $null -eq $SelectedRuntime)
- {
- $SelectedRuntime = LatestRuntime
- }
- Test
-}
diff --git a/src/Sentry.Unity.Editor/ConfigurationWindow/SentryEditorWindowInstrumentation.cs b/src/Sentry.Unity.Editor/ConfigurationWindow/SentryEditorWindowInstrumentation.cs
index b64677096..2a2d52f16 100644
--- a/src/Sentry.Unity.Editor/ConfigurationWindow/SentryEditorWindowInstrumentation.cs
+++ b/src/Sentry.Unity.Editor/ConfigurationWindow/SentryEditorWindowInstrumentation.cs
@@ -38,12 +38,6 @@ private static void ConfigureOptions(Dictionary args, [CallerMem
OptionsConfigurationItem.SetScript(value);
}
- if (args.TryGetValue("cliOptions.UrlOverride", out value))
- {
- Debug.LogFormat("{0}: Configuring symbol-upload UrlOverride to {1}", functionName, value);
- cliOptions.UrlOverride = value;
- }
-
if (args.TryGetValue("cliOptionsScript", out value))
{
Debug.LogFormat("{0}: Configuring CliOptions Script to {1}", functionName, value);
diff --git a/test/Scripts.Integration.Test/Editor/Builder.cs b/test/Scripts.Integration.Test/Editor/Builder.cs
index bb2ae779c..1e776efab 100644
--- a/test/Scripts.Integration.Test/Editor/Builder.cs
+++ b/test/Scripts.Integration.Test/Editor/Builder.cs
@@ -53,7 +53,7 @@ public static void BuildIl2CPPPlayer(BuildTarget target, BuildTargetGroup group,
};
Debug.Log("Builder: Disabling optimizations to reduce build time");
- // TODO Linux fails with `free(): invalid pointer` in the smoke-test, after everthing seems to have shut down.
+ // TODO Linux fails with `free(): invalid pointer` in the test, after everything seems to have shut down.
if (target != BuildTarget.StandaloneLinux64)
{
PlayerSettings.SetIl2CppCompilerConfiguration(NamedBuildTarget.FromBuildTargetGroup(group), Il2CppCompilerConfiguration.Debug);
@@ -84,11 +84,11 @@ public static void BuildIl2CPPPlayer(BuildTarget target, BuildTargetGroup group,
#endif
}
- Debug.Log("Builder: Checking for SmokeTest scene");
- if (File.Exists("Assets/Scenes/SmokeTest.unity"))
+ Debug.Log("Builder: Checking for Test scene");
+ if (File.Exists("Assets/Scenes/Test.unity"))
{
- Debug.Log("Builder: Adding SmokeTest.unity to scenes");
- buildPlayerOptions.scenes = new[] { "Assets/Scenes/SmokeTest.unity" };
+ Debug.Log("Builder: Adding Test.unity to scenes");
+ buildPlayerOptions.scenes = new[] { "Assets/Scenes/Test.unity" };
}
Debug.Log("Builder: Starting build");
diff --git a/test/Scripts.Integration.Test/Scenes/SmokeTest.unity b/test/Scripts.Integration.Test/Scenes/Test.unity
similarity index 99%
rename from test/Scripts.Integration.Test/Scenes/SmokeTest.unity
rename to test/Scripts.Integration.Test/Scenes/Test.unity
index 86e603ce6..2806c2b8e 100644
--- a/test/Scripts.Integration.Test/Scenes/SmokeTest.unity
+++ b/test/Scripts.Integration.Test/Scenes/Test.unity
@@ -379,7 +379,7 @@ MonoBehaviour:
m_GameObject: {fileID: 1185210226}
m_Enabled: 1
m_EditorHideFlags: 0
- m_Script: {fileID: 11500000, guid: a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6, type: 3}
+ m_Script: {fileID: 11500000, guid: b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1263241751
@@ -543,7 +543,7 @@ MonoBehaviour:
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
- m_Text: Smoke Test
+ m_Text: Integration Test
--- !u!222 &1482558922
CanvasRenderer:
m_ObjectHideFlags: 0
diff --git a/test/Scripts.Integration.Test/Scripts/CliConfiguration.cs b/test/Scripts.Integration.Test/Scripts/CliConfiguration.cs
index 51720bccf..94ebe9e17 100644
--- a/test/Scripts.Integration.Test/Scripts/CliConfiguration.cs
+++ b/test/Scripts.Integration.Test/Scripts/CliConfiguration.cs
@@ -1,7 +1,6 @@
using System;
using Sentry.Unity;
using UnityEngine;
-using UnityEngine.Assertions;
public class CliConfiguration : SentryCliOptionsConfiguration
{
@@ -10,20 +9,9 @@ public override void Configure(SentryCliOptions cliOptions)
Debug.Log("Sentry: CliConfiguration::Configure() called");
var authToken = Environment.GetEnvironmentVariable("SENTRY_AUTH_TOKEN");
- if (!string.IsNullOrEmpty(authToken))
- {
- // Upload to real Sentry using the auth token from the environment.
- cliOptions.UploadSymbols = true;
- cliOptions.UploadSources = true;
- cliOptions.Auth = authToken;
- }
- else
- {
- // Upload to a local symbol server for verification (smoke tests).
- cliOptions.UploadSymbols = !string.IsNullOrEmpty(cliOptions.UrlOverride);
- cliOptions.UploadSources = cliOptions.UploadSymbols;
- cliOptions.Auth = "dummy-token";
- }
+ cliOptions.UploadSymbols = !string.IsNullOrEmpty(authToken);
+ cliOptions.UploadSources = cliOptions.UploadSymbols;
+ cliOptions.Auth = authToken;
cliOptions.Organization = "sentry-sdks";
cliOptions.Project = "sentry-unity";
diff --git a/test/Scripts.Integration.Test/Scripts/IntegrationTester.cs b/test/Scripts.Integration.Test/Scripts/IntegrationTester.cs
index 2c501b269..04466da32 100644
--- a/test/Scripts.Integration.Test/Scripts/IntegrationTester.cs
+++ b/test/Scripts.Integration.Test/Scripts/IntegrationTester.cs
@@ -2,16 +2,30 @@
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
using Sentry;
using Sentry.Unity;
using UnityEngine;
using UnityEngine.Diagnostics;
+#if UNITY_WEBGL
+using System.Web;
+#endif
+
public class IntegrationTester : MonoBehaviour
{
+ private void Awake()
+ {
+ Debug.Log("IntegrationTester, awake!");
+ Application.quitting += () =>
+ {
+ Debug.Log("IntegrationTester is quitting.");
+ };
+ }
+
public void Start()
{
- var arg = TestLauncher.GetTestArg();
+ var arg = GetTestArg();
Debug.Log($"IntegrationTester arg: '{arg}'");
switch (arg)
@@ -37,6 +51,36 @@ public void Start()
}
}
+#if UNITY_IOS && !UNITY_EDITOR
+ // .NET `Environment.GetCommandLineArgs()` doesn't seem to work on iOS so we get the test arg in Objective-C
+ [DllImport("__Internal", EntryPoint="getTestArgObjectiveC")]
+ private static extern string GetTestArg();
+#else
+ private static string GetTestArg()
+ {
+ string arg = null;
+#if UNITY_EDITOR
+#elif UNITY_ANDROID
+ using (var unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
+ using (var currentActivity = unityPlayer.GetStatic("currentActivity"))
+ using (var intent = currentActivity.Call("getIntent"))
+ {
+ arg = intent.Call("getStringExtra", "test");
+ }
+#elif UNITY_WEBGL
+ var uri = new Uri(Application.absoluteURL);
+ arg = HttpUtility.ParseQueryString(uri.Query).Get("test");
+#else
+ var args = Environment.GetCommandLineArgs();
+ if (args.Length > 2 && args[1] == "--test")
+ {
+ arg = args[2];
+ }
+#endif
+ return arg;
+ }
+#endif
+
private void AddIntegrationTestContext(string testType)
{
SentrySdk.AddBreadcrumb("Integration test started");
diff --git a/test/Scripts.Integration.Test/Scripts/OptionsConfiguration.cs b/test/Scripts.Integration.Test/Scripts/OptionsConfiguration.cs
deleted file mode 100644
index 42c9dd652..000000000
--- a/test/Scripts.Integration.Test/Scripts/OptionsConfiguration.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-using System.Collections.Generic;
-using Sentry;
-using Sentry.Unity;
-using UnityEngine;
-
-public class OptionsConfiguration : SentryOptionsConfiguration
-{
- public override void Configure(SentryUnityOptions options)
- {
- Debug.Log("Sentry: OptionsConfig::Configure() called");
-
- string host;
-
-#if UNITY_6000_0 && UNITY_EDITOR
- // Workaround for an issue specific to Unity 6.0 where in CI, `UNITY_ANDROID` would resolve to `false` during the build
- if (UnityEditor.EditorUserBuildSettings.activeBuildTarget == UnityEditor.BuildTarget.Android)
- {
- host = "10.0.2.2";
- }
- else if (UnityEditor.EditorUserBuildSettings.activeBuildTarget == UnityEditor.BuildTarget.WebGL)
- {
- host = "127.0.0.1";
- }
- else
- {
- host = "localhost";
- }
-#else
-
-#if UNITY_ANDROID
- host = "10.0.2.2";
-#elif UNITY_WEBGL
- host = "127.0.0.1";
-#else
- host = "localhost";
-#endif
-#endif
-
- options.Dsn = $"http://publickey@{host}:8000/12345";
-
- Debug.LogFormat("Sentry: Setting options.Dsn = {0}", options.Dsn);
-
- options.AttachScreenshot = true;
- options.Il2CppLineNumberSupportEnabled = true;
- options.Debug = true;
- options.DiagnosticLevel = SentryLevel.Debug;
- options.TracesSampleRate = 1.0d;
- options.PerformanceAutoInstrumentationEnabled = true;
-
- options.CreateHttpMessageHandler = () => SmokeTester.t;
- SmokeTester.CrashedLastRun = () =>
- {
- if (options.CrashedLastRun != null)
- {
- return options.CrashedLastRun() ? 1 : 0;
- }
- return -2;
- };
-
- // Filtering the SmokeTester logs from the breadcrumbs here
- options.AddBreadcrumbsForLogType = new Dictionary
- {
- { LogType.Error, true},
- { LogType.Assert, true},
- { LogType.Warning, true},
- { LogType.Log, false}, // No breadcrumbs for Debug.Log
- { LogType.Exception, true},
- };
-
- // If an ANR triggers while the smoke test runs, the test would fail because we expect exact order of events.
- options.DisableAnrIntegration();
-
- // These options will get overwritten by CI. This allows us to create artifacts for both initialization types.
- options.AndroidNativeInitializationType = NativeInitializationType.Runtime;
- options.IosNativeInitializationType = NativeInitializationType.Runtime;
-
- Debug.Log("Sentry: OptionsConfig::Configure() finished");
- }
-}
diff --git a/test/Scripts.Integration.Test/Scripts/SmokeTester.cs b/test/Scripts.Integration.Test/Scripts/SmokeTester.cs
deleted file mode 100644
index fb88633e6..000000000
--- a/test/Scripts.Integration.Test/Scripts/SmokeTester.cs
+++ /dev/null
@@ -1,437 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.Concurrent;
-using System.Linq;
-using System.Net;
-using System.Net.Http;
-using System.Runtime.InteropServices;
-using System.Threading;
-using System.Threading.Tasks;
-using Sentry;
-using Sentry.Unity;
-using UnityEngine;
-using UnityEngine.Diagnostics;
-using Debug = UnityEngine.Debug;
-
-#if UNITY_WEBGL
-using System.Web;
-#endif
-
-public class SmokeTester : MonoBehaviour
-{
- private void Awake()
- {
- Debug.Log("SmokeTester, awake!");
- Application.quitting += () =>
- {
- // The smoke-test-android.ps1 reads this from console to reliably detect when the tests have finished running.
- Debug.Log("SmokeTester is quitting.");
- };
- }
-
- public void Start()
- {
- Debug.Log("SmokeTester starting");
-
- var arg = GetTestArg();
- Debug.Log($"SmokeTester arg: '{arg}'");
-
- if (arg == "smoke")
- {
- // Running this as coroutine as we need to skip some frames to wait for screenshot capture
- StartCoroutine(SmokeTestCoroutine());
- }
- else if (arg == "hasnt-crashed")
- {
- HasntCrashedTest();
- }
- else if (arg == "crash")
- {
- CrashTest();
- }
- else if (arg == "has-crashed")
- {
- HasCrashedTest();
- }
- else if (arg != null)
- {
- Debug.Log($"Unknown command line argument: {arg}");
- Application.Quit(-1);
- }
- }
-
-#if UNITY_IOS && !UNITY_EDITOR
- // .NET `Environment.GetCommandLineArgs()` doesn't seem to work on iOS so we get the test arg in Objective-C
- [DllImport("__Internal", EntryPoint="getTestArgObjectiveC")]
- private static extern string GetTestArg();
-#else
- private static string GetTestArg()
- {
- string arg = null;
-#if UNITY_EDITOR
-#elif UNITY_ANDROID
- using (var unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
- using (var currentActivity = unityPlayer.GetStatic("currentActivity"))
- using (var intent = currentActivity.Call("getIntent"))
- {
- arg = intent.Call("getStringExtra", "test");
- }
-#elif UNITY_WEBGL
- var uri = new Uri(Application.absoluteURL);
- arg = HttpUtility.ParseQueryString(uri.Query).Get("test");
-#else
- var args = Environment.GetCommandLineArgs();
- if (args.Length > 2 && args[1] == "--test")
- {
- arg = args[2];
- }
-#endif
- return arg;
- }
-#endif
-
- internal static TestHandler t = new TestHandler();
-
- internal static Func CrashedLastRun = () => -1;
-
- private IEnumerator SmokeTestCoroutine()
- {
- t.Start("SMOKE");
-
-#if !UNITY_EDITOR
- var crashed = CrashedLastRun();
-
-#if UNITY_WEBGL
- // On WebGL CrashedLastRun returns `Unknown`
- t.Expect($"options.CrashedLastRun ({crashed}) == unknown (-2)", crashed == -2);
-#else
- t.Expect($"options.CrashedLastRun ({crashed}) == false (0)", crashed == 0);
-#endif
-#endif
- var currentMessage = 0;
- t.ExpectMessage(currentMessage, "'type':'session'");
-
- // Skip the session init requests (there may be multiple of them). We can't skip them by a "positive"
- // because they're also repeated with standard events (in an envelope).
- Debug.Log("Skipping all session requests");
- for (; currentMessage < 10; currentMessage++)
- {
- if (t.CheckMessage(currentMessage, "'type':'transaction'"))
- {
- break;
- }
- }
- Debug.Log($"Done skipping session requests. Last one was: #{currentMessage}");
-
- t.ExpectMessage(currentMessage, "'type':'transaction");
- t.ExpectMessage(currentMessage, "'op':'app.start'"); // startup transaction
- t.ExpectMessageNot(currentMessage, "'length':0");
-
- var guid = Guid.NewGuid().ToString();
- Debug.LogError($"LogError(GUID)={guid}");
-
- // Wait for screenshot capture to complete
- yield return null;
-
- currentMessage++; // The error event
-
- t.ExpectMessage(currentMessage, "'type':'event'");
- t.ExpectMessage(currentMessage, $"LogError(GUID)={guid}");
- // Contexts
- t.ExpectMessage(currentMessage, "'type':'app',");
- t.ExpectMessage(currentMessage, "'type':'device',");
- t.ExpectMessage(currentMessage, "'type':'gpu',");
- t.ExpectMessage(currentMessage, "'type':'os',");
- t.ExpectMessage(currentMessage, "'type':'runtime',");
- t.ExpectMessage(currentMessage, "'type':'unity',");
- t.ExpectMessage(currentMessage, "'active_scene_name':'"); // active scene name
- // User
- t.ExpectMessage(currentMessage, "'user':{'id':'"); // non-null automatic ID
- t.ExpectMessageNot(currentMessage, "'length':0");
-
- currentMessage++; // The screenshot envelope
-
- t.ExpectMessage(currentMessage, "'filename':'screenshot.jpg','attachment_type':'event.attachment'");
- t.ExpectMessageNot(currentMessage, "'length':0");
-
- SentrySdk.CaptureMessage($"CaptureMessage(GUID)={guid}");
-
- // Wait for screenshot capture to complete
- yield return null;
-
- currentMessage++; // The message event
-
- t.ExpectMessage(currentMessage, "'type':'event'");
- t.ExpectMessage(currentMessage, $"CaptureMessage(GUID)={guid}");
- t.ExpectMessageNot(currentMessage, "'length':0");
-
- currentMessage++; // The screenshot envelope
-
- t.ExpectMessage(currentMessage, "'filename':'screenshot.jpg','attachment_type':'event.attachment'");
- t.ExpectMessageNot(currentMessage, "'length':0");
-
- var ex = new Exception("Exception & context test");
- AddContext();
- SentrySdk.CaptureException(ex);
-
- // Wait for screenshot capture to complete
- yield return null;
-
- currentMessage++; // The exception event
-
- t.ExpectMessage(currentMessage, "'type':'event'");
- t.ExpectMessage(currentMessage, "'message':'crumb','type':'error','data':{'foo':'bar'},'category':'bread','level':'fatal'}");
- t.ExpectMessage(currentMessage, "'message':'scope-crumb'}");
- t.ExpectMessage(currentMessage, "'extra':{'extra-key':42}");
- t.ExpectMessage(currentMessage, "'tag-key':'tag-value'");
- t.ExpectMessage(currentMessage, "'user':{'id':'user-id','username':'username','email':'email@example.com','ip_address':'::1','other':{'role':'admin'}}");
- t.ExpectMessageNot(currentMessage, "'length':0");
-
- currentMessage++; // The screenshot envelope
-
- t.ExpectMessage(currentMessage, "'filename':'screenshot.jpg','attachment_type':'event.attachment'");
- t.ExpectMessageNot(currentMessage, "'length':0");
-
- ex = new Exception("Exception & removed context test");
- RemoveContext();
- SentrySdk.CaptureException(ex);
-
- // Wait for screenshot capture to complete
- yield return null;
-
- currentMessage++; // The exception event
-
- t.ExpectMessage(currentMessage, "'type':'event'");
- t.ExpectMessageNot(currentMessage, "'extra':{'extra-key':42}");
- t.ExpectMessageNot(currentMessage, "'tag-key':'tag-value'");
- t.ExpectMessageNot(currentMessage, "user-id");
- t.ExpectMessageNot(currentMessage, "'length':0");
-
- currentMessage++; // The screenshot envelope
-
- t.ExpectMessage(currentMessage, "'filename':'screenshot.jpg','attachment_type':'event.attachment'");
- t.ExpectMessageNot(currentMessage, "'length':0");
-
-#if !UNITY_WEBGL
- // Test screenshot capture from background thread
- var backgroundThreadGuid = Guid.NewGuid().ToString();
- var backgroundThreadTask = Task.Run(() =>
- {
- Debug.Log($"Background thread: Capturing exception with GUID={backgroundThreadGuid}");
- Debug.LogError($"BackgroundThreadException(GUID)={backgroundThreadGuid}");
- });
- backgroundThreadTask.Wait();
-
- // Wait for screenshot capture to complete
- yield return null;
- // The capture coroutine gets queued up to be started in the next Update(), wait for that
- yield return null;
-
- currentMessage++; // The background thread exception event
-
- t.ExpectMessage(currentMessage, "'type':'event'");
- t.ExpectMessage(currentMessage, $"BackgroundThreadException(GUID)={backgroundThreadGuid}");
- t.ExpectMessageNot(currentMessage, "'length':0");
-
- currentMessage++; // The screenshot envelope from background thread
-
- t.ExpectMessage(currentMessage, "'filename':'screenshot.jpg','attachment_type':'event.attachment'");
- t.ExpectMessageNot(currentMessage, "'length':0");
-#endif
- Debug.Log("Finished checking messages.");
-
- t.Pass();
- }
-
- public static void CrashTest()
- {
- t.Start("CRASH");
-
- AddContext();
-
- Debug.Log("CRASH TEST: Issuing a native crash (c++ unhandled exception)");
- Utils.ForceCrash(ForcedCrashCategory.FatalError);
-
- // shouldn't execute because the previous call should have failed
- Debug.Log("CRASH TEST: FAIL - unexpected code executed...");
- Application.Quit(-1);
- }
-
- public static void HasntCrashedTest()
- {
- t.Start("HASNT-CRASHED");
- var crashed = CrashedLastRun();
- t.Expect($"options.CrashedLastRun ({crashed}) == false (0)", crashed == 0);
-
- var lastRunState = SentrySdk.GetLastRunState();
- t.Expect($"SentrySdk.GetLastRunState() ({lastRunState}) is 'DidNotCrash'", lastRunState == SentrySdk.CrashedLastRun.DidNotCrash);
-
- t.Pass();
- }
-
- public static void HasCrashedTest()
- {
- t.Start("HAS-CRASHED");
- var crashed = CrashedLastRun();
- t.Expect($"options.CrashedLastRun ({crashed}) == true (1)", crashed == 1);
-
- var lastRunState = SentrySdk.GetLastRunState();
- t.Expect($"SentrySdk.GetLastRunState() ({lastRunState}) is 'Crashed'", lastRunState == SentrySdk.CrashedLastRun.Crashed);
-
- t.Pass();
- }
-
- private static void AddContext()
- {
- SentrySdk.AddBreadcrumb("crumb", "bread", "error", new Dictionary() { { "foo", "bar" } }, BreadcrumbLevel.Fatal);
- SentrySdk.ConfigureScope((Scope scope) =>
- {
- scope.SetExtra("extra-key", 42);
- scope.AddBreadcrumb("scope-crumb");
- scope.SetTag("tag-key", "tag-value");
- scope.User = new SentryUser()
- {
- Username = "username",
- Email = "email@example.com",
- IpAddress = "::1",
- Id = "user-id",
- Other = new Dictionary() { { "role", "admin" } }
- };
- });
- }
-
- private static void RemoveContext()
- {
- SentrySdk.ConfigureScope((Scope scope) =>
- {
- scope.SetExtra("extra-key", null);
- scope.UnsetTag("tag-key");
- scope.User = new SentryUser
- {
- Username = null,
- Email = null,
- IpAddress = null,
- Id = null,
- };
- });
- }
-
- // CppPlugin.cpp
- [DllImport("__Internal", CallingConvention = CallingConvention.Cdecl)]
- private static extern void throw_cpp();
-
- internal class TestHandler : HttpClientHandler
- {
- private string _name;
- private ConcurrentQueue _requests = new ConcurrentQueue();
- private AutoResetEvent _requestReceived = new AutoResetEvent(false);
-
- private readonly TimeSpan _receiveTimeout = TimeSpan.FromSeconds(10);
-
- private int _testNumber = 0;
- public int ExitCode = 0;
-
- public void Start(string testName)
- {
- _name = testName;
- Debug.Log($"{_name} TEST: start");
- }
-
- protected override Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
- {
- Receive(request);
- return Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK));
- }
-
- private void Receive(HttpRequestMessage message)
- {
- var msgText = message.Content.ReadAsStringAsync().Result;
- Debug.Log($"{_name} TEST: Intercepted HTTP Request #{_requests.Count} = {msgText}");
- _requests.Enqueue(msgText);
- _requestReceived.Set();
- }
-
- public void Exit(int code)
- {
- if (ExitCode != 0)
- {
- Debug.Log($"{_name} TEST: Ignoring spurious Exit({code}). Application is already exiting with code {ExitCode}");
- }
- else
- {
-#if !UNITY_EDITOR
- ExitCode = code;
- Application.Quit(code);
- // Application.Quit doesn't actually terminate immediately so exit the context at least...
- throw new Exception($"Quitting with exit code {code}");
-#endif
- }
- }
-
- public void Pass()
- {
- if (ExitCode == 0)
- {
- // On Android we'll grep logcat for this string instead of relying on exit code:
- Debug.Log($"{_name} TEST: PASS");
-
- // Exit Code 200 to avoid false positive from a graceful exit unrelated to this test run
- ExitCode = 200;
-
-#if !UNITY_WEBGL // We don't quit on WebGL because outgoing HTTP requests (in coroutines) would be cancelled.
- Application.Quit(ExitCode);
-#endif
- }
- }
-
- public void Expect(string message, bool result)
- {
- _testNumber++;
- Debug.Log($"{_name} TEST | {_testNumber}. {message}: {(result ? "PASS" : "FAIL")}");
- if (!result)
- {
- // run-smoke-test.ps1 expects this as failure confirmation
- Debug.Log($"{_name} TEST: FAIL");
- Exit(_testNumber);
- }
- }
-
- public string GetMessage(int index)
- {
- while (true)
- {
- if (_requests.Count > index)
- {
- break;
- }
- if (!_requestReceived.WaitOne(_receiveTimeout))
- {
- Debug.Log($"{_name} TEST: Failed while waiting for an HTTP request #{index} to come in.");
- Exit(_testNumber);
- }
- }
-
- return _requests.ElementAt(index);
- }
-
- public bool CheckMessage(int index, string substring, bool negate = false)
- {
-#if UNITY_WEBGL
- // Note: we cannot use the standard checks on WebGL - it would get stuck here because of the lack of multi-threading.
- // The verification is done in the python script used for WebGL smoke test - smoke-test-webgl.py
- return true;
-#else
- var message = GetMessage(index);
- var contains = message.Contains(substring) || message.Contains(substring.Replace("'", "\""));
- return negate ? !contains : contains;
-#endif
- }
-
- public void ExpectMessage(int index, string substring) =>
- Expect($"HTTP Request #{index} contains \"{substring}\".", CheckMessage(index, substring));
-
- public void ExpectMessageNot(int index, string substring) =>
- Expect($"HTTP Request #{index} doesn't contain \"{substring}\".", CheckMessage(index, substring, negate: true));
- }
-}
diff --git a/test/Scripts.Integration.Test/Scripts/SmokeTester.cs.meta b/test/Scripts.Integration.Test/Scripts/SmokeTester.cs.meta
deleted file mode 100644
index 108e607c2..000000000
--- a/test/Scripts.Integration.Test/Scripts/SmokeTester.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 6b8ba3d687233471198b184bbcb4fdbd
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/test/Scripts.Integration.Test/Scripts/TestLauncher.cs b/test/Scripts.Integration.Test/Scripts/TestLauncher.cs
deleted file mode 100644
index e98281705..000000000
--- a/test/Scripts.Integration.Test/Scripts/TestLauncher.cs
+++ /dev/null
@@ -1,80 +0,0 @@
-using System;
-using System.Runtime.InteropServices;
-using UnityEngine;
-
-#if UNITY_WEBGL
-using System.Web;
-#endif
-
-public class TestLauncher : MonoBehaviour
-{
- private void Awake()
- {
- Debug.Log("TestLauncher, awake!");
- Application.quitting += () =>
- {
- // Keep "SmokeTester is quitting." for backward compatibility with smoke-test-android.ps1
- // and run-smoke-test.ps1 which look for this exact string to detect test completion.
- Debug.Log("SmokeTester is quitting.");
- };
- }
-
- public void Start()
- {
- var arg = GetTestArg();
- Debug.Log($"TestLauncher arg: '{arg}'");
-
- switch (arg)
- {
- // Legacy smoke test commands -> SmokeTester
- case "smoke":
- case "crash":
- case "has-crashed":
- case "hasnt-crashed":
- gameObject.AddComponent();
- break;
-
- // Integration test commands -> IntegrationTester
- case "message-capture":
- case "exception-capture":
- case "crash-capture":
- case "crash-send":
- gameObject.AddComponent();
- break;
-
- default:
- Debug.LogError($"Unknown test command: {arg}");
- Application.Quit(1);
- break;
- }
- }
-
-#if UNITY_IOS && !UNITY_EDITOR
- [DllImport("__Internal", EntryPoint="getTestArgObjectiveC")]
- internal static extern string GetTestArg();
-#else
- internal static string GetTestArg()
- {
- string arg = null;
-#if UNITY_EDITOR
-#elif UNITY_ANDROID
- using (var unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
- using (var currentActivity = unityPlayer.GetStatic("currentActivity"))
- using (var intent = currentActivity.Call("getIntent"))
- {
- arg = intent.Call("getStringExtra", "test");
- }
-#elif UNITY_WEBGL
- var uri = new Uri(Application.absoluteURL);
- arg = HttpUtility.ParseQueryString(uri.Query).Get("test");
-#else
- var args = Environment.GetCommandLineArgs();
- if (args.Length > 2 && args[1] == "--test")
- {
- arg = args[2];
- }
-#endif
- return arg;
- }
-#endif
-}
diff --git a/test/Scripts.Integration.Test/Scripts/TestLauncher.cs.meta b/test/Scripts.Integration.Test/Scripts/TestLauncher.cs.meta
deleted file mode 100644
index 69999fcd4..000000000
--- a/test/Scripts.Integration.Test/Scripts/TestLauncher.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/test/Scripts.Integration.Test/build-project.ps1 b/test/Scripts.Integration.Test/build-project.ps1
index b87f98ec2..35a287637 100644
--- a/test/Scripts.Integration.Test/build-project.ps1
+++ b/test/Scripts.Integration.Test/build-project.ps1
@@ -2,7 +2,6 @@ param(
[string] $UnityPath,
[string] $Platform = "",
[string] $UnityVersion = "",
- [Switch] $CheckSymbols,
[string] $BuildDirName = "Build"
)
@@ -22,15 +21,7 @@ Write-Log "Build method: $buildMethod"
Write-Detail "Output path: $outputPath"
$unityArgs = @("-batchmode", "-projectPath ", "$(GetNewProjectPath)", "-executeMethod", $buildMethod , "-buildPath", $outputPath, "-quit")
-if ($CheckSymbols)
-{
- $symbolServerOutput = RunWithSymbolServer -Callback { RunUnityCustom $unityPath $unityArgs }
- CheckSymbolServerOutput $buildMethod $symbolServerOutput $UnityVersion
-}
-else
-{
- RunUnityCustom $unityPath $unityArgs
-}
+RunUnityCustom $unityPath $unityArgs
if ($Platform -eq "Android-Export")
{
diff --git a/test/Scripts.Integration.Test/common.ps1 b/test/Scripts.Integration.Test/common.ps1
index df147d90c..d9865ef9d 100644
--- a/test/Scripts.Integration.Test/common.ps1
+++ b/test/Scripts.Integration.Test/common.ps1
@@ -1,4 +1,4 @@
-# Note: this is currently used by integration test scripts as well as "smoke-test-*.ps1" scripts.
+# Note: this is currently used by integration test scripts.
# If/when those are merged to some extent, maybe this file could be merged into `globals.ps1`.
Set-StrictMode -Version latest
@@ -73,316 +73,6 @@ function Write-PhaseFailed
Write-Host "$timestamp | [FAILED] $Message" -ForegroundColor Red
}
-function RunApiServer([string] $ServerScript, [string] $Uri)
-{
- if ([string]::IsNullOrEmpty($Uri))
- {
- $Uri = SymbolServerUrlFor ((Test-Path variable:UnityPath) ? $UnityPath : '')
- }
-
- $result = "" | Select-Object -Property process, outFile, errFile, stop, output, dispose
- Write-Log "Starting the $ServerScript on $Uri"
- $result.outFile = New-TemporaryFile
- $result.errFile = New-TemporaryFile
-
- $result.process = Start-Process "python3" -ArgumentList @("$PSScriptRoot/$ServerScript.py", $Uri) `
- -NoNewWindow -PassThru -RedirectStandardOutput $result.outFile -RedirectStandardError $result.errFile
-
- $result.output = { "$(Get-Content $result.outFile -Raw)`n$(Get-Content $result.errFile -Raw)" }.GetNewClosure()
-
- $result.dispose = {
- $result.stop.Invoke()
-
- Write-Host "::group:: Server stdout" -ForegroundColor Yellow
- $stdout = Get-Content $result.outFile -Raw
- Write-Host $stdout
- Write-Host "::endgroup::"
-
- Write-Host "::group:: Server stderr" -ForegroundColor Yellow
- $stderr = Get-Content $result.errFile -Raw
- Write-Host $stderr
- Write-Host "::endgroup::"
-
- Remove-Item $result.outFile -ErrorAction Continue
- Remove-Item $result.errFile -ErrorAction Continue
- return "$stdout`n$stderr"
- }.GetNewClosure()
-
- # Capture Write-Log function so it can be used inside the closure (GetNewClosure captures variables but not functions)
- $writeLog = ${function:Write-Log}
- $result.stop = {
- # Stop the HTTP server
- & $writeLog "Stopping the $ServerScript ... " -NoNewline
- try
- {
- Write-Host (Invoke-WebRequest -Uri "$Uri/STOP").StatusDescription
- }
- catch
- {
- & $writeLog "/STOP request failed: $_ - killing the server process instead"
- $result.process | Stop-Process -Force -ErrorAction SilentlyContinue
- }
- $result.process | Wait-Process -Timeout 10 -ErrorAction Continue
- $result.stop = {}
- }.GetNewClosure()
-
- # The process shouldn't finish by itself, if it did, there was an error, so let's check that
- Start-Sleep -Second 1
- if ($result.process.HasExited)
- {
- Write-Log "Couldn't start the $ServerScript" -ForegroundColor Red
- Write-Log "Standard Output:" -ForegroundColor Yellow
- Get-Content $result.outFile
- Write-Log "Standard Error:" -ForegroundColor Yellow
- Get-Content $result.errFile
- Remove-Item $result.outFile
- Remove-Item $result.errFile
- exit 1
- }
-
- return $result
-}
-
-function CrashTestWithServer([ScriptBlock] $CrashTestCallback, [string] $SuccessString)
-{
- if ("$SuccessString" -eq "")
- {
- throw "SuccessString cannot be empty"
- }
-
- Write-Log "Running crash test with server" -ForegroundColor Yellow
-
- # Retry on server communication issues (success string not found in output).
- # Callback exceptions are re-thrown immediately for the caller to handle.
- if ($null -eq $env:CI)
- {
- $runs = 1
- $timeout = 5
- }
- else
- {
- $runs = 5
- $timeout = 30
- }
-
- for ($run = 1; $run -le $runs; $run++)
- {
- if ($run -ne 1)
- {
- Write-Log "Sleeping for $run seconds before the next retry..."
- Start-Sleep -Seconds $run
- }
-
- # start the server
- $httpServer = RunApiServer "crash-test-server"
-
- # run the test - callback exceptions are re-thrown immediately for the caller to handle
- # (e.g., suite-level retry with app reinstall). Only server issues trigger internal retry.
- try
- {
- $CrashTestCallback.Invoke()
- }
- catch
- {
- $httpServer.stop.Invoke()
- throw
- }
-
- # evaluate the result
- for ($i = $timeout; $i -gt 0; $i--)
- {
- Write-Log "Waiting for the expected message to appear in the server output logs; $i seconds remaining..."
- if ("$($httpServer.output.Invoke())".Contains($SuccessString))
- {
- break
- }
- Start-Sleep -Milliseconds 1000
- }
-
- $output = $httpServer.dispose.Invoke()
- Write-Log "Looking for the SuccessString ($SuccessString) in the server output..."
- if ("$output".Contains($SuccessString))
- {
- Write-Log "crash test $run/$runs : PASSED" -ForegroundColor Green
- break
- }
- Write-Log "SuccessString ($SuccessString) not found..." -ForegroundColor Red
- if ($run -eq $runs)
- {
- throw "crash test $run/$runs : FAILED"
- }
- else
- {
- Write-Warning "crash test $run/$runs : FAILED, retrying"
- }
- }
-}
-
-function SymbolServerUrlFor([string] $UnityPath, [string] $Platform = "")
-{
- # Note: Android and iOS have special handling - even though the project is exported while running in docker,
- # the actual build and thus the symbol-server test runs later, on a different machine, outside docker.
- # Therefore, we return localhost regardless of building in docker.
- (!$UnityPath.StartsWith("docker ") -or ($Platform -eq "iOS") -or ($Platform -eq "Android-Export")) `
- ? 'http://localhost:8000' : 'http://172.17.0.1:8000'
-}
-
-function RunWithSymbolServer([ScriptBlock] $Callback)
-{
- # start the server
- $httpServer = RunApiServer "symbol-upload-server"
-
- # run the test
- try
- {
- $Callback.Invoke()
- }
- finally
- {
- $httpServer.stop.Invoke()
- }
-
- return $httpServer.dispose.Invoke()
-}
-
-function CheckSymbolServerOutput([string] $buildMethod, [string] $symbolServerOutput, [string] $unityVersion)
-{
- Write-Log "Checking symbol server output" -ForegroundColor Yellow
-
- # Server stats contains:
- # filename
- # count = the number of occurrences of the same file name during upload,
- # chunks = the total number of chunks over all occurrences of a file.
- # We don't check the number of chunks because it depends on the file size.
- $expectedFiles = @()
- $unity_6000_3_OrHigher = $unityVersion -match "6000\.[3-9]"
-
- # Currently we only test symbol upload with sources, but we want to keep the values below to also test without in the future.
- # We can have up to 4 different types of files grouped under one name:
- # * the executable itself
- # * the corresponding debug file
- # * the sources if requested
- # * the resolved il2cpp line mapping file
- # For Platforms that pack two different architectures (x64 and arm64 for example)
- # into one file, these numbers are doubled.
- $withSources = $true
- If ($buildMethod.contains('Mac'))
- {
- $expectedFiles = @(
- "GameAssembly.dylib: count=$($withSources ? 8 : 6)",
- 'IntegrationTest: count=2',
- 'Sentry.dylib: count=2',
- "Sentry.dylib.dSYM: count=$($withSources ? 4 : 2)",
- 'UnityPlayer.dylib: count=2'
- )
- }
- ElseIf ($buildMethod.contains('Windows'))
- {
- $expectedFiles = @(
- 'GameAssembly.dll: count=1',
- "GameAssembly.pdb: count=$($withSources ? 3 : 2)",
- 'sentry.dll: count=1',
- "sentry.pdb: count=$($withSources ? 2 : 1)",
- 'test.exe: count=1',
- 'UnityPlayer.dll: count=1'
- )
- }
- ElseIf ($buildMethod.contains('Linux'))
- {
- $expectedFiles = @(
- 'GameAssembly.so: count=1',
- 'UnityPlayer.so: count=1',
- 'UnityPlayer_s.debug: count=1',
- "libsentry.dbg.so: count=$($withSources ? 2 : 1)",
- 'test: count=1',
- 'test_s.debug: count=1'
- )
- }
- ElseIf ($buildMethod.contains('Android'))
- {
- $expectedFiles = @(
- 'libil2cpp.so: count=1',
- 'libmain.so: count=1',
- 'libsentry-android.so: count=1',
- 'libsentry.so: count=1',
- 'libunity.so: count=1',
- 'libunity.sym.so: count=1'
- )
- }
- ElseIf ($buildMethod.contains('IOS'))
- {
- if ($unity_6000_3_OrHigher)
- {
- # Unity 6.3+ removed libiPhone-lib.dylib and Sentry is arm64-only
- $expectedFiles = @(
- "IntegrationTest: count=$($withSources ? 3 : 2)",
- 'Sentry: count=4',
- "UnityFramework: count=$($withSources ? 5 : 4)"
- )
- }
- else
- {
- # Unity 2021 - 6000.2
- $expectedFiles = @(
- "IntegrationTest: count=$($withSources ? 3 : 2)",
- 'Sentry: count=8',
- "UnityFramework: count=$($withSources ? 5 : 4)",
- 'libiPhone-lib.dylib: count=1'
- )
- }
- }
- ElseIf ($buildMethod.contains('WebGL'))
- {
- Write-Log 'No symbols are uploaded for WebGL - nothing to test.' -ForegroundColor Yellow
- return
- }
- ElseIf ($buildMethod.contains('Switch'))
- {
- $expectedFiles = @(
- 'GameAssembly.nss: count=1'
- )
- }
- Else
- {
- Throw "Cannot CheckSymbolServerOutput() for an unknown buildMethod: '$buildMethod'"
- }
-
- Write-Log 'Verifying debug symbol upload...'
- $successful = $true
- :nextExpectedFile foreach ($file in $expectedFiles)
- {
- $alternatives = ($file -is [array]) ? $file : @($file)
- foreach ($file in $alternatives)
- {
- # It's enough if a single symbol alternative is found
- if ($symbolServerOutput -match " $([Regex]::Escape($file))\b")
- {
- Write-Log " $file - OK"
- continue nextExpectedFile
- }
- }
- # Note: control only gets here if none of the alternatives match...
- $fileWithoutCount = $file.Substring(0, $file.Length - 1)
- $filePattern = [Regex]::new('(?<=' + "$([Regex]::Escape($fileWithoutCount))" + ')[\w]+')
- $actualCount = $filePattern.Matches($symbolServerOutput)
-
- if ("$actualCount" -eq "")
- {
- $successful = $false
- }
-
- Write-Log " $alternatives - MISSING `n Server received '$actualCount' instead." -ForegroundColor Red
- }
- if ($successful)
- {
- Write-Log 'All expected debug symbols have been uploaded' -ForegroundColor Green
- }
- else
- {
- exit 1
- }
-}
-
function RunUnityAndExpect([string] $UnityPath, [string] $name, [string] $successMessage, [string[]] $arguments)
{
$stdout = RunUnityCustom $UnityPath $arguments -ReturnLogOutput
diff --git a/test/Scripts.Integration.Test/configure-sentry.ps1 b/test/Scripts.Integration.Test/configure-sentry.ps1
index daa9d4bb1..21c04aa26 100644
--- a/test/Scripts.Integration.Test/configure-sentry.ps1
+++ b/test/Scripts.Integration.Test/configure-sentry.ps1
@@ -1,9 +1,6 @@
param(
[string] $UnityPath,
- [string] $Platform = "",
- [Switch] $CheckSymbols,
- [ValidateSet("smoke", "integration")]
- [string] $TestMode = "smoke"
+ [string] $Platform = ""
)
if (-not $Global:NewProjectPathCache)
@@ -15,16 +12,13 @@ if (-not $Global:NewProjectPathCache)
$UnityPath = FormatUnityPath $UnityPath
-Write-Log "Configuring Sentry options (TestMode: $TestMode)..."
-
-$optionsScript = if ($TestMode -eq "integration") { "IntegrationOptionsConfiguration" } else { "OptionsConfiguration" }
+Write-Log "Configuring Sentry options..."
$unityArgs = @( `
"-quit", "-batchmode", "-nographics", "-disable-assembly-updater", "-projectPath ", $(GetNewProjectPath), `
"-executeMethod", "Sentry.Unity.Editor.ConfigurationWindow.SentryEditorWindowInstrumentation.ConfigureOptions", `
- "-optionsScript", $optionsScript, `
- "-cliOptionsScript", "CliConfiguration", `
- "-cliOptions.UrlOverride", ($CheckSymbols ? (SymbolServerUrlFor $UnityPath $Platform) : "") )
+ "-optionsScript", "IntegrationOptionsConfiguration", `
+ "-cliOptionsScript", "CliConfiguration" )
if ($env:SENTRY_DSN) {
$unityArgs += @("-dsn", $env:SENTRY_DSN)
diff --git a/test/Scripts.Integration.Test/crash-test-server.py b/test/Scripts.Integration.Test/crash-test-server.py
deleted file mode 100644
index 08cd2589f..000000000
--- a/test/Scripts.Integration.Test/crash-test-server.py
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/env python3
-
-from http import HTTPStatus
-from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
-from urllib.parse import urlparse
-import sys
-import threading
-import binascii
-
-
-class Handler(BaseHTTPRequestHandler):
- def commonServe(self):
- self.send_response(200, "")
- self.end_headers()
- sys.stdout.flush()
- sys.stderr.flush()
-
- if (self.path == "/STOP"):
- print("HTTP server stopping!")
- threading.Thread(target=self.server.shutdown).start()
-
- def do_GET(self):
- self.commonServe()
-
- def do_POST(self):
- self.commonServe()
-
- # override
- def log_request(self, code='-', size='-'):
- if isinstance(code, HTTPStatus):
- code = code.value
- body = ""
- if self.command == "POST" and 'Content-Length' in self.headers:
- content_length = int(self.headers['Content-Length'])
- content = self.rfile.read(content_length)
- try:
- body = content.decode("utf-8")
- except:
- body = binascii.hexlify(bytearray(content))
- body = body[0:min(1000, len(body))]
- self.log_message('"%s" %s %s%s',
- self.requestline, str(code), str(size), body)
-
-
-uri = urlparse(sys.argv[1] if len(sys.argv) > 1 else 'http://127.0.0.1:8000')
-print("HTTP server listening on {}".format(uri.geturl()))
-print("To stop the server, execute a GET request to {}/STOP".format(uri.geturl()))
-httpd = ThreadingHTTPServer((uri.hostname, uri.port), Handler)
-target = httpd.serve_forever()
diff --git a/test/Scripts.Integration.Test/integration-test.ps1 b/test/Scripts.Integration.Test/integration-test.ps1
index 8d14be637..37c4a4783 100644
--- a/test/Scripts.Integration.Test/integration-test.ps1
+++ b/test/Scripts.Integration.Test/integration-test.ps1
@@ -11,8 +11,7 @@ param(
[string] $NativeSDKPath,
[switch] $Recreate,
[switch] $Rebuild,
- [switch] $SkipTests,
- [switch] $CheckSymbols
+ [switch] $SkipTests
)
if (-not $Global:NewProjectPathCache) {
@@ -47,7 +46,7 @@ If (-not(Test-Path -Path "$(GetNewProjectPath)")) {
Write-PhaseSuccess "Sentry added"
Write-PhaseHeader "Configuring Sentry"
- ./test/Scripts.Integration.Test/configure-sentry.ps1 "$UnityPath" -Platform $Platform -CheckSymbols:$CheckSymbols
+ ./test/Scripts.Integration.Test/configure-sentry.ps1 "$UnityPath" -Platform $Platform
Write-PhaseSuccess "Sentry configured"
}
@@ -64,17 +63,17 @@ Else {
Write-Log "No NativeSDKPath provided (native features disabled)" -ForegroundColor Yellow
}
-# Support rebuilding the integration test project. I.e. if you make changes to the SmokeTester.cs during
+# Support rebuilding the integration test project.
If ($Rebuild -or -not(Test-Path -Path $(GetNewProjectBuildPath))) {
Write-PhaseHeader "Building Project"
If ("iOS" -eq $Platform) {
# 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
- & "./scripts/smoke-test-ios.ps1" Build -IsIntegrationTest -UnityVersion $UnityVersion
+ & "./scripts/compile-xcode-project.ps1"
}
Else {
- ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$UnityPath" -CheckSymbols:$CheckSymbols -UnityVersion $UnityVersion -Platform $Platform
+ ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$UnityPath" -UnityVersion $UnityVersion -Platform $Platform
}
Write-PhaseSuccess "Project built"
}
@@ -87,13 +86,16 @@ Else {
Switch -Regex ($Platform) {
"^(Windows|MacOS|Linux)$" {
- ./test/Scripts.Integration.Test/run-smoke-test.ps1 -Smoke -Crash
+ $env:SENTRY_TEST_APP = GetNewProjectBuildPath
+ Invoke-Pester -Path test/IntegrationTest/Integration.Tests.Desktop.ps1 -CI
}
"^(Android)$" {
- ./scripts/smoke-test-android.ps1
+ $env:SENTRY_TEST_APK = "$(GetNewProjectBuildPath)/test.apk"
+ Invoke-Pester -Path test/IntegrationTest/Integration.Tests.ps1 -CI
}
"^iOS$" {
- ./scripts/smoke-test-ios.ps1 Test "latest" -IsIntegrationTest
+ $env:SENTRY_TEST_APP = "$(GetNewProjectBuildPath)/IntegrationTest.app"
+ Invoke-Pester -Path test/IntegrationTest/Integration.Tests.iOS.ps1 -CI
}
"^WebGL$" {
$env:SENTRY_WEBGL_BUILD_PATH = GetNewProjectBuildPath
diff --git a/test/Scripts.Integration.Test/run-smoke-test.ps1 b/test/Scripts.Integration.Test/run-smoke-test.ps1
deleted file mode 100644
index 59c3c36ad..000000000
--- a/test/Scripts.Integration.Test/run-smoke-test.ps1
+++ /dev/null
@@ -1,202 +0,0 @@
-param (
- [Parameter(Position = 0)]
- [string] $TestAppPath = "",
-
- [Parameter()]
- [string] $AppDataDir = "",
-
- [Parameter()]
- [switch] $Smoke,
-
- [Parameter()]
- [switch] $Crash,
-
- [Parameter()]
- [int] $MaxRetries = 3
-)
-
-if (-not $Global:NewProjectPathCache)
-{
- . $PSScriptRoot/globals.ps1
-}
-
-. $PSScriptRoot/common.ps1
-
-Write-Log "Given parameters:"
-Write-Log " TestAppPath: $TestAppPath"
-Write-Log " AppDataDir: $AppDataDir"
-Write-Log " Smoke: $Smoke"
-Write-Log " Crash: $Crash"
-Write-Log " MaxRetries: $MaxRetries"
-
-If (!$Smoke -and !$Crash)
-{
- Write-Error "Select one of the following tests (or both): -Smoke or -Crash"
-}
-
-if ("$TestAppPath" -eq "")
-{
- If ($IsMacOS)
- {
- $TestAppPath = "$(GetNewProjectBuildPath)/test.app/Contents/MacOS/$(GetNewProjectName)"
- if ("$AppDataDir" -eq "")
- {
- $AppDataDir = "$env:HOME/Library/Logs/DefaultCompany/$(GetNewProjectName)/"
- }
- }
- ElseIf ($IsWindows)
- {
- $TestAppPath = "$(GetNewProjectBuildPath)/test.exe"
- if ("$AppDataDir" -eq "")
- {
- $AppDataDir = "$env:UserProfile\AppData\LocalLow\DefaultCompany\$(GetNewProjectName)\"
- }
- }
- ElseIf ($IsLinux)
- {
- $TestAppPath = "$(GetNewProjectBuildPath)/test"
- chmod +x $TestAppPath
- if ("$AppDataDir" -eq "")
- {
- $AppDataDir = "$env:HOME/.config/unity3d/DefaultCompany/$(GetNewProjectName)/"
- }
- }
- Else
- {
- Write-Error "Unsupported build"
- }
-}
-
-Write-Log "Resolved parameters:"
-Write-Log " TestAppPath: $TestAppPath"
-Write-Log " AppDataDir: $AppDataDir"
-
-function RunTest([string] $type)
-{
- Write-Host "::group::Test: '$type'"
- try
- {
- if ($IsLinux -and "$env:XDG_CURRENT_DESKTOP" -eq "" -and (Get-Command "xvfb-run" -ErrorAction SilentlyContinue))
- {
- Write-Log "Running xvfb-run -ae /dev/stdout $TestAppPath --test $type"
- $process = Start-Process "xvfb-run" -ArgumentList "-ae", "/dev/stdout", "$TestAppPath", "--test", $type -PassThru
- }
- else
- {
- Write-Log "Running $TestAppPath --test $type"
- $process = Start-Process "$TestAppPath" -ArgumentList "--test", $type -PassThru
- }
-
- If ($null -eq $process)
- {
- Throw "Process not found."
- }
-
- # Wait for the test to finish
- $timedOut = $null # reset any previously set timeout
- $process | Wait-Process -Timeout 60 -ErrorAction SilentlyContinue -ErrorVariable timedOut
-
- $appLog = ""
- if ("$AppDataDir" -ne "")
- {
- Write-Log "$type test: Player.log contents:" -ForegroundColor Yellow
- $appLog = Get-Content "$AppDataDir/Player.log"
- $appLog
- Write-Log "================================================================================" -ForegroundColor Yellow
- Write-Log "$type test: Player.log contents END" -ForegroundColor Yellow
- }
-
- # Check for test failures first - a graceful shutdown doesn't mean tests passed.
- $lineWithFailure = $appLog | Select-String "$($type.ToUpper()) TEST: FAIL"
- If ($lineWithFailure)
- {
- $info = "Test process finished with status code $($process.ExitCode). $lineWithFailure"
- If ($type -ne "crash")
- {
- throw $info
- }
- Write-Log $info
- }
- # Relying on ExitCode does not seem reliable. We're looking for the line "SmokeTester is quitting." instead to indicate
- # a successful shut-down.
- ElseIf ($appLog | Select-String "SmokeTester is quitting.")
- {
- Write-Log "$type test: PASSED" -ForegroundColor Green
- }
- ElseIf ($timedOut)
- {
- $process | Stop-Process -Force
- Throw "Test process timed out."
- }
- Else
- {
- $info = "Test process finished with status code $($process.ExitCode). No completion marker found in Player.log"
- If ($type -ne "crash")
- {
- throw $info
- }
- Write-Log $info
- }
- }
- finally
- {
- if ($null -ne $process -and !$process.HasExited)
- {
- Write-Warning "Process still running - forcing termination."
- $process | Stop-Process -Force
- }
- Write-Host "::endgroup::"
- }
-}
-
-for ($attempt = 1; $attempt -le $MaxRetries; $attempt++)
-{
- Write-Log "Test suite attempt $attempt/$MaxRetries"
-
- if ("$AppDataDir" -ne "" -and (Test-Path $AppDataDir))
- {
- Write-Warning "Removing AppDataDir '$AppDataDir'"
- Remove-Item -Force -Recurse $AppDataDir
- }
-
- try
- {
- if ($Smoke)
- {
- RunTest "smoke"
- RunTest "hasnt-crashed"
- }
-
- if ($Crash)
- {
- # Note: macOS & Linux apps post the crash on the next app launch so we must run both as part of the "CrashTestWithServer"
- # Windows posts the crash immediately because the handler runs as a standalone process.
- if ($IsMacOS -or $IsLinux)
- {
- $expectedFragment = $IsMacOS ? '1f8b08000000000000' : '7b2264736e223a2268'
- CrashTestWithServer -SuccessString "POST /api/12345/envelope/ HTTP/1.1`" 200 -b'$expectedFragment" -CrashTestCallback {
- RunTest "crash" "CRASH TEST: Issuing a native crash"
- RunTest "has-crashed"
- }
- }
- else
- {
- CrashTestWithServer -SuccessString "POST /api/12345/minidump/" -CrashTestCallback { RunTest "crash" }
- RunTest "has-crashed"
- }
- }
-
- Write-Log "All tests passed on attempt $attempt/$MaxRetries"
- return
- }
- catch
- {
- Write-Log "Test suite attempt $attempt failed: $_"
- if ($attempt -lt $MaxRetries)
- {
- Write-Log "Will retry..."
- continue
- }
- throw
- }
-}
diff --git a/test/Scripts.Integration.Test/symbol-upload-server.py b/test/Scripts.Integration.Test/symbol-upload-server.py
deleted file mode 100644
index 04545d120..000000000
--- a/test/Scripts.Integration.Test/symbol-upload-server.py
+++ /dev/null
@@ -1,136 +0,0 @@
-#!/usr/bin/env python3
-
-from http import HTTPStatus
-from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
-from urllib.parse import urlparse
-from threading import Thread, Lock
-import sys
-import threading
-import binascii
-import json
-
-apiOrg = 'sentry-sdks'
-apiProject = 'sentry-unity'
-uri = urlparse(sys.argv[1] if len(sys.argv) > 1 else 'http://127.0.0.1:8000')
-uploads = {}
-lock = Lock()
-
-
-def registerUpload(name: str, chunks: int):
- lock.acquire()
- try:
- if name not in uploads:
- uploads[name] = \
- {'count': 1, 'chunks': chunks}
- else:
- uploads[name]['count'] += 1
- uploads[name]['chunks'] += chunks
- finally:
- lock.release()
-
-
-class Handler(BaseHTTPRequestHandler):
- body = None
-
- def do_GET(self):
- self.start_response(HTTPStatus.OK)
-
- if self.path == "/STOP":
- print("HTTP server stopping!")
- threading.Thread(target=self.server.shutdown).start()
-
- if self.isApi('api/0/organizations/{}/chunk-upload/'.format(apiOrg)):
- self.writeJSON('{"url":"' + uri.geturl() + self.path + '",'
- '"chunkSize":8388608,"chunksPerRequest":64,"maxFileSize":2147483648,'
- '"maxRequestSize":33554432,"concurrency":1,"hashAlgorithm":"sha1","compression":["gzip"],'
- '"accept":["debug_files","release_files","pdbs","sources","bcsymbolmaps"]}')
- else:
- self.end_headers()
-
- self.flushLogs()
-
- def do_POST(self):
- self.start_response(HTTPStatus.OK)
-
- if self.isApi('api/0/projects/{}/{}/files/difs/assemble/'.format(apiOrg, apiProject)):
- # Request body example:
- # {
- # "9a01653a...":{"name":"UnityPlayer.dylib","debug_id":"eb4a7644-...","chunks":["f84d3907945cdf41b33da8245747f4d05e6ffcb4", ...]},
- # "4185e454...":{"name":"UnityPlayer.dylib","debug_id":"86d95b40-...","chunks":[...]}
- # }
- # Response body to let the CLI know we have the symbols already (we don't need to test the actual upload):
- # {
- # "9a01653a...":{"state":"ok","missingChunks":[]},
- # "4185e454...":{"state":"ok","missingChunks":[]}
- # }
- jsonRequest = json.loads(self.body)
- jsonResponse = '{'
- for key, value in jsonRequest.items():
- jsonResponse += '"{}"'.format(key)
- jsonResponse += ':{"state":"ok","missingChunks":[]},'
- registerUpload(value['name'], len(value['chunks']))
- jsonResponse = jsonResponse.rstrip(',') + '}'
- self.writeJSON(jsonResponse)
- elif self.isApi('api/0/projects/{}/{}/files/dsyms/'.format(apiOrg, apiProject)):
- self.writeJSON('[]')
- elif self.isApi('api/0/projects/{}/{}/reprocessing/'.format(apiOrg, apiProject)):
- self.writeJSON('{}')
- else:
- self.end_headers()
-
- self.flushLogs()
-
- def start_response(self, code):
- self.body = None
- self.log_request(code)
- self.send_response_only(code)
-
- def log_request(self, code=None, size=None):
- if isinstance(code, HTTPStatus):
- code = code.value
- body = self.body = self.requestBody()
- if body:
- body = self.body[0:min(1000, len(body))]
- self.log_message('"%s" %s %s%s',
- self.requestline, str(code), "({} bytes)".format(size) if size else '', body)
-
- # Note: this may only be called once during a single request - can't `.read()` the same stream again.
- def requestBody(self):
- if self.command == "POST" and 'Content-Length' in self.headers:
- length = int(self.headers['Content-Length'])
- content = self.rfile.read(length)
- try:
- return content.decode("utf-8")
- except:
- return binascii.hexlify(bytearray(content))
- return None
-
- def isApi(self, api: str):
- if self.path.strip('/') == api.strip('/'):
- self.log_message("Matched API endpoint {}".format(api))
- return True
- return False
-
- def writeJSON(self, string: str):
- self.send_header("Content-type", "application/json")
- self.end_headers()
- self.wfile.write(str.encode(string))
-
- def flushLogs(self):
- sys.stdout.flush()
- sys.stderr.flush()
-
-
-print("HTTP server listening on {}".format(uri.geturl()))
-print("To stop the server, execute a GET request to {}/STOP".format(uri.geturl()))
-
-try:
- httpd = ThreadingHTTPServer((uri.hostname, uri.port), Handler)
- target = httpd.serve_forever()
-except KeyboardInterrupt:
- pass
-finally:
- print('Upload stats:')
- for k in sorted(uploads):
- v = uploads[k]
- print(' {}: count={} chunks={}'.format(k, v['count'], v['chunks']))