Clear the app before every on-device run, as !122 said it did #151

Merged
paulhitt merged 1 commits from fix/instrumented-script-reaches-main into main 2026-09-11 16:21:46 +00:00
+30 -6
View File
@@ -66,14 +66,38 @@ if ! "$ADB" shell getprop sys.boot_completed 2>/dev/null | grep -q 1; then
-no-snapshot-load -no-snapshot-save -no-boot-anim \
-netdelay none -netspeed full >/tmp/fnmsg-emu.log 2>&1 &
until "$ADB" shell getprop sys.boot_completed 2>/dev/null | grep -q 1; do sleep 5; done
else
echo "### emulator already up, clearing the app rather than trusting it"
"$ADB" uninstall io.flamenet.messenger >/dev/null 2>&1 || true
"$ADB" uninstall io.flamenet.messenger.test >/dev/null 2>&1 || true
fi
echo "### signed-in account on the device before we start:"
"$ADB" shell pm list packages 2>/dev/null | grep -i flamenet || echo " (nothing installed, good)"
# Unconditionally, on BOTH paths. This uninstall used to live only in the
# "emulator already up" branch, on the reasoning that a cold boot starts clean.
# A cold boot starts with no SNAPSHOT; the disk image keeps whatever was
# installed on it. So an AVD that had been used to test a RELEASE build kept
# that build, and the debug APK could not install over it:
#
# INSTALL_FAILED_UPDATE_INCOMPATIBLE: Existing package
# io.flamenet.messenger signatures do not match newer version
#
# Release and debug are signed by different keys, which is the whole point of
# them, so this is not a rare collision: it happens every time somebody uses
# this AVD to try a real build, which is what an AVD is for.
#
# The line below already PRINTED the leftover package, and the run continued
# anyway. A check whose output nobody acts on is decoration.
"$ADB" uninstall io.flamenet.messenger >/dev/null 2>&1 || true
"$ADB" uninstall io.flamenet.messenger.test >/dev/null 2>&1 || true
echo "### installed packages after clearing:"
LEFTOVER=$("$ADB" shell pm list packages 2>/dev/null | grep -i flamenet || true)
if [ -n "$LEFTOVER" ]; then
echo "$LEFTOVER"
echo "REFUSED: could not remove the existing install above." >&2
echo "It will make the test APK fail to install, and the run would report" >&2
echo "zero tests as though nothing were wrong. Remove it by hand:" >&2
echo " $ADB uninstall io.flamenet.messenger" >&2
exit 1
else
echo " (nothing installed, good)"
fi
echo "### relay $RELAY · classes $CLASSES"
set +e