mirror of
https://github.com/larvit/adf-codec.git
synced 2026-11-12 11:48:29 +01:00
24 lines
1.3 KiB
Bash
Executable File
24 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
source ./docker-runner.sh
|
|
|
|
base=$(git merge-base "${1:-origin/main}" HEAD)
|
|
# Each hunk's added lines as path:first-last, in the working tree's numbering; Stryker keeps a mutant only wholly inside one, so a hunk that only deletes has none.
|
|
mutate=$(git diff --no-ext-diff --no-prefix -U0 --inter-hunk-context=0 --no-color "$base" -- 'src/*.ts' ':!src/*.test.ts' ':!src/conformance/property-harness.ts' | awk '
|
|
/^\+\+\+ / { path = $2 }
|
|
/^@@ / {
|
|
split($3, added, ",")
|
|
first = substr(added[1], 2)
|
|
count = (2 in added) ? added[2] : 1
|
|
if (count > 0) { printf "%s%s:%d-%d", separator, path, first, first + count - 1; separator = "," }
|
|
}')
|
|
if [ -z "$mutate" ]; then
|
|
echo "no source line changed since $base"
|
|
exit 0
|
|
fi
|
|
|
|
leg "install ($node_image)" in_image "$node_image" sh -c 'npm ci --no-audit --no-fund && npm ci --no-audit --no-fund --prefix mutation-tests'
|
|
# Four workers fit 6 GB in measured runs where fifteen had some killed, and a killed worker's mutant reads as a RuntimeError, which fails the run.
|
|
in_image_memory=6g leg "mutation tests ($node_image)" in_image "$node_image" sh -c 'mutation-tests/node_modules/.bin/stryker run mutation-tests/stryker.config.mjs --concurrency 4 --mutate "$1" && node mutation-tests/check-runtime-errors.mjs' sh "$mutate"
|