#!/bin/bash

set -eo pipefail
set -x
: ${MAX_JOBS:=$(nproc)}
: ${CUDA_VISIBLE_DEVICES:=0}
: ${SKIP_INSTALL:=0}

# Source test environment setup (handles package overrides like TVM-FFI)
source "$(dirname "${BASH_SOURCE[0]}")/setup_test_env.sh"

if [ "$SKIP_INSTALL" = "0" ]; then
  pip install -e . -v
fi

# Run each test file separately to isolate CUDA memory issues
# moe_ep unit subset: host-only + single-GPU (multirank/mega auto-skip via
# markers; see tests/moe_ep/run_tests.sh and docs/design_docs/moe_ep_runbook.md)
bash tests/moe_ep/run_tests.sh unit
pytest -s tests/attention/test_logits_cap.py
pytest -s tests/attention/test_sliding_window.py
pytest -s tests/attention/test_tensor_cores_decode.py
pytest -s tests/attention/test_batch_decode_kernels.py
# pytest -s tests/gemm/test_group_gemm.py
# pytest -s tests/attention/test_alibi.py
