mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 11:07:10 +00:00
feat(conformance): add android backend to the gate suite
This commit is contained in:
1 parent
831f8bd603
commit
2331cb9866
1 file changed
+39
-8
+39
-8
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Scripted conformance gate for the iOS simulator driver. Runs five serial,
|
# Scripted conformance gate for the mobile drivers. Runs five serial,
|
||||||
# non-overlapping 3-minute fuzz runs against the folio example app
|
# non-overlapping 3-minute fuzz runs against the folio example app
|
||||||
# (examples/folio) and scores five gates (G1..G5) over the captured traces and
|
# (examples/folio) and scores five gates (G1..G5) over the captured traces and
|
||||||
# output. Exits non-zero if any gate fails.
|
# output. Exits non-zero if any gate fails.
|
||||||
@@ -9,10 +9,14 @@
|
|||||||
# BACKEND=device drive an attached physical iPhone via the
|
# BACKEND=device drive an attached physical iPhone via the
|
||||||
# driver's runner-only device path; select it
|
# driver's runner-only device path; select it
|
||||||
# with IOS_DEVICE="<name>" (passed as --ios-device)
|
# with IOS_DEVICE="<name>" (passed as --ios-device)
|
||||||
|
# BACKEND=android drive an Android device/emulator over the JVM
|
||||||
|
# sidecar; select a specific device with
|
||||||
|
# ANDROID_DEVICE="<adb serial>" (passed as --device)
|
||||||
#
|
#
|
||||||
# Usage:
|
# Usage:
|
||||||
# ./gates.sh run the simulator gates
|
# ./gates.sh run the simulator gates
|
||||||
# BACKEND=device IOS_DEVICE="iPhone" ./gates.sh
|
# BACKEND=device IOS_DEVICE="iPhone" ./gates.sh
|
||||||
|
# BACKEND=android ANDROID_DEVICE="663c91b1" ./gates.sh
|
||||||
# ./gates.sh --self-test run the offline analyzer tests only
|
# ./gates.sh --self-test run the offline analyzer tests only
|
||||||
#
|
#
|
||||||
# Tunables (environment):
|
# Tunables (environment):
|
||||||
@@ -34,9 +38,11 @@ SEED="${SEED:-0}"
|
|||||||
P95_LIMIT_MS="${P95_LIMIT_MS:-2500}"
|
P95_LIMIT_MS="${P95_LIMIT_MS:-2500}"
|
||||||
SANDERLING="${SANDERLING:-sanderling}"
|
SANDERLING="${SANDERLING:-sanderling}"
|
||||||
IOS_DEVICE="${IOS_DEVICE:-iPhone 17 Pro}"
|
IOS_DEVICE="${IOS_DEVICE:-iPhone 17 Pro}"
|
||||||
|
ANDROID_DEVICE="${ANDROID_DEVICE:-}"
|
||||||
|
|
||||||
bundle_id="app.folio"
|
bundle_id="app.folio"
|
||||||
spec_path="${folio_directory}/sanderling/spec.ts"
|
spec_path="${folio_directory}/sanderling/spec.ts"
|
||||||
|
android_apk="${folio_directory}/app/androidApp/build/outputs/apk/debug/androidApp-debug.apk"
|
||||||
# The built app bundle differs by SDK: the simulator build lands under
|
# The built app bundle differs by SDK: the simulator build lands under
|
||||||
# Debug-iphonesimulator, the device build under Debug-iphoneos.
|
# Debug-iphonesimulator, the device build under Debug-iphoneos.
|
||||||
if [[ "$BACKEND" == "device" ]]; then
|
if [[ "$BACKEND" == "device" ]]; then
|
||||||
@@ -45,6 +51,11 @@ else
|
|||||||
ios_app="${folio_directory}/app/iosApp/build/Build/Products/Debug-iphonesimulator/iosApp.app"
|
ios_app="${folio_directory}/app/iosApp/build/Build/Products/Debug-iphonesimulator/iosApp.app"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Run adb against the selected Android device, or the only one if unset.
|
||||||
|
adb_target() {
|
||||||
|
if [[ -n "$ANDROID_DEVICE" ]]; then adb -s "$ANDROID_DEVICE" "$@"; else adb "$@"; fi
|
||||||
|
}
|
||||||
|
|
||||||
# The companion binary, embedded for simulator runs. Referenced by file name
|
# The companion binary, embedded for simulator runs. Referenced by file name
|
||||||
# only for the orphan-process check; prose elsewhere says "the companion".
|
# only for the orphan-process check; prose elsewhere says "the companion".
|
||||||
companion_process_name="idb_companion"
|
companion_process_name="idb_companion"
|
||||||
@@ -197,6 +208,12 @@ print(samples[rank - 1])
|
|||||||
# dies with sanderling, so it leaves no process to check. Empty output is clean.
|
# dies with sanderling, so it leaves no process to check. Empty output is clean.
|
||||||
orphan_processes() {
|
orphan_processes() {
|
||||||
local found=""
|
local found=""
|
||||||
|
if [[ "$BACKEND" == "android" ]]; then
|
||||||
|
# sanderling SIGTERMs the JVM sidecar on shutdown; a survivor is an orphan.
|
||||||
|
if pgrep -f "sanderling-sidecar.*\.jar" >/dev/null 2>&1; then found+="sidecar "; fi
|
||||||
|
printf '%s' "$found"
|
||||||
|
return
|
||||||
|
fi
|
||||||
if pgrep -f "$companion_process_name" >/dev/null 2>&1; then
|
if pgrep -f "$companion_process_name" >/dev/null 2>&1; then
|
||||||
found+="companion "
|
found+="companion "
|
||||||
fi
|
fi
|
||||||
@@ -223,15 +240,26 @@ invoke_sanderling() {
|
|||||||
local output_log="$2"
|
local output_log="$2"
|
||||||
local exit_status_file="$3"
|
local exit_status_file="$3"
|
||||||
|
|
||||||
# Both backends pass --ios-app-path so each run reinstalls the current build
|
local platform target_flags=()
|
||||||
# for a clean clear-state start (device install via devicectl, simulator via
|
if [[ "$BACKEND" == "android" ]]; then
|
||||||
# simctl). The device backend selects the connected iPhone by name; the
|
# pm clear is blocked on some OEM ROMs, so a fresh install (which wipes
|
||||||
# simulator backend boots IOS_DEVICE if nothing is booted.
|
# /data/data) provides the clean clear-state start; --clear-data=false
|
||||||
local target_flags=(--ios-device "$IOS_DEVICE" --ios-app-path "$ios_app")
|
# then skips the sidecar's pm clear. Mirrors the iOS per-run reinstall.
|
||||||
|
platform=android
|
||||||
|
adb_target uninstall "$bundle_id" >/dev/null 2>&1 || true
|
||||||
|
adb_target install "$android_apk" >/dev/null
|
||||||
|
target_flags=(--clear-data=false)
|
||||||
|
[[ -n "$ANDROID_DEVICE" ]] && target_flags+=(--device "$ANDROID_DEVICE")
|
||||||
|
else
|
||||||
|
# The iOS backends pass --ios-app-path so each run reinstalls the current
|
||||||
|
# build for a clean start (device via devicectl, simulator via simctl).
|
||||||
|
platform=ios
|
||||||
|
target_flags=(--ios-device "$IOS_DEVICE" --ios-app-path "$ios_app")
|
||||||
|
fi
|
||||||
|
|
||||||
local status=0
|
local status=0
|
||||||
"$SANDERLING" test \
|
"$SANDERLING" test \
|
||||||
--platform ios \
|
--platform "$platform" \
|
||||||
--spec "$spec_path" \
|
--spec "$spec_path" \
|
||||||
--bundle-id "$bundle_id" \
|
--bundle-id "$bundle_id" \
|
||||||
"${target_flags[@]}" \
|
"${target_flags[@]}" \
|
||||||
@@ -255,7 +283,10 @@ collect_run_artifacts() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
run_gates() {
|
run_gates() {
|
||||||
if [[ "$BACKEND" == "simulator" ]]; then
|
if [[ "$BACKEND" == "android" ]]; then
|
||||||
|
echo "preparing folio android build"
|
||||||
|
( cd "$folio_directory" && ANDROID_DEVICE="$ANDROID_DEVICE" just install >/dev/null )
|
||||||
|
elif [[ "$BACKEND" == "simulator" ]]; then
|
||||||
echo "preparing folio build for the simulator backend"
|
echo "preparing folio build for the simulator backend"
|
||||||
( cd "$folio_directory" && just ios >/dev/null )
|
( cd "$folio_directory" && just ios >/dev/null )
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in new issue
Block a user