diff options
Diffstat (limited to 'scripts/test_mac/service-test.sh')
| -rwxr-xr-x | scripts/test_mac/service-test.sh | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/scripts/test_mac/service-test.sh b/scripts/test_mac/service-test.sh index da4a966e7..8360e60fa 100755 --- a/scripts/test_mac/service-test.sh +++ b/scripts/test_mac/service-test.sh @@ -22,6 +22,8 @@ SERVICE_NAME="ZenServerTest-$$" DAEMON_NAME="com.epicgames.unreal.${SERVICE_NAME}" PLIST_FILE="$HOME/Library/LaunchAgents/${DAEMON_NAME}.plist" +zen_cmd() { "$ZEN_BINARY" --enable-execution-history=false "$@"; } + PASSED=0 FAILED=0 TESTS_RUN=0 @@ -119,7 +121,7 @@ echo "" echo "--- Test: status before install ---" -OUTPUT=$("$ZEN_BINARY" service status "$SERVICE_NAME" 2>&1 || true) +OUTPUT=$(zen_cmd service status "$SERVICE_NAME" 2>&1 || true) if echo "$OUTPUT" | grep -qi "not installed"; then pass "status reports 'not installed' for non-existent service" else @@ -130,7 +132,7 @@ fi echo "--- Test: install ---" -OUTPUT=$("$ZEN_BINARY" service install "$ZENSERVER_BINARY" "$SERVICE_NAME" 2>&1) +OUTPUT=$(zen_cmd service install "$ZENSERVER_BINARY" "$SERVICE_NAME" 2>&1) EXIT_CODE=$? if [ "$EXIT_CODE" -eq 0 ]; then @@ -176,7 +178,7 @@ fi echo "--- Test: install again (idempotent) ---" -OUTPUT=$("$ZEN_BINARY" service install "$ZENSERVER_BINARY" "$SERVICE_NAME" 2>&1) +OUTPUT=$(zen_cmd service install "$ZENSERVER_BINARY" "$SERVICE_NAME" 2>&1) EXIT_CODE=$? if [ "$EXIT_CODE" -eq 0 ]; then @@ -195,7 +197,7 @@ fi echo "--- Test: status after install (stopped) ---" -OUTPUT=$("$ZEN_BINARY" service status "$SERVICE_NAME" 2>&1 || true) +OUTPUT=$(zen_cmd service status "$SERVICE_NAME" 2>&1 || true) if echo "$OUTPUT" | grep -qi "not running"; then pass "status reports 'not running' for stopped service" else @@ -206,7 +208,7 @@ fi echo "--- Test: start ---" -OUTPUT=$("$ZEN_BINARY" service start "$SERVICE_NAME" 2>&1) +OUTPUT=$(zen_cmd service start "$SERVICE_NAME" 2>&1) EXIT_CODE=$? if [ "$EXIT_CODE" -eq 0 ]; then @@ -225,7 +227,7 @@ if launchctl list "$DAEMON_NAME" &>/dev/null; then echo "--- Test: status (running) ---" - OUTPUT=$("$ZEN_BINARY" service status "$SERVICE_NAME" 2>&1 || true) + OUTPUT=$(zen_cmd service status "$SERVICE_NAME" 2>&1 || true) if echo "$OUTPUT" | grep -qi "Running"; then pass "status reports 'Running'" else @@ -242,7 +244,7 @@ if launchctl list "$DAEMON_NAME" &>/dev/null; then echo "--- Test: start again (already running) ---" - OUTPUT=$("$ZEN_BINARY" service start "$SERVICE_NAME" 2>&1) + OUTPUT=$(zen_cmd service start "$SERVICE_NAME" 2>&1) if echo "$OUTPUT" | grep -qi "already running"; then pass "start reports service already running" else @@ -253,7 +255,7 @@ if launchctl list "$DAEMON_NAME" &>/dev/null; then echo "--- Test: stop ---" - OUTPUT=$("$ZEN_BINARY" service stop "$SERVICE_NAME" 2>&1) + OUTPUT=$(zen_cmd service stop "$SERVICE_NAME" 2>&1) EXIT_CODE=$? if [ "$EXIT_CODE" -eq 0 ]; then @@ -281,7 +283,7 @@ echo "--- Test: stop when already stopped ---" launchctl bootout "gui/$(id -u)" "$PLIST_FILE" 2>/dev/null || true sleep 1 -OUTPUT=$("$ZEN_BINARY" service stop "$SERVICE_NAME" 2>&1 || true) +OUTPUT=$(zen_cmd service stop "$SERVICE_NAME" 2>&1 || true) if echo "$OUTPUT" | grep -qi "not running"; then pass "stop reports 'not running' when already stopped" else @@ -293,11 +295,11 @@ fi echo "--- Test: uninstall while running (should fail) ---" # Start the service so we can test uninstall-while-running -"$ZEN_BINARY" service start "$SERVICE_NAME" 2>&1 || true +zen_cmd service start "$SERVICE_NAME" 2>&1 || true sleep 2 if launchctl list "$DAEMON_NAME" &>/dev/null; then - OUTPUT=$("$ZEN_BINARY" service uninstall "$SERVICE_NAME" 2>&1 || true) + OUTPUT=$(zen_cmd service uninstall "$SERVICE_NAME" 2>&1 || true) EXIT_CODE=$? if [ "$EXIT_CODE" -ne 0 ] || echo "$OUTPUT" | grep -qi "running.*stop"; then @@ -307,7 +309,7 @@ if launchctl list "$DAEMON_NAME" &>/dev/null; then fi # Stop it for the real uninstall test - "$ZEN_BINARY" service stop "$SERVICE_NAME" 2>&1 || true + zen_cmd service stop "$SERVICE_NAME" 2>&1 || true launchctl bootout "gui/$(id -u)" "$PLIST_FILE" 2>/dev/null || true sleep 1 else @@ -322,7 +324,7 @@ echo "--- Test: uninstall ---" launchctl bootout "gui/$(id -u)" "$PLIST_FILE" 2>/dev/null || true sleep 1 -OUTPUT=$("$ZEN_BINARY" service uninstall "$SERVICE_NAME" 2>&1) +OUTPUT=$(zen_cmd service uninstall "$SERVICE_NAME" 2>&1) EXIT_CODE=$? if [ "$EXIT_CODE" -eq 0 ]; then @@ -341,7 +343,7 @@ fi echo "--- Test: status after uninstall ---" -OUTPUT=$("$ZEN_BINARY" service status "$SERVICE_NAME" 2>&1 || true) +OUTPUT=$(zen_cmd service status "$SERVICE_NAME" 2>&1 || true) if echo "$OUTPUT" | grep -qi "not installed"; then pass "status reports 'not installed' after uninstall" else @@ -352,7 +354,7 @@ fi echo "--- Test: uninstall when not installed ---" -OUTPUT=$("$ZEN_BINARY" service uninstall "$SERVICE_NAME" 2>&1) +OUTPUT=$(zen_cmd service uninstall "$SERVICE_NAME" 2>&1) EXIT_CODE=$? if [ "$EXIT_CODE" -eq 0 ]; then |