SPB Git

Repository Public

test.sh 1.0 KB 22 lines shellscript

1#!/usr/bin/env bash2# Runs both test suites: core unit tests (SwiftPM) and in-app integration tests (xcodebuild).3# Usage: scripts/test.sh [core|app|all]4set -uo pipefail5cd "$(dirname "$0")/.."6WHAT="${1:-all}"7STATUS=08if [[ "$WHAT" == "core" || "$WHAT" == "all" ]]; then9  echo "== swift test (core) =="10  swift test 2>&1 | grep -E "error:|failed|Executed [0-9]+ tests" | tail -1511  [[ "${PIPESTATUS[0]}" -eq 0 ]] || STATUS=112fi13if [[ "$WHAT" == "app" || "$WHAT" == "all" ]]; then14  echo "== xcodebuild test (app integration) =="15  command -v xcodegen >/dev/null && xcodegen generate --quiet16  xcodebuild -project SPBrowser.xcodeproj -scheme SPBrowser -configuration Debug -derivedDataPath build/DerivedData \17    -destination 'platform=macOS,arch=arm64' -resultBundlePath "build/TestResults-$(date +%s).xcresult" test 2>&1 \18    | grep -E "^/.*error:|Test Case .*(failed)|error: -\[|Executed [0-9]+ tests|TEST (SUCCEEDED|FAILED)|Testing failed" | sed "s|$PWD/||" | tail -4019  [[ "${PIPESTATUS[0]}" -eq 0 ]] || STATUS=120fi21exit $STATUS22
Files main
Menu

Theme