mirror of
https://github.com/kuhyx/WUT_Computer_Science.git
synced 2026-11-10 18:47:11 +01:00
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
33 lines
1.2 KiB
Bash
Executable File
33 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# ============================================================================
|
|
# Run only the pytest suites whose directory has changes vs HEAD (staged,
|
|
# unstaged and untracked). Quiet: failures plus a one-line summary per suite.
|
|
# Changes to shared config (pyproject.toml, this repo's test scripts) run all
|
|
# suites; changes outside any suite run nothing.
|
|
# ============================================================================
|
|
|
|
set -euo pipefail
|
|
|
|
ROOT="$(git rev-parse --show-toplevel)"
|
|
readonly ROOT
|
|
readonly SUITES=(Programming/ECOTE Programming/ECRYPT_PROJECT/sieve)
|
|
|
|
changed="$(cd "$ROOT" && { git diff --name-only HEAD 2>/dev/null || true; git ls-files --others --exclude-standard; } | sort -u)"
|
|
selected=()
|
|
all=0
|
|
for s in "${SUITES[@]}"; do
|
|
grep -q "^${s}/" <<<"$changed" && selected+=("$s")
|
|
done
|
|
grep -Eq '^(pyproject\.toml|scripts/test_suites\.sh|scripts/test_changed\.sh)$' <<<"$changed" && all=1
|
|
|
|
if [[ $all -eq 1 ]]; then
|
|
echo "shared test config changed: running all suites"
|
|
exec "$ROOT/scripts/test_suites.sh"
|
|
fi
|
|
if [[ ${#selected[@]} -eq 0 ]]; then
|
|
echo "no changes in a pytest suite: nothing to test"
|
|
exit 0
|
|
fi
|
|
SUITE_DIRS="${selected[*]}" exec "$ROOT/scripts/test_suites.sh"
|