Files
stack/agents/darkwing/work/queue-51-review/r2/mut/run.sh
T

23 lines
1.1 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# run.sh <mutant>: mutate, run the conversation suite, list and kill shims left under TMPDIR, restore from backups.
m=$1
export TMPDIR=~/darkwing-scratch/r51b/muttmp/mut-$m DOCKER_HOST=unix:///nonexistent.sock
mkdir -p $TMPDIR
M=~/darkwing-scratch/r51b/mut; cd ~/darkwing-scratch/r51b/wt2
files=$(python3 -I $M/mutate.py $m --files)
for f in $files; do cp -p $f $f.mutbak; done
if python3 -I $M/mutate.py $m > /dev/null; then
node --test "packages/conversation/tests/*.test.mjs" > $M/$m-conversation.txt 2>&1; e=$?
else e=mutate-failed; fi
left=$(ps -eo pid=,args= | grep -F "$TMPDIR/" | grep -F /shim.mjs | grep -v grep)
n=$(printf '%s' "$left" | grep -c .)
echo "$left" > $M/$m-shims-left.txt
printf '%s\n' "$left" | while read pid rest; do
[ -n "$pid" ] || continue
u=$(tr '/' '\n' < /proc/$pid/cgroup | grep '^mosaic-chat-.*\.scope$')
[ -n "$u" ] && systemctl --user kill --signal=SIGKILL "$u"
kill -9 $pid 2>/dev/null
done
for f in $files; do mv $f.mutbak $f; done
echo "$m rc $e $(grep -E '^ℹ (pass|fail)' $M/$m-conversation.txt | tr '\n' ' ') shims-left $n" >> $M/summary.txt