Files
git.stella-ops.org/scripts/reachability/run_all.sh
StellaOps Bot 233873f620
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
Signals CI & Image / signals-ci (push) Has been cancelled
Signals Reachability Scoring & Events / reachability-smoke (push) Has been cancelled
Signals Reachability Scoring & Events / sign-and-upload (push) Has been cancelled
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
Reachability Corpus Validation / validate-corpus (push) Has been cancelled
Reachability Corpus Validation / validate-ground-truths (push) Has been cancelled
Scanner Analyzers / Discover Analyzers (push) Has been cancelled
Scanner Analyzers / Validate Test Fixtures (push) Has been cancelled
Reachability Corpus Validation / determinism-check (push) Has been cancelled
Scanner Analyzers / Build Analyzers (push) Has been cancelled
Scanner Analyzers / Test Language Analyzers (push) Has been cancelled
Scanner Analyzers / Verify Deterministic Output (push) Has been cancelled
Notify Smoke Test / Notify Unit Tests (push) Has been cancelled
Notify Smoke Test / Notifier Service Tests (push) Has been cancelled
Notify Smoke Test / Notification Smoke Test (push) Has been cancelled
Policy Lint & Smoke / policy-lint (push) Has been cancelled
up
2025-12-14 15:50:38 +02:00

119 lines
3.4 KiB
Bash

#!/usr/bin/env bash
# SPDX-License-Identifier: AGPL-3.0-or-later
# QA-CORPUS-401-031: Deterministic runner for reachability corpus tests
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
TEST_PROJECT="${REPO_ROOT}/tests/reachability/StellaOps.Reachability.FixtureTests/StellaOps.Reachability.FixtureTests.csproj"
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
log_info() { echo -e "${GREEN}[INFO]${NC} $*"; }
log_warn() { echo -e "${YELLOW}[WARN]${NC} $*"; }
log_error() { echo -e "${RED}[ERROR]${NC} $*"; }
# Parse arguments
FILTER=""
VERBOSITY="normal"
CONFIGURATION="Release"
NO_BUILD=false
while [[ $# -gt 0 ]]; do
case $1 in
--filter)
FILTER="$2"
shift 2
;;
--verbosity|-v)
VERBOSITY="$2"
shift 2
;;
--configuration|-c)
CONFIGURATION="$2"
shift 2
;;
--no-build)
NO_BUILD=true
shift
;;
--help|-h)
echo "Usage: $0 [options]"
echo ""
echo "Options:"
echo " --filter <pattern> xUnit filter pattern (e.g., 'CorpusFixtureTests')"
echo " --verbosity, -v <level> Test verbosity (quiet, minimal, normal, detailed, diagnostic)"
echo " --configuration, -c Build configuration (Debug, Release)"
echo " --no-build Skip build step"
echo " --help, -h Show this help"
echo ""
echo "Examples:"
echo " $0 # Run all fixture tests"
echo " $0 --filter CorpusFixtureTests # Run only corpus tests"
echo " $0 --filter ReachbenchFixtureTests # Run only reachbench tests"
exit 0
;;
*)
log_error "Unknown option: $1"
exit 1
;;
esac
done
cd "${REPO_ROOT}"
log_info "Reachability Corpus Test Runner"
log_info "Repository root: ${REPO_ROOT}"
log_info "Test project: ${TEST_PROJECT}"
# Verify prerequisites
if ! command -v dotnet &> /dev/null; then
log_error "dotnet CLI not found. Please install .NET SDK."
exit 1
fi
# Verify corpus exists
if [[ ! -f "${REPO_ROOT}/tests/reachability/corpus/manifest.json" ]]; then
log_error "Corpus manifest not found at tests/reachability/corpus/manifest.json"
exit 1
fi
if [[ ! -f "${REPO_ROOT}/tests/reachability/fixtures/reachbench-2025-expanded/INDEX.json" ]]; then
log_error "Reachbench INDEX not found at tests/reachability/fixtures/reachbench-2025-expanded/INDEX.json"
exit 1
fi
# Build if needed
if [[ "${NO_BUILD}" == false ]]; then
log_info "Building test project (${CONFIGURATION})..."
dotnet build "${TEST_PROJECT}" -c "${CONFIGURATION}" --nologo
fi
# Build test command
TEST_CMD="dotnet test ${TEST_PROJECT} -c ${CONFIGURATION} --no-build --verbosity ${VERBOSITY}"
if [[ -n "${FILTER}" ]]; then
TEST_CMD="${TEST_CMD} --filter \"FullyQualifiedName~${FILTER}\""
log_info "Running tests with filter: ${FILTER}"
else
log_info "Running all fixture tests..."
fi
# Run tests
log_info "Executing: ${TEST_CMD}"
eval "${TEST_CMD}"
EXIT_CODE=$?
if [[ ${EXIT_CODE} -eq 0 ]]; then
log_info "All tests passed!"
else
log_error "Some tests failed (exit code: ${EXIT_CODE})"
fi
exit ${EXIT_CODE}