summaryrefslogtreecommitdiff
path: root/tests/dd
diff options
context:
space:
mode:
authorFederico Simoncelli <fsimonce@redhat.com>2014-09-26 17:12:32 +0000
committerPádraig Brady <P@draigBrady.com>2014-09-30 16:08:43 +0100
commitaf2a4ed22594badd2719c0123441d69b17bd8328 (patch)
tree7b27a3c86f8d6d75b4b8f6cead88e9b6f1378958 /tests/dd
parent27d2c7383f18d0f59b0d096f156ed6cb1677642b (diff)
downloadcoreutils-af2a4ed22594badd2719c0123441d69b17bd8328.tar.xz
dd: new status=progress level to print stats periodically
* src/dd.c: Report the transfer progress every second when the new status=progress level is used. Adjust the handling and description of the status= option so that they're treated as mutually exclusive levels, rather than flags with implicit precedence. * doc/coreutils.texi (dd invocation): Document the new progress status level. Reference the new level in the description of SIGUSR1. * tests/dd/stats.sh: Add new test for status=progress. * tests/dd/misc.sh: Change so status=none only takes precedence if it's the last level specified. * NEWS: Mention the feature.
Diffstat (limited to 'tests/dd')
-rwxr-xr-xtests/dd/misc.sh7
-rwxr-xr-xtests/dd/stats.sh10
2 files changed, 14 insertions, 3 deletions
diff --git a/tests/dd/misc.sh b/tests/dd/misc.sh
index f877fddfa..34dfba722 100755
--- a/tests/dd/misc.sh
+++ b/tests/dd/misc.sh
@@ -35,9 +35,12 @@ dd status=none if=$tmp_in of=/dev/null 2> err || fail=1
compare /dev/null err || fail=1
dd status=none if=$tmp_in skip=2 of=/dev/null 2> err || fail=1
compare /dev/null err || fail=1
-# check status=none is cumulative with status=noxfer
-dd status=none status=noxfer if=$tmp_in of=/dev/null 2> err || fail=1
+# check later status=none overrides earlier status=noxfer
+dd status=noxfer status=none if=$tmp_in of=/dev/null 2> err || fail=1
compare /dev/null err || fail=1
+# check later status=noxfer overrides earlier status=none
+dd status=none status=noxfer if=$tmp_in of=/dev/null 2> err || fail=1
+compare /dev/null err && fail=1
dd if=$tmp_in of=$tmp_out 2> /dev/null || fail=1
compare $tmp_in $tmp_out || fail=1
diff --git a/tests/dd/stats.sh b/tests/dd/stats.sh
index 386752e77..24b8c496b 100755
--- a/tests/dd/stats.sh
+++ b/tests/dd/stats.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# Check robust handling of SIG{INFO,USR1}
+# Check stats output for SIG{INFO,USR1} and status=progress
# Copyright (C) 2014 Free Software Foundation, Inc.
@@ -54,4 +54,12 @@ for open in '' '1'; do
grep '500000000 bytes .* copied' err || { cat err; fail=1; }
done
+progress_output()
+{
+ { sleep "$1"; echo 1; } | dd bs=1 status=progress of=/dev/null 2>err
+ # Progress output should be for "byte ... copied", while final is "bytes ..."
+ grep 'byte .* copied' err
+}
+retry_delay_ progress_output 1 4 || { cat err; fail=1; }
+
Exit $fail