svn commit: r358553 - head/usr.bin/hexdump/tests
Kyle Evans
kevans at FreeBSD.org
Mon Mar 2 18:40:40 UTC 2020
Author: kevans
Date: Mon Mar 2 18:40:34 2020
New Revision: 358553
URL: https://svnweb.freebsd.org/changeset/base/358553
Log:
hexdump: tests: take into account byte order
Hexdump test was failling on big endian systems when testing decimal, octal
and hexa outputs as the tests were designed on a little endian system. This
revision adds the two distinct flavors of output expected and determines at
runtime which to compare against.
Submitted by: Renato Riolino <renato.riolino_eldorado.org.br>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D23191
Added:
head/usr.bin/hexdump/tests/d_hexdump_dflag_a_eb.out (contents, props changed)
head/usr.bin/hexdump/tests/d_hexdump_dflag_a_el.out
- copied unchanged from r358552, head/usr.bin/hexdump/tests/d_hexdump_dflag_a.out
head/usr.bin/hexdump/tests/d_hexdump_dflag_b_eb.out (contents, props changed)
head/usr.bin/hexdump/tests/d_hexdump_dflag_b_el.out
- copied unchanged from r358552, head/usr.bin/hexdump/tests/d_hexdump_dflag_b.out
head/usr.bin/hexdump/tests/d_hexdump_dflag_c_eb.out (contents, props changed)
- copied, changed from r358552, head/usr.bin/hexdump/tests/d_hexdump_dflag_c.out
head/usr.bin/hexdump/tests/d_hexdump_dflag_c_el.out
- copied unchanged from r358552, head/usr.bin/hexdump/tests/d_hexdump_dflag_c.out
head/usr.bin/hexdump/tests/d_hexdump_oflag_a_eb.out (contents, props changed)
head/usr.bin/hexdump/tests/d_hexdump_oflag_a_el.out
- copied unchanged from r358552, head/usr.bin/hexdump/tests/d_hexdump_oflag_a.out
head/usr.bin/hexdump/tests/d_hexdump_oflag_b_eb.out (contents, props changed)
head/usr.bin/hexdump/tests/d_hexdump_oflag_b_el.out
- copied unchanged from r358552, head/usr.bin/hexdump/tests/d_hexdump_oflag_b.out
head/usr.bin/hexdump/tests/d_hexdump_oflag_c_eb.out (contents, props changed)
- copied, changed from r358552, head/usr.bin/hexdump/tests/d_hexdump_oflag_c.out
head/usr.bin/hexdump/tests/d_hexdump_oflag_c_el.out
- copied unchanged from r358552, head/usr.bin/hexdump/tests/d_hexdump_oflag_c.out
head/usr.bin/hexdump/tests/d_hexdump_xflag_a_eb.out (contents, props changed)
head/usr.bin/hexdump/tests/d_hexdump_xflag_a_el.out
- copied unchanged from r358552, head/usr.bin/hexdump/tests/d_hexdump_xflag_a.out
head/usr.bin/hexdump/tests/d_hexdump_xflag_b_eb.out (contents, props changed)
head/usr.bin/hexdump/tests/d_hexdump_xflag_b_el.out
- copied unchanged from r358552, head/usr.bin/hexdump/tests/d_hexdump_xflag_b.out
head/usr.bin/hexdump/tests/d_hexdump_xflag_c_eb.out (contents, props changed)
- copied, changed from r358552, head/usr.bin/hexdump/tests/d_hexdump_xflag_c.out
head/usr.bin/hexdump/tests/d_hexdump_xflag_c_el.out
- copied unchanged from r358552, head/usr.bin/hexdump/tests/d_hexdump_xflag_c.out
Deleted:
head/usr.bin/hexdump/tests/d_hexdump_dflag_a.out
head/usr.bin/hexdump/tests/d_hexdump_dflag_b.out
head/usr.bin/hexdump/tests/d_hexdump_dflag_c.out
head/usr.bin/hexdump/tests/d_hexdump_oflag_a.out
head/usr.bin/hexdump/tests/d_hexdump_oflag_b.out
head/usr.bin/hexdump/tests/d_hexdump_oflag_c.out
head/usr.bin/hexdump/tests/d_hexdump_xflag_a.out
head/usr.bin/hexdump/tests/d_hexdump_xflag_b.out
head/usr.bin/hexdump/tests/d_hexdump_xflag_c.out
Modified:
head/usr.bin/hexdump/tests/Makefile
head/usr.bin/hexdump/tests/hexdump_test.sh
Modified: head/usr.bin/hexdump/tests/Makefile
==============================================================================
--- head/usr.bin/hexdump/tests/Makefile Mon Mar 2 18:06:02 2020 (r358552)
+++ head/usr.bin/hexdump/tests/Makefile Mon Mar 2 18:40:34 2020 (r358553)
@@ -13,20 +13,29 @@ ${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_dflag_a_el.out
+${PACKAGE}FILES+= d_hexdump_dflag_b_el.out
+${PACKAGE}FILES+= d_hexdump_dflag_c_el.out
+${PACKAGE}FILES+= d_hexdump_dflag_a_eb.out
+${PACKAGE}FILES+= d_hexdump_dflag_b_eb.out
+${PACKAGE}FILES+= d_hexdump_dflag_c_eb.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_oflag_a_el.out
+${PACKAGE}FILES+= d_hexdump_oflag_b_el.out
+${PACKAGE}FILES+= d_hexdump_oflag_c_el.out
+${PACKAGE}FILES+= d_hexdump_oflag_a_eb.out
+${PACKAGE}FILES+= d_hexdump_oflag_b_eb.out
+${PACKAGE}FILES+= d_hexdump_oflag_c_eb.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
+${PACKAGE}FILES+= d_hexdump_xflag_a_el.out
+${PACKAGE}FILES+= d_hexdump_xflag_b_el.out
+${PACKAGE}FILES+= d_hexdump_xflag_c_el.out
+${PACKAGE}FILES+= d_hexdump_xflag_a_eb.out
+${PACKAGE}FILES+= d_hexdump_xflag_b_eb.out
+${PACKAGE}FILES+= d_hexdump_xflag_c_eb.out
${PACKAGE}FILES+= d_od_cflag_a.out
${PACKAGE}FILES+= d_od_cflag_b.out
Added: head/usr.bin/hexdump/tests/d_hexdump_dflag_a_eb.out
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/usr.bin/hexdump/tests/d_hexdump_dflag_a_eb.out Mon Mar 2 18:40:34 2020 (r358553)
@@ -0,0 +1,2 @@
+0000000 21605 29556 02560
+0000005
Copied: head/usr.bin/hexdump/tests/d_hexdump_dflag_a_el.out (from r358552, 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_el.out Mon Mar 2 18:40:34 2020 (r358553, copy of r358552, head/usr.bin/hexdump/tests/d_hexdump_dflag_a.out)
@@ -0,0 +1,2 @@
+0000000 25940 29811 00010
+0000005
Added: head/usr.bin/hexdump/tests/d_hexdump_dflag_b_eb.out
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/usr.bin/hexdump/tests/d_hexdump_dflag_b_eb.out Mon Mar 2 18:40:34 2020 (r358553)
@@ -0,0 +1,4 @@
+0000000 21608 25888 29045 26979 27424 25202 28535 28192
+0000010 26223 30752 27253 28016 25956 08303 30309 29216
+0000020 29800 25888 25196 30053 08296 28533 29541 02570
+0000030
Copied: head/usr.bin/hexdump/tests/d_hexdump_dflag_b_el.out (from r358552, 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_el.out Mon Mar 2 18:40:34 2020 (r358553, copy of r358552, head/usr.bin/hexdump/tests/d_hexdump_dflag_b.out)
@@ -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
Copied and modified: head/usr.bin/hexdump/tests/d_hexdump_dflag_c_eb.out (from r358552, head/usr.bin/hexdump/tests/d_hexdump_dflag_c.out)
==============================================================================
--- head/usr.bin/hexdump/tests/d_hexdump_dflag_c.out Mon Mar 2 18:06:02 2020 (r358552, copy source)
+++ head/usr.bin/hexdump/tests/d_hexdump_dflag_c_eb.out Mon Mar 2 18:40:34 2020 (r358553)
@@ -1,4 +1,4 @@
0000000 16705 16705 16705 16705 16705 16705 16705 16705
*
-0000020 16705 16705 16705 02625
+0000020 16705 16705 16705 16650
0000028
Copied: head/usr.bin/hexdump/tests/d_hexdump_dflag_c_el.out (from r358552, 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_el.out Mon Mar 2 18:40:34 2020 (r358553, copy of r358552, head/usr.bin/hexdump/tests/d_hexdump_dflag_c.out)
@@ -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_oflag_a_eb.out
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/usr.bin/hexdump/tests/d_hexdump_oflag_a_eb.out Mon Mar 2 18:40:34 2020 (r358553)
@@ -0,0 +1,2 @@
+0000000 052145 071564 005000
+0000005
Copied: head/usr.bin/hexdump/tests/d_hexdump_oflag_a_el.out (from r358552, 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_el.out Mon Mar 2 18:40:34 2020 (r358553, copy of r358552, head/usr.bin/hexdump/tests/d_hexdump_oflag_a.out)
@@ -0,0 +1,2 @@
+0000000 062524 072163 000012
+0000005
Added: head/usr.bin/hexdump/tests/d_hexdump_oflag_b_eb.out
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/usr.bin/hexdump/tests/d_hexdump_oflag_b_eb.out Mon Mar 2 18:40:34 2020 (r358553)
@@ -0,0 +1,4 @@
+0000000 052150 062440 070565 064543 065440 061162 067567 067040
+0000010 063157 074040 065165 066560 062544 020157 073145 071040
+0000020 072150 062440 061154 072545 020150 067565 071545 005012
+0000030
Copied: head/usr.bin/hexdump/tests/d_hexdump_oflag_b_el.out (from r358552, 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_el.out Mon Mar 2 18:40:34 2020 (r358553, copy of r358552, head/usr.bin/hexdump/tests/d_hexdump_oflag_b.out)
@@ -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
Copied and modified: head/usr.bin/hexdump/tests/d_hexdump_oflag_c_eb.out (from r358552, head/usr.bin/hexdump/tests/d_hexdump_oflag_c.out)
==============================================================================
--- head/usr.bin/hexdump/tests/d_hexdump_oflag_c.out Mon Mar 2 18:06:02 2020 (r358552, copy source)
+++ head/usr.bin/hexdump/tests/d_hexdump_oflag_c_eb.out Mon Mar 2 18:40:34 2020 (r358553)
@@ -1,4 +1,4 @@
0000000 040501 040501 040501 040501 040501 040501 040501 040501
*
-0000020 040501 040501 040501 005101
+0000020 040501 040501 040501 040412
0000028
Copied: head/usr.bin/hexdump/tests/d_hexdump_oflag_c_el.out (from r358552, 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_el.out Mon Mar 2 18:40:34 2020 (r358553, copy of r358552, head/usr.bin/hexdump/tests/d_hexdump_oflag_c.out)
@@ -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_xflag_a_eb.out
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/usr.bin/hexdump/tests/d_hexdump_xflag_a_eb.out Mon Mar 2 18:40:34 2020 (r358553)
@@ -0,0 +1,2 @@
+0000000 5465 7374 0a00
+0000005
Copied: head/usr.bin/hexdump/tests/d_hexdump_xflag_a_el.out (from r358552, 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_el.out Mon Mar 2 18:40:34 2020 (r358553, copy of r358552, head/usr.bin/hexdump/tests/d_hexdump_xflag_a.out)
@@ -0,0 +1,2 @@
+0000000 6554 7473 000a
+0000005
Added: head/usr.bin/hexdump/tests/d_hexdump_xflag_b_eb.out
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/usr.bin/hexdump/tests/d_hexdump_xflag_b_eb.out Mon Mar 2 18:40:34 2020 (r358553)
@@ -0,0 +1,4 @@
+0000000 5468 6520 7175 6963 6b20 6272 6f77 6e20
+0000010 666f 7820 6a75 6d70 6564 206f 7665 7220
+0000020 7468 6520 626c 7565 2068 6f75 7365 0a0a
+0000030
Copied: head/usr.bin/hexdump/tests/d_hexdump_xflag_b_el.out (from r358552, 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_el.out Mon Mar 2 18:40:34 2020 (r358553, copy of r358552, head/usr.bin/hexdump/tests/d_hexdump_xflag_b.out)
@@ -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
Copied and modified: head/usr.bin/hexdump/tests/d_hexdump_xflag_c_eb.out (from r358552, head/usr.bin/hexdump/tests/d_hexdump_xflag_c.out)
==============================================================================
--- head/usr.bin/hexdump/tests/d_hexdump_xflag_c.out Mon Mar 2 18:06:02 2020 (r358552, copy source)
+++ head/usr.bin/hexdump/tests/d_hexdump_xflag_c_eb.out Mon Mar 2 18:40:34 2020 (r358553)
@@ -1,4 +1,4 @@
0000000 4141 4141 4141 4141 4141 4141 4141 4141
*
-0000020 4141 4141 4141 0a41
+0000020 4141 4141 4141 410a
0000028
Copied: head/usr.bin/hexdump/tests/d_hexdump_xflag_c_el.out (from r358552, 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_el.out Mon Mar 2 18:40:34 2020 (r358553, copy of r358552, head/usr.bin/hexdump/tests/d_hexdump_xflag_c.out)
@@ -0,0 +1,4 @@
+0000000 4141 4141 4141 4141 4141 4141 4141 4141
+*
+0000020 4141 4141 4141 0a41
+0000028
Modified: head/usr.bin/hexdump/tests/hexdump_test.sh
==============================================================================
--- head/usr.bin/hexdump/tests/hexdump_test.sh Mon Mar 2 18:06:02 2020 (r358552)
+++ head/usr.bin/hexdump/tests/hexdump_test.sh Mon Mar 2 18:40:34 2020 (r358553)
@@ -26,6 +26,12 @@
#
# $FreeBSD$
+ENDIAN=el
+ret=$(echo I | tr -d "[:space:]" | od -to2 | head -n1 | awk '{print $2}' | cut -c6)
+if [ "$ret" = "0" ]; then
+ ENDIAN=eb
+fi
+
atf_test_case b_flag
b_flag_head()
{
@@ -93,11 +99,11 @@ d_flag_head()
}
d_flag_body()
{
- atf_check -o file:"$(atf_get_srcdir)/d_hexdump_dflag_a.out" \
+ atf_check -o file:"$(atf_get_srcdir)/d_hexdump_dflag_a_$ENDIAN.out" \
hexdump -d "$(atf_get_srcdir)/d_hexdump_a.in"
- atf_check -o file:"$(atf_get_srcdir)/d_hexdump_dflag_b.out" \
+ atf_check -o file:"$(atf_get_srcdir)/d_hexdump_dflag_b_$ENDIAN.out" \
hexdump -d "$(atf_get_srcdir)/d_hexdump_b.in"
- atf_check -o file:"$(atf_get_srcdir)/d_hexdump_dflag_c.out" \
+ atf_check -o file:"$(atf_get_srcdir)/d_hexdump_dflag_c_$ENDIAN.out" \
hexdump -d "$(atf_get_srcdir)/d_hexdump_c.in"
}
@@ -120,11 +126,11 @@ o_flag_head()
}
o_flag_body()
{
- atf_check -o file:"$(atf_get_srcdir)/d_hexdump_oflag_a.out" \
+ atf_check -o file:"$(atf_get_srcdir)/d_hexdump_oflag_a_$ENDIAN.out" \
hexdump -o "$(atf_get_srcdir)/d_hexdump_a.in"
- atf_check -o file:"$(atf_get_srcdir)/d_hexdump_oflag_b.out" \
+ atf_check -o file:"$(atf_get_srcdir)/d_hexdump_oflag_b_$ENDIAN.out" \
hexdump -o "$(atf_get_srcdir)/d_hexdump_b.in"
- atf_check -o file:"$(atf_get_srcdir)/d_hexdump_oflag_c.out" \
+ atf_check -o file:"$(atf_get_srcdir)/d_hexdump_oflag_c_$ENDIAN.out" \
hexdump -o "$(atf_get_srcdir)/d_hexdump_c.in"
}
@@ -168,11 +174,11 @@ x_flag_head()
}
x_flag_body()
{
- atf_check -o file:"$(atf_get_srcdir)/d_hexdump_xflag_a.out" \
+ atf_check -o file:"$(atf_get_srcdir)/d_hexdump_xflag_a_$ENDIAN.out" \
hexdump -x "$(atf_get_srcdir)/d_hexdump_a.in"
- atf_check -o file:"$(atf_get_srcdir)/d_hexdump_xflag_b.out" \
+ atf_check -o file:"$(atf_get_srcdir)/d_hexdump_xflag_b_$ENDIAN.out" \
hexdump -x "$(atf_get_srcdir)/d_hexdump_b.in"
- atf_check -o file:"$(atf_get_srcdir)/d_hexdump_xflag_c.out" \
+ atf_check -o file:"$(atf_get_srcdir)/d_hexdump_xflag_c_$ENDIAN.out" \
hexdump -x "$(atf_get_srcdir)/d_hexdump_c.in"
}
More information about the svn-src-head
mailing list