diff --git a/mk/tests-ui.mk b/mk/tests-ui.mk index 169852540..b5e9601c8 100644 --- a/mk/tests-ui.mk +++ b/mk/tests-ui.mk @@ -228,6 +228,14 @@ chess-ui-test: $(TARGET) @test -n "$(CHESS_BUNDLE)" || { echo "Set CHESS_BUNDLE to the Chess package built by Arcade"; exit 2; } @sh tests/chess_ui_test.sh $(abspath $(TARGET)) $(abspath $(CHESS_BUNDLE)) +# One game a collection downloads separately: refused when corrupt, then +# reopened from the offline cache. Needs Shovey's checkout beside this one. +.PHONY: node-child-download-ui-test +NODE_CHILD_CATALOG ?= +node-child-download-ui-test: $(TARGET) + @test -n "$(NODE_CHILD_CATALOG)" || { echo "Set NODE_CHILD_CATALOG to an arcade.zx with its arcade.games beside it"; exit 2; } + @python3 tests/node_child_download_ui_test.py $(abspath $(TARGET)) $(abspath $(NODE_CHILD_CATALOG)) + # Arcade carries Chess: its collection in More apps, and Chess's replacement. .PHONY: arcade-ui-test ARCADE_BUNDLE ?= diff --git a/tests/arcade_ui_test.py b/tests/arcade_ui_test.py index 7a99825bb..12c916fe9 100644 --- a/tests/arcade_ui_test.py +++ b/tests/arcade_ui_test.py @@ -36,6 +36,14 @@ parser.add_argument("--offline", action="store_true", help="the node cannot be r parser.add_argument("--downloads-only", action="store_true", help="Check the rounded library, add-on downloads and offline games") args = parser.parse_args() +if args.offline: + # A new network namespace starts with loopback down; the download check + # serves its games on it. + import fcntl, socket, struct + try: + fcntl.ioctl(socket.socket(), 0x8914, struct.pack("16sH14s", b"lo", 0x49, b"")) + except OSError: + pass BINARY = args.binary.resolve(strict=True) PACKAGE = args.package.resolve(strict=True) assert PACKAGE.name == "arcade.zx", "INBE_NODE_APP_FILE names the app by its file: arcade.zx" diff --git a/tests/arcade_ui_test.sh b/tests/arcade_ui_test.sh index c737bddc7..c65b75ba1 100644 --- a/tests/arcade_ui_test.sh +++ b/tests/arcade_ui_test.sh @@ -2,7 +2,7 @@ # Arcade on a private Xvfb display with disposable profiles: no inherited # desktop, session bus or desktop recovery reaches the app. Where user # namespaces allow it, the test also runs without a network, so the node is -# never contacted; its own loopback still serves local game downloads. +# never contacted; the test brings up its loopback for local game downloads. # Further options pass to arcade_ui_test.py. set -eu root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) @@ -12,7 +12,7 @@ shift 2 isolate= offline= if unshare -rn true 2>/dev/null; then - isolate="unshare -rn sh -c 'ip link set lo up 2>/dev/null; exec \"\$@\"' sh" + isolate="unshare -rn" offline=--offline fi eval "env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS -u GDK_DISPLAY \