41 lines
2.7 KiB
Bash
41 lines
2.7 KiB
Bash
#!/bin/bash
|
||
# Darkwing's own row 60 mutants. Each edits one source file in the review worktree, runs one
|
||
# test file (or the bus suite), then restores the file from the worktree index (the candidate).
|
||
export TMPDIR=~/darkwing-scratch/rv60r2/tmp
|
||
cd ~/darkwing-scratch/rv60r2/wt
|
||
M=~/darkwing-scratch/rv59/mut.mjs
|
||
B=packages/bus/src/broker.mjs; R=packages/bus/src/runtime.mjs; V=packages/bus/src/views.mjs; S=packages/webui/src/serve.mjs
|
||
BT=packages/bus/tests/credential-status.test.mjs; WE=packages/webui/tests/bus.test.mjs; ALL='packages/bus/tests/*.test.mjs'
|
||
run() { # name file from to test
|
||
node $M "$2" "$3" "$4" || { echo "$1: MUTATION DID NOT APPLY"; return; }
|
||
env -u NODE_TEST_CONTEXT node --test --test-timeout=60000 "$5" > $TMPDIR/mut-$1.log 2>&1
|
||
echo "$1: rc=$? $(grep -E '^ℹ (pass|fail) ' $TMPDIR/mut-$1.log | tr '\n' ' ')"
|
||
grep -E '^✖ ' $TMPDIR/mut-$1.log | sed 's/ ([0-9.]*ms)$//; s/^/ /' | sort -u | head -4
|
||
git checkout -q -- "$2"
|
||
}
|
||
run reader-refused $B "'trail', 'decisions', 'credentials'].includes" "'trail', 'decisions'].includes" $BT
|
||
run role-allowed $B "if (!s.human && !s.reader) fail('human-required');
|
||
keys(a, [], []);" "keys(a, [], []);" $BT
|
||
run args-accepted $B "fail('human-required');
|
||
keys(a, [], []);" "fail('human-required');" $BT
|
||
run prefix-no-slash $B "const prefix = s.business + '/';" "const prefix = s.business;" $BT
|
||
run no-filter $B '.filter((c) => c.instance.startsWith(prefix))' '.filter(() => true)' $BT
|
||
run sync-label-raw $B "role: sync ? 'tracker sync' : role," "role," $BT
|
||
run sync-no-bot $B 'sync ? b.tracker?.sync?.bot :' 'sync ? null :' $BT
|
||
run gitea-gets-bot $B "service === 'vikunja' ? b.roles?.[role]?.tracker?.bot : null" 'b.roles?.[role]?.tracker?.bot' $BT
|
||
run datekind-fixed $B "dateKind: service === 'gitea' ? 'rotateBy' : 'expires'," "dateKind: 'expires'," $BT
|
||
run account-undefined $B 'account: bot ?? null,' 'account: bot,' $BT
|
||
run leak-instance $B " return {
|
||
service," " return {
|
||
instance,
|
||
service," $BT
|
||
run status-cached $B 'this.#credentialStatus = credentialStatus;' 'const cached = credentialStatus(); this.#credentialStatus = () => cached;' $BT
|
||
run no-result-check $B "const result = this.#dispatch(s, request.verb, args);
|
||
this.#secretCheck(result);" "const result = this.#dispatch(s, request.verb, args);" $BT
|
||
run runtime-no-status $R " credentialStatus: () => credentials.status(),
|
||
" '' $BT
|
||
run views-no-verb $V " credentials: () => client.call('credentials'),
|
||
" '' $WE
|
||
run serve-no-verb $S "'decisions', 'credentials'];" "'decisions'];" $WE
|
||
git diff --quiet -- $B $R $V $S && echo "restored: sources match the candidate index" || echo "NOT RESTORED"
|