test suite
This commit is contained in:
34
tests/run_tests.sh
Executable file
34
tests/run_tests.sh
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
# Run the gammaray-mcp test suite.
|
||||
# Usage:
|
||||
# ./run_tests.sh # probe-required tests (default)
|
||||
# ./run_tests.sh --no-probe # only unit tests (no probe needed)
|
||||
# ./run_tests.sh -v # verbose
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
|
||||
# Ensure the bridge is built
|
||||
if [ ! -f "$PROJECT_ROOT/bridge/build/qml-sg-mcp-bridge" ]; then
|
||||
echo "Building bridge first..."
|
||||
cmake -S "$PROJECT_ROOT/bridge" -B "$PROJECT_ROOT/bridge/build" -G Ninja \
|
||||
-DCMAKE_PREFIX_PATH="$PROJECT_ROOT/install-prefix"
|
||||
cmake --build "$PROJECT_ROOT/bridge/build"
|
||||
fi
|
||||
|
||||
# Use the same env as run.sh
|
||||
export LD_LIBRARY_PATH="$PROJECT_ROOT/install-prefix/lib"
|
||||
export QT_QPA_PLATFORM=offscreen
|
||||
export QT_PLUGIN_PATH="$PROJECT_ROOT/bridge/build/lib/x86_64-linux-gnu/qt6/plugins"
|
||||
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
# Install test dependencies if needed
|
||||
python3 -c "import pytest" 2>/dev/null || {
|
||||
echo "pytest not found. Installing..."
|
||||
pip3 install pytest --user
|
||||
}
|
||||
|
||||
exec python3 -m pytest "$@" .
|
||||
Reference in New Issue
Block a user