30 lines
1.4 KiB
Bash
Executable file
30 lines
1.4 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Runs each planted mutation against the packages that must catch it, and records red/green.
|
|
set -u
|
|
cd "${P8_COPY:?set P8_COPY to a COPY of platform/}"
|
|
# окружение батареи задаёт вызывающий: TM_PLATFORM_TEST_DSN + TM_PLATFORM_TEST_ENGINE_BIN + TM_PLATFORM_TEST_BOOK_TEMPLATE
|
|
: "${TM_PLATFORM_TEST_DSN:?}" "${TM_PLATFORM_TEST_ENGINE_BIN:?}" "${TM_PLATFORM_TEST_BOOK_TEMPLATE:?}"
|
|
OUT=${P8_OUT:-.}/mutations.log
|
|
: > $OUT
|
|
declare -A PKGS=(
|
|
[M3]="./internal/pgstore/ ./internal/runs/"
|
|
[M4]="./internal/pgstore/ ./internal/runs/"
|
|
[M5]="./internal/runs/ ./internal/pgstore/"
|
|
[M6]="./internal/auth/ ./internal/login/ ./internal/httpapi/ ./cmd/tmplatformd/"
|
|
[M7]="./internal/runs/ ./cmd/tmplatformd/"
|
|
)
|
|
for m in M3 M4 M5 M6 M7; do
|
|
python3 "${P8_HERE:-$(dirname "$0")}/plant.py" $m plant >> $OUT
|
|
go build ./... >> $OUT 2>&1 || { echo "$m BUILD FAILED" >> $OUT; python3 "${P8_HERE:-$(dirname "$0")}/plant.py" $m revert >> $OUT; continue; }
|
|
go test ${PKGS[$m]} -count=1 > /tmp/mut.$m.log 2>&1
|
|
st=$?
|
|
if [ $st -ne 0 ]; then
|
|
echo "$m: RED (пойман) — $(grep -c -- '--- FAIL' /tmp/mut.$m.log) провалов" >> $OUT
|
|
grep -- '--- FAIL' /tmp/mut.$m.log | head -6 >> $OUT
|
|
else
|
|
echo "$m: GREEN (ВЫЖИЛ) — батарея названных пакетов не заметила" >> $OUT
|
|
fi
|
|
python3 "${P8_HERE:-$(dirname "$0")}/plant.py" $m revert >> $OUT
|
|
echo "---" >> $OUT
|
|
done
|
|
echo "DONE" >> $OUT
|