#!/usr/bin/env bash # Row 170 (#1667), Dewey's run on candidate 0b6ff260f: # busy check, the 3 changed test files and the 2 that read a changed file, singly, the bus and cli # suites, then the brief's 2 mutants (M1, M2). Slot work: run only on Sage's go. set -uo pipefail R=$HOME/dewey-scratch/r170-run; WT=$HOME/dewey-scratch/r170 export TMPDIR=$HOME/dewey-scratch/tmp/r170 mkdir -p "$TMPDIR" || exit 2 M=$R/manifest.sha256 "$HOME/dewey-scratch/busy.sh" || { echo "abort: busy"; exit 2; } [ "$(git -C "$WT" rev-parse HEAD)" = 0b6ff260faaa4922396ce5ab624630ba75d502d5 ] || { echo "abort: worktree not on 0b6ff260f"; exit 2; } (cd "$WT" && sha256sum --quiet -c "$M") || { echo "abort: worktree differs from the manifest"; exit 2; } echo "start $(date -u +%FT%TZ) manifest $(sha256sum < "$M" | cut -d' ' -f1)" sum() { awk '/^ℹ (tests|pass|fail|cancelled|skipped) [0-9]+$/ {s[$2]+=$3} END {printf "tests %d pass %d fail %d cancelled %d skipped %d\n", s["tests"], s["pass"], s["fail"], s["cancelled"], s["skipped"]}' "$@"; } O=$R/touched; rm -rf "$O"; mkdir -p "$O" || exit 2 red=0 while read -r f; do log="$O/$(echo "$f" | tr '/' '%').log" (cd "$WT" && setsid -w timeout -k 10 900 node --test --test-reporter=spec "$f" > "$log" 2>&1 < /dev/null); rc=$? echo "touched $f rc=$rc :: $(awk '/^ℹ (tests|pass|fail|cancelled|skipped) [0-9]+$/ {printf "%s %s ", $2, $3}' "$log")" grep -E '^✖ |^﹣ ' "$log" | sed 's/^/ /' | sort -u [ "$rc" -eq 0 ] || red=1 done < "$R/touched.txt" echo "touched sum: $(sum "$O"/*.log)" [ "$red" -eq 0 ] || { echo "stop: a touched file is red"; exit 1; } S=$R/suites; rm -rf "$S"; mkdir -p "$S" || exit 2 for p in bus cli; do (cd "$WT" && setsid -w timeout -k 10 1800 node --test --test-reporter=spec "packages/$p/tests/" > "$S/$p.log" 2>&1 < /dev/null); rc=$? echo "suite $p rc=$rc :: $(sum "$S/$p.log")" grep -E '^✖ ' "$S/$p.log" | sed 's/^/ /' | sort -u | head -20 [ "$rc" -eq 0 ] || red=1 done echo "suites sum: $(sum "$S"/*.log)" [ "$red" -eq 0 ] || { echo "stop: a suite is red"; exit 1; } setsid -w timeout -k 10 3600 "$R/mutants.sh" "$WT" "$R/mutants-out" "$M"; echo "mutants.sh rc=$?" (cd "$WT" && sha256sum --quiet -c "$M") && echo "worktree manifest OK at end" || echo "WORKTREE MANIFEST MISMATCH at end" echo "end $(date -u +%FT%TZ)"