#!/bin/bash
# Copyright 2026 California Institute of Technology
#
# You should have received a copy of the licensing terms for this
# software included in the file “LICENSE” located in the top-level
# directory of this package. If you did not, you can view a copy at
# http://dcc.ligo.org/M1500244/LICENSE.txt

# Run the end-to-end test IOC (pcaspy) by hand, bound to loopback only:
#
#   ./run_test_ioc.sh [port]          (default port 5064)
#
# then in another terminal, from the term_scope crate directory:
#
#   EPICS_CA_ADDR_LIST=127.0.0.1 EPICS_CA_AUTO_ADDR_LIST=NO \
#   EPICS_CA_SERVER_PORT=<port> cargo run -- tests/data/channels.txt
#
# The IOC exits on Ctrl+D/Ctrl+C or a "quit" line on stdin.
#
# The automated version of this is tests/e2e_ioc.rs, run with:
#   cargo test -p term_scope -- --ignored
set -eu
cd "$(dirname "$0")"
export EPICS_CAS_SERVER_PORT="${1:-5064}"
export EPICS_CAS_INTF_ADDR_LIST=127.0.0.1
exec python3 data/test_ioc.py
