Test dd conv=noerror with a failing in-order write #145

Open
koolkhel wants to merge 1 commits from koolkhel/vitastor:dd-noerror-tests into master

View File

@@ -79,7 +79,7 @@ rm ./testdata/testfile1
# conv=noerror gives zeros for an unreadable block, also on in-order output; reading lo/speed fails with EINVAL
if [[ -r /sys/class/net/lo/speed ]] && ! cat /sys/class/net/lo/speed >/dev/null 2>&1; then
cp ./testdata/over ./testdata/testfile1
$VITASTOR_CLI dd if=/sys/class/net/lo/speed of=./testdata/testfile1 bs=4k conv=noerror oflag=append
$VITASTOR_CLI dd if=/sys/class/net/lo/speed of=./testdata/testfile1 bs=4k count=1 conv=noerror oflag=append
(cat ./testdata/over; head -c 4k /dev/zero) | cmp - ./testdata/testfile1 || format_error "dd conv=noerror did not replace an unreadable block with zeros"
rm ./testdata/testfile1
else
@@ -94,6 +94,14 @@ if [[ -c /dev/net/tun && -r /dev/net/tun ]]; then
else
echo "SKIP: dd conv=noerror with a failing stream - /dev/net/tun is missing or not readable here"
fi
# an ignored write error does not stop in-order output; writes to /dev/full fail with ENOSPC
if [[ -c /dev/full && -w /dev/full ]]; then
rc=0
timeout 60 $VITASTOR_CLI dd if=/dev/zero of=/dev/full bs=4k count=4 conv=noerror oflag=append || rc=$?
[[ $rc = 0 ]] || format_error "dd conv=noerror to a failing in-order output returned $rc"
else
echo "SKIP: dd conv=noerror with a failing write - /dev/full is missing or not writable here"
fi
# pipe in without count - copy to the end of input
$VITASTOR_CLI dd iimg=testimg iodepth=4 | $VITASTOR_CLI dd of=./testdata/testfile1 iodepth=4