Files
ai_studio/Tests/test.sh
T
Mark Gregory 2238df4631 Build AI Studio for macOS
Add branded startup, Ollama and MLX inference, persistent chat and document retrieval, confirmed MCP tools, and reproducible build and test scripts.
2026-11-16 13:14:00 +00:00

32 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
set -euo pipefail
cd "$(dirname "$0")/.."
base="${AISTUDIO_BUILD_ROOT:-/private/tmp/AIStudio-build-$(id -u)}"
mkdir -p "$base"
results="$(mktemp -d "$base/test.XXXXXXXX")"
if [[ -z "${TEST_RUNNER_AISTUDIO_TEST_MCP_URLS:-}" || -z "${TEST_RUNNER_AISTUDIO_TEST_OLLAMA_FIXTURE_URL:-}" ]]; then
python3 -u Tests/Fixtures/server.py >"$results/fixture.log" 2>&1 &
fixture_pid=$!
trap 'kill "$fixture_pid" 2>/dev/null || true' EXIT
port=""
for attempt in {1..50}; do
port="$(head -n 1 "$results/fixture.log")"
[[ "$port" =~ ^[0-9]+$ ]] && break
kill -0 "$fixture_pid" 2>/dev/null || break
sleep 0.1
done
if [[ ! "$port" =~ ^[0-9]+$ ]]; then
cat "$results/fixture.log" >&2
echo "Could not start the local test fixture." >&2
exit 1
fi
fixture="http://127.0.0.1:$port"
export TEST_RUNNER_AISTUDIO_TEST_MCP_URLS="${TEST_RUNNER_AISTUDIO_TEST_MCP_URLS:-$fixture/modern,$fixture/legacy}"
export TEST_RUNNER_AISTUDIO_TEST_OLLAMA_FIXTURE_URL="${TEST_RUNNER_AISTUDIO_TEST_OLLAMA_FIXTURE_URL:-$fixture/ollama}"
fi
xcodebuild CODE_SIGN_IDENTITY=- CODE_SIGN_STYLE=Manual DEVELOPMENT_TEAM= -project AIStudio.xcodeproj -scheme AIStudio -configuration Debug \
-destination 'platform=macOS,arch=arm64' -derivedDataPath "$base/Derived" \
-clonedSourcePackagesDirPath "$base/Packages" -disablePackageRepositoryCache \
-parallel-testing-enabled NO -resultBundlePath "$results/AIStudio.xcresult" test