Repository Public
1#!/usr/bin/env bash2# Author: Simon-Pierre Boucher — contact@spboucher.ai3# File: Scripts/t.sh4# Description: Runs the app's unit tests (Swift Testing, hosted in the development variant). The test build is signed ad hoc without the hardened runtime: an injected test bundle is refused by a hardened Developer ID host.5#6# Usage: Scripts/t.sh [derived-data-suffix]7set -uo pipefail8cd "$(dirname "$0")/.."9SUF="${1:-test}"; DD="$HOME/Library/Developer/SPWallet/DerivedData-$SUF"; mkdir -p Build10until mkdir Build/.gen.lock 2>/dev/null; do sleep 0.3; done; xcodegen generate --quiet; rmdir Build/.gen.lock11cat > Build/test-adhoc.entitlements <<'ENT'12<?xml version="1.0" encoding="UTF-8"?>13<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">14<plist version="1.0"><dict/></plist>15ENT16xcodebuild -project SPWallet.xcodeproj -scheme SPWallet -configuration Debug -derivedDataPath "$DD" test \17 CODE_SIGN_IDENTITY=- CODE_SIGN_STYLE=Manual PROVISIONING_PROFILE_SPECIFIER= ENABLE_HARDENED_RUNTIME=NO CODE_SIGN_ENTITLEMENTS="$PWD/Build/test-adhoc.entitlements" OTHER_CODE_SIGN_FLAGS= \18 2>&1 | sed 's/\x1b\[[0-9;]*m//g' > Build/test.log19grep -E "error:|✘|Test run with|recorded an issue|\*\* TEST" Build/test.log | sed -E "s#$PWD/##" | sort -u | cut -c1-300 | head -4020grep -q "TEST SUCCEEDED" Build/test.log21