feat: improve scripts and write tests

This commit is contained in:
alexm committed 2026-10-11 07:22:13 -04:00
1 parent bc3091647e
commit cf4bd07a8e
32 files changed
+3817 -723

No files matched your search

+10
View File
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
# Wrap real dd: drop oflag=direct (unsupported on tmpfs), log, inject faults.
echo "dd $*" >> "${FAKE_OPS_LOG:-/dev/null}"
[[ -z "${FAKE_DD_FAIL:-}" ]] || { echo "dd: error writing: Input/output error" >&2; exit 1; }
args=(); for a in "$@"; do [[ "$a" == oflag=direct ]] || args+=("$a"); done
/usr/bin/dd "${args[@]}" || exit $?
if [[ -n "${FAKE_DD_CORRUPT:-}" ]]; then
for a in "$@"; do [[ "$a" == of=* ]] && of="${a#of=}"; done
printf '\xff' | /usr/bin/dd of="$of" bs=1 seek=1000 conv=notrunc status=none
fi