Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Jul 2017 03:52:54 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r320930 - in head: etc/mtree usr.bin/hexdump usr.bin/hexdump/tests
Message-ID:  <201707130352.v6D3qsXX049061@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans
Date: Thu Jul 13 03:52:54 2017
New Revision: 320930
URL: https://svnweb.freebsd.org/changeset/base/320930

Log:
  Add some basic tests for hexdump(1)'s various output flags. Formatting
  tests are omitted for this initial run as there are still some bugs to work
  out there.
  
  This covers -s flag testing on devices and non-devices that would have
  caught breakage found in PR 219173 as well as other subtle breakage caused
  locally.
  
  Reviewed by:	cem, ngie
  Approved by:	cem (acting co-mentor)
  MFC after:	2 weeks
  Differential Revision:	https://reviews.freebsd.org/D11279

Added:
  head/usr.bin/hexdump/tests/
  head/usr.bin/hexdump/tests/Makefile   (contents, props changed)
  head/usr.bin/hexdump/tests/d_hexdump_UCflag_a.out   (contents, props changed)
  head/usr.bin/hexdump/tests/d_hexdump_UCflag_b.out   (contents, props changed)
  head/usr.bin/hexdump/tests/d_hexdump_UCflag_c.out   (contents, props changed)
  head/usr.bin/hexdump/tests/d_hexdump_a.in   (contents, props changed)
  head/usr.bin/hexdump/tests/d_hexdump_b.in   (contents, props changed)
  head/usr.bin/hexdump/tests/d_hexdump_bflag_a.out   (contents, props changed)
  head/usr.bin/hexdump/tests/d_hexdump_bflag_b.out   (contents, props changed)
  head/usr.bin/hexdump/tests/d_hexdump_bflag_c.out   (contents, props changed)
  head/usr.bin/hexdump/tests/d_hexdump_c.in   (contents, props changed)
  head/usr.bin/hexdump/tests/d_hexdump_cflag_a.out   (contents, props changed)
  head/usr.bin/hexdump/tests/d_hexdump_cflag_b.out   (contents, props changed)
  head/usr.bin/hexdump/tests/d_hexdump_cflag_c.out   (contents, props changed)
  head/usr.bin/hexdump/tests/d_hexdump_dflag_a.out   (contents, props changed)
  head/usr.bin/hexdump/tests/d_hexdump_dflag_b.out   (contents, props changed)
  head/usr.bin/hexdump/tests/d_hexdump_dflag_c.out   (contents, props changed)
  head/usr.bin/hexdump/tests/d_hexdump_nflag_a.out   (contents, props changed)
  head/usr.bin/hexdump/tests/d_hexdump_oflag_a.out   (contents, props changed)
  head/usr.bin/hexdump/tests/d_hexdump_oflag_b.out   (contents, props changed)
  head/usr.bin/hexdump/tests/d_hexdump_oflag_c.out   (contents, props changed)
  head/usr.bin/hexdump/tests/d_hexdump_sflag_a.out   (contents, props changed)
  head/usr.bin/hexdump/tests/d_hexdump_xflag_a.out   (contents, props changed)
  head/usr.bin/hexdump/tests/d_hexdump_xflag_b.out   (contents, props changed)
  head/usr.bin/hexdump/tests/d_hexdump_xflag_c.out   (contents, props changed)
  head/usr.bin/hexdump/tests/hexdump_test.sh   (contents, props changed)
Modified:
  head/etc/mtree/BSD.tests.dist
  head/usr.bin/hexdump/Makefile

Modified: head/etc/mtree/BSD.tests.dist
==============================================================================
--- head/etc/mtree/BSD.tests.dist	Thu Jul 13 02:20:07 2017	(r320929)
+++ head/etc/mtree/BSD.tests.dist	Thu Jul 13 03:52:54 2017	(r320930)
@@ -644,6 +644,8 @@
         ..
         gzip
         ..
+        hexdump
+        ..
         ident
         ..
         indent

Modified: head/usr.bin/hexdump/Makefile
==============================================================================
--- head/usr.bin/hexdump/Makefile	Thu Jul 13 02:20:07 2017	(r320929)
+++ head/usr.bin/hexdump/Makefile	Thu Jul 13 03:52:54 2017	(r320930)
@@ -1,11 +1,17 @@
 #	@(#)Makefile	8.1 (Berkeley) 6/6/93
 # $FreeBSD$
 
+.include <src.opts.mk>
+
 PROG=	hexdump
 SRCS=	conv.c display.c hexdump.c hexsyntax.c odsyntax.c parse.c
 MAN=	hexdump.1 od.1
 MLINKS=	hexdump.1 hd.1
 LINKS=	${BINDIR}/hexdump ${BINDIR}/od
 LINKS+=	${BINDIR}/hexdump ${BINDIR}/hd
+
+.if ${MK_TESTS} != "no"
+SUBDIR+=	tests
+.endif
 
 .include <bsd.prog.mk>

Added: head/usr.bin/hexdump/tests/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.bin/hexdump/tests/Makefile	Thu Jul 13 03:52:54 2017	(r320930)
@@ -0,0 +1,31 @@
+# $FreeBSD$
+
+PACKAGE=	tests
+
+ATF_TESTS_SH=	hexdump_test
+
+${PACKAGE}FILES+=	d_hexdump_a.in
+${PACKAGE}FILES+=	d_hexdump_b.in
+${PACKAGE}FILES+=	d_hexdump_c.in
+${PACKAGE}FILES+=	d_hexdump_bflag_a.out
+${PACKAGE}FILES+=	d_hexdump_bflag_b.out
+${PACKAGE}FILES+=	d_hexdump_bflag_c.out
+${PACKAGE}FILES+=	d_hexdump_cflag_a.out
+${PACKAGE}FILES+=	d_hexdump_cflag_b.out
+${PACKAGE}FILES+=	d_hexdump_cflag_c.out
+${PACKAGE}FILES+=	d_hexdump_dflag_a.out
+${PACKAGE}FILES+=	d_hexdump_dflag_b.out
+${PACKAGE}FILES+=	d_hexdump_dflag_c.out
+${PACKAGE}FILES+=	d_hexdump_nflag_a.out
+${PACKAGE}FILES+=	d_hexdump_oflag_a.out
+${PACKAGE}FILES+=	d_hexdump_oflag_b.out
+${PACKAGE}FILES+=	d_hexdump_oflag_c.out
+${PACKAGE}FILES+=	d_hexdump_sflag_a.out
+${PACKAGE}FILES+=	d_hexdump_UCflag_a.out
+${PACKAGE}FILES+=	d_hexdump_UCflag_b.out
+${PACKAGE}FILES+=	d_hexdump_UCflag_c.out
+${PACKAGE}FILES+=	d_hexdump_xflag_a.out
+${PACKAGE}FILES+=	d_hexdump_xflag_b.out
+${PACKAGE}FILES+=	d_hexdump_xflag_c.out
+
+.include <bsd.test.mk>

Added: head/usr.bin/hexdump/tests/d_hexdump_UCflag_a.out
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.bin/hexdump/tests/d_hexdump_UCflag_a.out	Thu Jul 13 03:52:54 2017	(r320930)
@@ -0,0 +1,2 @@
+00000000  54 65 73 74 0a                                    |Test.|
+00000005

Added: head/usr.bin/hexdump/tests/d_hexdump_UCflag_b.out
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.bin/hexdump/tests/d_hexdump_UCflag_b.out	Thu Jul 13 03:52:54 2017	(r320930)
@@ -0,0 +1,4 @@
+00000000  54 68 65 20 71 75 69 63  6b 20 62 72 6f 77 6e 20  |The quick brown |
+00000010  66 6f 78 20 6a 75 6d 70  65 64 20 6f 76 65 72 20  |fox jumped over |
+00000020  74 68 65 20 62 6c 75 65  20 68 6f 75 73 65 0a 0a  |the blue house..|
+00000030

Added: head/usr.bin/hexdump/tests/d_hexdump_UCflag_c.out
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.bin/hexdump/tests/d_hexdump_UCflag_c.out	Thu Jul 13 03:52:54 2017	(r320930)
@@ -0,0 +1,4 @@
+00000000  41 41 41 41 41 41 41 41  41 41 41 41 41 41 41 41  |AAAAAAAAAAAAAAAA|
+*
+00000020  41 41 41 41 41 41 41 0a                           |AAAAAAA.|
+00000028

Added: head/usr.bin/hexdump/tests/d_hexdump_a.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.bin/hexdump/tests/d_hexdump_a.in	Thu Jul 13 03:52:54 2017	(r320930)
@@ -0,0 +1 @@
+Test

Added: head/usr.bin/hexdump/tests/d_hexdump_b.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.bin/hexdump/tests/d_hexdump_b.in	Thu Jul 13 03:52:54 2017	(r320930)
@@ -0,0 +1,2 @@
+The quick brown fox jumped over the blue house
+

Added: head/usr.bin/hexdump/tests/d_hexdump_bflag_a.out
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.bin/hexdump/tests/d_hexdump_bflag_a.out	Thu Jul 13 03:52:54 2017	(r320930)
@@ -0,0 +1,2 @@
+0000000 124 145 163 164 012                                            
+0000005

Added: head/usr.bin/hexdump/tests/d_hexdump_bflag_b.out
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.bin/hexdump/tests/d_hexdump_bflag_b.out	Thu Jul 13 03:52:54 2017	(r320930)
@@ -0,0 +1,4 @@
+0000000 124 150 145 040 161 165 151 143 153 040 142 162 157 167 156 040
+0000010 146 157 170 040 152 165 155 160 145 144 040 157 166 145 162 040
+0000020 164 150 145 040 142 154 165 145 040 150 157 165 163 145 012 012
+0000030

Added: head/usr.bin/hexdump/tests/d_hexdump_bflag_c.out
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.bin/hexdump/tests/d_hexdump_bflag_c.out	Thu Jul 13 03:52:54 2017	(r320930)
@@ -0,0 +1,4 @@
+0000000 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101
+*
+0000020 101 101 101 101 101 101 101 012                                
+0000028

Added: head/usr.bin/hexdump/tests/d_hexdump_c.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.bin/hexdump/tests/d_hexdump_c.in	Thu Jul 13 03:52:54 2017	(r320930)
@@ -0,0 +1 @@
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

Added: head/usr.bin/hexdump/tests/d_hexdump_cflag_a.out
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.bin/hexdump/tests/d_hexdump_cflag_a.out	Thu Jul 13 03:52:54 2017	(r320930)
@@ -0,0 +1,2 @@
+0000000   T   e   s   t  \n                                            
+0000005

Added: head/usr.bin/hexdump/tests/d_hexdump_cflag_b.out
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.bin/hexdump/tests/d_hexdump_cflag_b.out	Thu Jul 13 03:52:54 2017	(r320930)
@@ -0,0 +1,4 @@
+0000000   T   h   e       q   u   i   c   k       b   r   o   w   n    
+0000010   f   o   x       j   u   m   p   e   d       o   v   e   r    
+0000020   t   h   e       b   l   u   e       h   o   u   s   e  \n  \n
+0000030

Added: head/usr.bin/hexdump/tests/d_hexdump_cflag_c.out
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.bin/hexdump/tests/d_hexdump_cflag_c.out	Thu Jul 13 03:52:54 2017	(r320930)
@@ -0,0 +1,4 @@
+0000000   A   A   A   A   A   A   A   A   A   A   A   A   A   A   A   A
+*
+0000020   A   A   A   A   A   A   A  \n                                
+0000028

Added: head/usr.bin/hexdump/tests/d_hexdump_dflag_a.out
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.bin/hexdump/tests/d_hexdump_dflag_a.out	Thu Jul 13 03:52:54 2017	(r320930)
@@ -0,0 +1,2 @@
+0000000   25940   29811   00010                                        
+0000005

Added: head/usr.bin/hexdump/tests/d_hexdump_dflag_b.out
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.bin/hexdump/tests/d_hexdump_dflag_b.out	Thu Jul 13 03:52:54 2017	(r320930)
@@ -0,0 +1,4 @@
+0000000   26708   08293   30065   25449   08299   29282   30575   08302
+0000010   28518   08312   30058   28781   25701   28448   25974   08306
+0000020   26740   08293   27746   25973   26656   30063   25971   02570
+0000030

Added: head/usr.bin/hexdump/tests/d_hexdump_dflag_c.out
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.bin/hexdump/tests/d_hexdump_dflag_c.out	Thu Jul 13 03:52:54 2017	(r320930)
@@ -0,0 +1,4 @@
+0000000   16705   16705   16705   16705   16705   16705   16705   16705
+*
+0000020   16705   16705   16705   02625                                
+0000028

Added: head/usr.bin/hexdump/tests/d_hexdump_nflag_a.out
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.bin/hexdump/tests/d_hexdump_nflag_a.out	Thu Jul 13 03:52:54 2017	(r320930)
@@ -0,0 +1,2 @@
+0000000 124                                                            
+0000001

Added: head/usr.bin/hexdump/tests/d_hexdump_oflag_a.out
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.bin/hexdump/tests/d_hexdump_oflag_a.out	Thu Jul 13 03:52:54 2017	(r320930)
@@ -0,0 +1,2 @@
+0000000  062524  072163  000012                                        
+0000005

Added: head/usr.bin/hexdump/tests/d_hexdump_oflag_b.out
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.bin/hexdump/tests/d_hexdump_oflag_b.out	Thu Jul 13 03:52:54 2017	(r320930)
@@ -0,0 +1,4 @@
+0000000  064124  020145  072561  061551  020153  071142  073557  020156
+0000010  067546  020170  072552  070155  062145  067440  062566  020162
+0000020  064164  020145  066142  062565  064040  072557  062563  005012
+0000030

Added: head/usr.bin/hexdump/tests/d_hexdump_oflag_c.out
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.bin/hexdump/tests/d_hexdump_oflag_c.out	Thu Jul 13 03:52:54 2017	(r320930)
@@ -0,0 +1,4 @@
+0000000  040501  040501  040501  040501  040501  040501  040501  040501
+*
+0000020  040501  040501  040501  005101                                
+0000028

Added: head/usr.bin/hexdump/tests/d_hexdump_sflag_a.out
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.bin/hexdump/tests/d_hexdump_sflag_a.out	Thu Jul 13 03:52:54 2017	(r320930)
@@ -0,0 +1,2 @@
+0000004 012                                                            
+0000005

Added: head/usr.bin/hexdump/tests/d_hexdump_xflag_a.out
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.bin/hexdump/tests/d_hexdump_xflag_a.out	Thu Jul 13 03:52:54 2017	(r320930)
@@ -0,0 +1,2 @@
+0000000    6554    7473    000a                                        
+0000005

Added: head/usr.bin/hexdump/tests/d_hexdump_xflag_b.out
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.bin/hexdump/tests/d_hexdump_xflag_b.out	Thu Jul 13 03:52:54 2017	(r320930)
@@ -0,0 +1,4 @@
+0000000    6854    2065    7571    6369    206b    7262    776f    206e
+0000010    6f66    2078    756a    706d    6465    6f20    6576    2072
+0000020    6874    2065    6c62    6575    6820    756f    6573    0a0a
+0000030

Added: head/usr.bin/hexdump/tests/d_hexdump_xflag_c.out
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.bin/hexdump/tests/d_hexdump_xflag_c.out	Thu Jul 13 03:52:54 2017	(r320930)
@@ -0,0 +1,4 @@
+0000000    4141    4141    4141    4141    4141    4141    4141    4141
+*
+0000020    4141    4141    4141    0a41                                
+0000028

Added: head/usr.bin/hexdump/tests/hexdump_test.sh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.bin/hexdump/tests/hexdump_test.sh	Thu Jul 13 03:52:54 2017	(r320930)
@@ -0,0 +1,192 @@
+#
+# Copyright (c) 2017 Kyle Evans <kevans@FreeBSD.org>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+
+atf_test_case b_flag
+b_flag_head()
+{
+	atf_set "descr" "Verify -b output"
+}
+b_flag_body()
+{
+	atf_check -o file:"$(atf_get_srcdir)/d_hexdump_bflag_a.out" \
+	    hexdump -b "$(atf_get_srcdir)/d_hexdump_a.in"
+	atf_check -o file:"$(atf_get_srcdir)/d_hexdump_bflag_b.out" \
+	    hexdump -b "$(atf_get_srcdir)/d_hexdump_b.in"
+	atf_check -o file:"$(atf_get_srcdir)/d_hexdump_bflag_c.out" \
+	    hexdump -b "$(atf_get_srcdir)/d_hexdump_c.in"
+}
+
+atf_test_case c_flag
+c_flag_head()
+{
+	atf_set "descr" "Verify -c output"
+}
+c_flag_body()
+{
+	atf_check -o file:"$(atf_get_srcdir)/d_hexdump_cflag_a.out" \
+	    hexdump -c "$(atf_get_srcdir)/d_hexdump_a.in"
+	atf_check -o file:"$(atf_get_srcdir)/d_hexdump_cflag_b.out" \
+	    hexdump -c "$(atf_get_srcdir)/d_hexdump_b.in"
+	atf_check -o file:"$(atf_get_srcdir)/d_hexdump_cflag_c.out" \
+	    hexdump -c "$(atf_get_srcdir)/d_hexdump_c.in"
+}
+
+atf_test_case C_flag
+C_flag_head()
+{
+	atf_set "descr" "Verify -C output"
+}
+C_flag_body()
+{
+	atf_check -o file:"$(atf_get_srcdir)/d_hexdump_UCflag_a.out" \
+	    hexdump -C "$(atf_get_srcdir)/d_hexdump_a.in"
+	atf_check -o file:"$(atf_get_srcdir)/d_hexdump_UCflag_b.out" \
+	    hexdump -C "$(atf_get_srcdir)/d_hexdump_b.in"
+	atf_check -o file:"$(atf_get_srcdir)/d_hexdump_UCflag_c.out" \
+	    hexdump -C "$(atf_get_srcdir)/d_hexdump_c.in"
+}
+
+atf_test_case hd_name
+hd_name_head()
+{
+	atf_set "descr" "Verify hd output matching -C output"
+}
+hd_name_body()
+{
+	atf_check -o file:"$(atf_get_srcdir)/d_hexdump_UCflag_a.out" \
+	    hd "$(atf_get_srcdir)/d_hexdump_a.in"
+	atf_check -o file:"$(atf_get_srcdir)/d_hexdump_UCflag_b.out" \
+	    hd "$(atf_get_srcdir)/d_hexdump_b.in"
+	atf_check -o file:"$(atf_get_srcdir)/d_hexdump_UCflag_c.out" \
+	    hd "$(atf_get_srcdir)/d_hexdump_c.in"
+}
+
+atf_test_case d_flag
+d_flag_head()
+{
+	atf_set "descr" "Verify -d output"
+}
+d_flag_body()
+{
+	atf_check -o file:"$(atf_get_srcdir)/d_hexdump_dflag_a.out" \
+	    hexdump -d "$(atf_get_srcdir)/d_hexdump_a.in"
+	atf_check -o file:"$(atf_get_srcdir)/d_hexdump_dflag_b.out" \
+	    hexdump -d "$(atf_get_srcdir)/d_hexdump_b.in"
+	atf_check -o file:"$(atf_get_srcdir)/d_hexdump_dflag_c.out" \
+	    hexdump -d "$(atf_get_srcdir)/d_hexdump_c.in"
+}
+
+atf_test_case n_flag
+n_flag_head()
+{
+	atf_set "descr" "Check -n functionality"
+}
+n_flag_body()
+{
+	atf_check -o empty hexdump -bn 0 "$(atf_get_srcdir)/d_hexdump_a.in"
+	atf_check -o file:"$(atf_get_srcdir)/d_hexdump_nflag_a.out" \
+	    hexdump -bn 1 "$(atf_get_srcdir)/d_hexdump_a.in"
+}
+
+atf_test_case o_flag
+o_flag_head()
+{
+	atf_set "descr" "Verify -o output"
+}
+o_flag_body()
+{
+	atf_check -o file:"$(atf_get_srcdir)/d_hexdump_oflag_a.out" \
+	    hexdump -o "$(atf_get_srcdir)/d_hexdump_a.in"
+	atf_check -o file:"$(atf_get_srcdir)/d_hexdump_oflag_b.out" \
+	    hexdump -o "$(atf_get_srcdir)/d_hexdump_b.in"
+	atf_check -o file:"$(atf_get_srcdir)/d_hexdump_oflag_c.out" \
+	    hexdump -o "$(atf_get_srcdir)/d_hexdump_c.in"
+}
+
+atf_test_case s_flag
+s_flag_head()
+{
+	atf_set "descr" "Verify -s output"
+}
+s_flag_body()
+{
+	atf_expect_fail "-s option is currently broken due to capsicum (PR 219173)"
+	atf_check -o file:"$(atf_get_srcdir)/d_hexdump_sflag_a.out" \
+	    hexdump -bs 4 "$(atf_get_srcdir)/d_hexdump_a.in"
+
+	atf_check -o not-empty hexdump -n 100 -s 1024 /dev/random
+}
+
+atf_test_case v_flag
+v_flag_head()
+{
+	atf_set "descr" "Verify -v functionality"
+}
+v_flag_body()
+{
+	atf_expect_fail "-s option is currently broken due to capsicum (PR 219173)"
+	for i in $(seq 0 7); do
+		atf_check -o match:"^\*$" \
+		    hexdump -s ${i} "$(atf_get_srcdir)/d_hexdump_c.in"
+		atf_check -o not-match:"^\*$" \
+		    hexdump -vs ${i} "$(atf_get_srcdir)/d_hexdump_c.in"
+	done
+
+	atf_check -o not-match:"^\*$" \
+	    hexdump -s 8 "$(atf_get_srcdir)/d_hexdump_c.in"
+	atf_check -o not-match:"^\*$" \
+	    hexdump -vs 8 "$(atf_get_srcdir)/d_hexdump_c.in"
+}
+
+atf_test_case x_flag
+x_flag_head()
+{
+	atf_set "descr" "Verify -x output"
+}
+x_flag_body()
+{
+	atf_check -o file:"$(atf_get_srcdir)/d_hexdump_xflag_a.out" \
+	    hexdump -x "$(atf_get_srcdir)/d_hexdump_a.in"
+	atf_check -o file:"$(atf_get_srcdir)/d_hexdump_xflag_b.out" \
+	    hexdump -x "$(atf_get_srcdir)/d_hexdump_b.in"
+	atf_check -o file:"$(atf_get_srcdir)/d_hexdump_xflag_c.out" \
+	    hexdump -x "$(atf_get_srcdir)/d_hexdump_c.in"
+}
+
+atf_init_test_cases()
+{
+	atf_add_test_case b_flag
+	atf_add_test_case c_flag
+	atf_add_test_case C_flag
+	atf_add_test_case hd_name
+	atf_add_test_case d_flag
+	atf_add_test_case n_flag
+	atf_add_test_case o_flag
+	atf_add_test_case s_flag
+	atf_add_test_case v_flag
+	atf_add_test_case x_flag
+}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201707130352.v6D3qsXX049061>