From af2a4ed22594badd2719c0123441d69b17bd8328 Mon Sep 17 00:00:00 2001 From: Federico Simoncelli Date: Fri, 26 Sep 2014 17:12:32 +0000 Subject: 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. --- tests/dd/misc.sh | 7 +++++-- tests/dd/stats.sh | 10 +++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'tests/dd') 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 -- cgit v1.2.3-54-g00ecf