SPB Git

Repository Public MIT

test-all.sh 2.5 KB 48 lines shellscript

1#!/usr/bin/env bash2# ORIX Calc3# File: Scripts/test-all.sh4# Description: Runs every test suite: engine packages with `swift test` on macOS, feature packages and the app (unit + UI) on the dedicated simulator.5#              Writes a summary to build/test-summary.txt. usage: test-all.sh [engines|features|app|all]6#7# Author: Simon-Pierre Boucher8# Contact: contact@spboucher.ai9set -uo pipefail10cd "$(dirname "$0")/.."11what="${1:-all}"12SIM="platform=iOS Simulator,name=ORIXCalc iPhone"13mkdir -p build/logs14summary="build/test-summary.txt"15[[ "$what" == all ]] && : > "$summary"16fail=017record() { echo "$1" | tee -a "$summary"; }1819if [[ "$what" == engines || "$what" == all ]]; then20  for p in ORIXNumerics ORIXExpression ORIXWorkspace ORIXFinancial ORIXStatistics ORIXUnits ORIXSymbolic ORIXGraph ORIXMathCamera; do21    [[ -f "Packages/$p/Package.swift" ]] || continue22    (cd "Packages/$p" && swift test > "../../build/logs/test-$p.log" 2>&1)23    line=$(sed 's/\x1b\[[0-9;]*m//g' "build/logs/test-$p.log" | grep -E "Test run with" | tail -1)24    [[ "$line" == *passed* ]] || fail=125    record "$p (macOS, swift test): ${line:-NO RESULT}"26  done27fi28if [[ "$what" == features || "$what" == all ]]; then29  for p in ORIXFeatureCalculator ORIXFeatureFinancial ORIXFeatureConvert ORIXFeatureGraph ORIXFeatureMath ORIXFeatureStatistics ORIXFeatureWorkspace; do30    [[ -f "Packages/$p/Package.swift" ]] || continue31    (cd "Packages/$p" && xcodebuild test -scheme "$p" -destination "$SIM" -derivedDataPath .build/xc > "../../build/logs/test-$p.log" 2>&1)32    line=$(sed 's/\x1b\[[0-9;]*m//g' "build/logs/test-$p.log" | grep -E "Test run with" | tail -1)33    grep -q "TEST SUCCEEDED" "build/logs/test-$p.log" || fail=134    record "$p (iOS simulator): ${line:-NO RESULT}"35  done36fi37if [[ "$what" == app || "$what" == all ]]; then38  Scripts/generate.sh > /dev/null39  xcodebuild test -project ORIXCalc.xcodeproj -scheme ORIXCalc -destination "$SIM" -derivedDataPath build/DerivedData > build/logs/test-app.log 2>&140  unit=$(sed 's/\x1b\[[0-9;]*m//g' build/logs/test-app.log | grep -E "Test run with" | tail -1)41  ui=$(grep -E "Executed [0-9]+ tests" build/logs/test-app.log | tail -1 | sed 's/^[[:space:]]*//')42  grep -q "TEST SUCCEEDED" build/logs/test-app.log || fail=143  record "ORIXCalc app unit tests (iOS simulator): ${unit:-NO RESULT}"44  record "ORIXCalc UI tests (XCUITest): ${ui:-NO RESULT}"45fi46[[ $fail == 0 ]] && record "RESULT: all suites passed" || record "RESULT: FAILURES — see build/logs"47exit $fail48
Files main
Menu

Theme