feat: improve scripts and write tests
This commit is contained in:
32 files changed
+3817
-723
No files matched your search
Executable
+10
@@ -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
|
||||
Reference in new issue
Block a user