Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/regress/bin/dd Regression tests for dd(1). Not currently co...



details:   https://anonhg.NetBSD.org/src/rev/2a6887530627
branches:  trunk
changeset: 555351:2a6887530627
user:      dsainty <dsainty%NetBSD.org@localhost>
date:      Sat Nov 15 10:48:53 2003 +0000

description:
Regression tests for dd(1).  Not currently comprehensive, but tests for the bug reported in PR bin/8521.

diffstat:

 regress/bin/dd/Makefile |   8 ++++++++
 regress/bin/dd/dd.sh    |  25 +++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 0 deletions(-)

diffs (41 lines):

diff -r 8b9d1360726b -r 2a6887530627 regress/bin/dd/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/bin/dd/Makefile   Sat Nov 15 10:48:53 2003 +0000
@@ -0,0 +1,8 @@
+#      $NetBSD: Makefile,v 1.1 2003/11/15 10:48:53 dsainty Exp $
+
+NOMAN=         # defined
+
+regress:
+       @sh ${.CURDIR}/dd.sh
+
+.include <bsd.prog.mk>
diff -r 8b9d1360726b -r 2a6887530627 regress/bin/dd/dd.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/bin/dd/dd.sh      Sat Nov 15 10:48:53 2003 +0000
@@ -0,0 +1,25 @@
+#!/bin/sh
+#
+# Test dd(1) functionality and bugs
+#
+
+test_dd_length() {
+       result=$1
+       cmd=$2
+       set -- x `eval $cmd | wc -c`
+       res=$2
+       if [ x"$res" != x"$result" ]; then
+               echo "Expected $result bytes of output, got $res: $cmd"
+               exit 1
+       fi
+}
+
+# Test for result messages accidentally pumped into the output file if
+# the standard IO descriptors are closed.  The last of the three
+# following tests is the one expected to fail. (NetBSD PR bin/8521)
+#
+test_dd_length 512 "dd if=/dev/zero of=/dev/fd/5 count=1 5>&1 >/dev/null 2>/dev/null"
+test_dd_length 512 "dd if=/dev/zero of=/dev/fd/5 count=1 5>&1 >&- 2>/dev/null"
+test_dd_length 512 "dd if=/dev/zero of=/dev/fd/5 count=1 5>&1 >&- 2>&-"
+
+exit 0



Home | Main Index | Thread Index | Old Index