#!/usr/bin/env bash set -Eeuo pipefail repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" env_file="${1:-${repo_root}/compose/.env}" run_id="${2:-$(date +%Y%m%d-%H%M%S)}" output_root="${repo_root}/results/raw/${run_id}" if [[ ! -f "$env_file" ]]; then echo "Environment file not found: $env_file" >&2 exit 1 fi mkdir -p "$output_root" bash "${repo_root}/scripts/verify-tripo-mock.sh" "$env_file" sampler_stop="${output_root}/.resource-sampler-stop" rm -f "$sampler_stop" bash "${repo_root}/scripts/sample-benchmark-resources.sh" "$sampler_stop" \ > "${output_root}/resources-during-user-e2e.csv" & sampler_pid=$! stop_sampler() { touch "$sampler_stop" wait "$sampler_pid" 2>/dev/null || true rm -f "$sampler_stop" } trap stop_sampler EXIT bash "${repo_root}/scripts/capture-benchmark-snapshot.sh" "$env_file" \ > "${output_root}/user-e2e-snapshot-before.txt" set +e python3 "${repo_root}/benchmark/run-user-e2e-smoke.py" \ --base-url http://127.0.0.1:3001 \ --output "${output_root}/user-e2e-smoke.json" smoke_status=$? set -e bash "${repo_root}/scripts/capture-benchmark-snapshot.sh" "$env_file" \ > "${output_root}/user-e2e-snapshot-after.txt" stop_sampler trap - EXIT if [[ "$smoke_status" -ne 0 ]]; then echo "User E2E smoke failed; inspect: ${output_root}/user-e2e-smoke.json" >&2 exit "$smoke_status" fi echo "User E2E smoke completed: ${output_root}/user-e2e-smoke.json"