From 6cf048cfeea5a6c3d24422f50ac0df8d0505b662 Mon Sep 17 00:00:00 2001 From: Waozi Date: Sat, 24 Oct 2026 15:50:01 -0300 Subject: [PATCH] Fix stale sync test baselines and missing test targets --- mk/tests-android.mk | 9 +++++++++ mk/tests-ui.mk | 5 +++++ tests/shared_progress_ui_test.sh | 11 +++++++++++ tests/sync_record_fields.txt | 2 +- tests/sync_restore_sql_test.py | 11 ++++++++++- 5 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 tests/shared_progress_ui_test.sh diff --git a/mk/tests-android.mk b/mk/tests-android.mk index b257cc488..c6657ef3a 100644 --- a/mk/tests-android.mk +++ b/mk/tests-android.mk @@ -27,6 +27,15 @@ android-text-selection-test: env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS \ $(GRADLE) --no-daemon --project-dir tests/android-text-selection test +# Manual USB Moto test; the helper accepts only the separate verification APK +# and restores the existing verification profile after its reader cases. +.PHONY: android-library-device-test +android-library-device-test: + @test -n "$(APK)" || { echo "Set APK to the Android verification APK"; exit 2; } + $(MAKE) $(BUILD_DIR)/node-apps/library.zx + python3 tests/android_library_device.py run --apk "$(abspath $(APK))" \ + --bundle "$(abspath $(BUILD_DIR)/node-apps/library.zx)" + .PHONY: android-jni-zi-test android-jni-zi-test: $(ZI2C_BIN) @python3 tests/android_jni_zi_test.py $(abspath $(dir $(ZI2C_BIN))) diff --git a/mk/tests-ui.mk b/mk/tests-ui.mk index 34c68d2ae..0a701e56a 100644 --- a/mk/tests-ui.mk +++ b/mk/tests-ui.mk @@ -218,6 +218,11 @@ arcade-ui-test: $(TARGET) @test -n "$(ARCADE_BUNDLE)" || { echo "Set ARCADE_BUNDLE to the arcade.zx collection built by Arcade"; exit 2; } @sh tests/arcade_ui_test.sh $(abspath $(TARGET)) $(abspath $(ARCADE_BUNDLE)) +.PHONY: shared-progress-ui-test +shared-progress-ui-test: $(TARGET) + @test -n "$(ARCADE_BUNDLE)" || { echo "Set ARCADE_BUNDLE to the arcade.zx collection built by Arcade"; exit 2; } + @sh tests/shared_progress_ui_test.sh $(abspath $(TARGET)) $(abspath $(ARCADE_BUNDLE)) + # Missing practice pictures fail the visual gate in CI and releases. .PHONY: practice-images-ui-test practice-images-ui-test: $(TARGET) diff --git a/tests/shared_progress_ui_test.sh b/tests/shared_progress_ui_test.sh new file mode 100644 index 000000000..28460d54c --- /dev/null +++ b/tests/shared_progress_ui_test.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# The supplied Arcade package runs in a disposable profile on a private display. +set -eu +root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) +binary=${1:?Pass the Breeze binary} +package=${2:?Pass an Arcade package, arcade.zx} +env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS \ + -u GDK_DISPLAY -u SESSION_MANAGER YUE_DESKTOP_RECOVERY=0 \ + SDL_VIDEODRIVER=x11 LIBGL_ALWAYS_SOFTWARE=1 SDL_AUDIODRIVER=dummy APP_NO_TRAY=1 \ + timeout 240s xvfb-run -a -n 400 -s '-noreset -screen 0 1280x900x24' \ + python3 "$root/tests/shared_progress_ui_test.py" "$binary" "$package" diff --git a/tests/sync_record_fields.txt b/tests/sync_record_fields.txt index 93c3cf3a2..a26f184d5 100644 --- a/tests/sync_record_fields.txt +++ b/tests/sync_record_fields.txt @@ -1,4 +1,4 @@ -version 7 +version 8 active activity after diff --git a/tests/sync_restore_sql_test.py b/tests/sync_restore_sql_test.py index 28a9a6323..5abb37b46 100644 --- a/tests/sync_restore_sql_test.py +++ b/tests/sync_restore_sql_test.py @@ -41,7 +41,7 @@ def restore_statements(): assert enqueue, "storage_enqueue_all_sync_state" inserts = re.findall(r'exec_sql\("(INSERT INTO sync_outbox[^"]*)"\)', enqueue.group(1)) - assert len(inserts) == 18, inserts + assert len(inserts) == 19, inserts return clear + inserts @@ -72,6 +72,7 @@ ENTITIES = [ # queued all or none, alternating over the cases above, so the exhaustive # check stays small. NESTED = "nested." + "ab" * 32 + ".position" +GAME_PROGRESS = "entity.game-progress." + "ab" * 16 EXTRA = [ ("app_record", NESTED, 0), ("app_install", "app_used_chess", 0), @@ -81,6 +82,7 @@ EXTRA = [ ("habit_reward", "r1", 0), ("habit_coin", "k1", 0), ("habit_setting", "habit_shop_borrow_limit", 0), + ("entity_record", GAME_PROGRESS, 0), ("entity_record", "entity.photos." + "ab" * 32, 0), ] @@ -122,12 +124,19 @@ def open_database(): for key in ("nested." + "ag" * 32 + ".position", "nested." + "ab" * 32 + ".", "nested." + "ab" * 32 + ".Big", "app_used_achievement"): insert_row(database, "settings", {"user_id": "u1", "key": key, "value": "1", "updated_at": 2}) + # Game progress uses a 32-hex entity ID and valid JSON in this account. + insert_row(database, "settings", {"user_id": "u1", "key": GAME_PROGRESS, "value": "{}", "updated_at": 2}) + for key, value in (("entity.game-progress." + "ag" * 16, "{}"), + ("entity.game-progress." + "ab" * 15, "{}"), + ("entity.game-progress." + "cd" * 16, "not json")): + insert_row(database, "settings", {"user_id": "u1", "key": key, "value": value, "updated_at": 2}) # A photo kept once in the account's entity data, by its 64-hex digest; # other names and unreadable values are never queued. insert_row(database, "settings", {"user_id": "u1", "key": "entity.photos." + "ab" * 32, "value": "{}", "updated_at": 2}) insert_row(database, "settings", {"user_id": "u1", "key": "entity.photos." + "ag" * 32, "value": "{}", "updated_at": 2}) insert_row(database, "settings", {"user_id": "u1", "key": "entity.photos." + "cd" * 32, "value": "not json", "updated_at": 2}) insert_row(database, "users", {"id": "u2"}) + insert_row(database, "settings", {"user_id": "u2", "key": "entity.game-progress." + "ef" * 16, "value": "{}", "updated_at": 2}) insert_row(database, "settings", {"user_id": "u2", "key": "entity.photos." + "ef" * 32, "value": "{}", "updated_at": 2}) insert_row(database, "settings", {"user_id": "u2", "key": "habit_shop_borrow_limit", "value": "999", "updated_at": 2}) insert_row(database, "settings", {"user_id": "u2", "key": "nested." + "cd" * 32 + ".position", "value": "foreign", "updated_at": 2})