summaryrefslogtreecommitdiffstats
path: root/tests/ts/fincore
diff options
context:
space:
mode:
authorRuediger Meier2017-04-06 09:56:04 +0200
committerKarel Zak2017-04-06 12:30:10 +0200
commitb9d3db99e11d821b6751375dd36b686b013192c8 (patch)
treef4b52b258b0c5459d796356f1f6ceb6f11ef29d0 /tests/ts/fincore
parentfincore: fix multiplication overflow (diff)
downloadkernel-qcow2-util-linux-b9d3db99e11d821b6751375dd36b686b013192c8.tar.gz
kernel-qcow2-util-linux-b9d3db99e11d821b6751375dd36b686b013192c8.tar.xz
kernel-qcow2-util-linux-b9d3db99e11d821b6751375dd36b686b013192c8.zip
tests: handle dd errors in fincore/count
On dd error the test will fail earlier and the test diff will be more useful. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Diffstat (limited to 'tests/ts/fincore')
-rwxr-xr-xtests/ts/fincore/count31
1 files changed, 20 insertions, 11 deletions
diff --git a/tests/ts/fincore/count b/tests/ts/fincore/count
index be815527e..fd50ff8c9 100755
--- a/tests/ts/fincore/count
+++ b/tests/ts/fincore/count
@@ -17,6 +17,20 @@ function make_input_name
echo ${prefix}$(sed -e "s/[^-+a-zA-Z0-9_]/_/g"<<<"$header")
}
+function _dd
+{
+ local msg
+ local ret=0
+
+ msg=$(dd "$@" 2>&1)
+ ret=$?
+ if [ $ret != 0 ]; then
+ echo "failed: dd $@" >&2
+ echo "$msg" >&2
+ fi
+ return $ret
+}
+
function run_dd_test
{
header=$1
@@ -25,11 +39,12 @@ function run_dd_test
input=$(make_input_name "$header")
INPUT="${INPUT} ${input}"
+ rm -f "$input"
if [ "$bs" = 0 ]; then
- touch $input
+ touch $input
else
- $DD if=/dev/zero of=$input count=1 bs=$bs $flags &> /dev/null
+ _dd if=/dev/zero of=$input count=1 bs=$bs $flags || return
fi
$TS_CMD_FINCORE --output $COLUMNS --bytes --noheadings $input
@@ -47,9 +62,10 @@ function run_dd_dd_test
input=$(make_input_name "$header")
INPUT="${INPUT} ${input}"
+ rm -f "$input"
- $DD if=/dev/zero of=$input count=1 bs=$bs $flags0 &> /dev/null
- $DD if=/dev/zero of=$input count=1 bs=$bs $flags1 &> /dev/null
+ _dd if=/dev/zero of=$input count=1 bs=$bs $flags0 || return
+ _dd if=/dev/zero of=$input count=1 bs=$bs $flags1 || return
$TS_CMD_FINCORE --output $COLUMNS --bytes --noheadings $input
@@ -75,13 +91,6 @@ else
fi
-# seems unsupported by some dd(1) version
-#DD_FLAGS="status=none"
-
-DD_FLAGS=
-DD="dd $DD_FLAGS"
-
-
ts_check_test_command "$TS_CMD_FINCORE"
ts_cd "$TS_OUTDIR"