util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tests: fix fdisk/bsd for the two possible sectors/offsets
@ 2014-08-14 22:26 Aurelien Jarno
  2014-08-20  9:46 ` Karel Zak
  0 siblings, 1 reply; 2+ messages in thread
From: Aurelien Jarno @ 2014-08-14 22:26 UTC (permalink / raw)
  To: Karel Zak, util-linux; +Cc: Aurelien Jarno, Andreas Henriksson

BSD disklabels depend on the endianess, but also on the architecture as
one can see in include/pt-bsd.h with the BSD_LABELSECTOR and
BSD_LABELOFFSET #define. This cause the testsuite to fail on the
affected architectures as the disk image is not the same as the expected
result.

Commit 180b3a7e tried to fix the endianess, but the special PowerPC case
has been chosen as a reference, so it still fails for example on MIPS BE
or S/390.

This patch fixes the testsuite by converting the md5sums to the expected
values, still depending on the endianess, but also for the two possible
sectors/offsets. This has been tested on Alpha, MIPS, PowerPC and x86-64,
so this should cover all 4 cases.

Cc: Andreas Henriksson <andreas@fatal.se>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 tests/ts/fdisk/bsd | 33 +++++++++++++++++++++++++--------
 1 file changed, 25 insertions(+), 8 deletions(-)

diff --git a/tests/ts/fdisk/bsd b/tests/ts/fdisk/bsd
index be44b63..d5ec215 100755
--- a/tests/ts/fdisk/bsd
+++ b/tests/ts/fdisk/bsd
@@ -39,15 +39,32 @@ FDISK_CMD_BSD_LIST_TYPES="b\nl\nq\n"         # list supported PT types and quit
 
 #set -x
 
-# BSD disklabel depends on endianess
+# BSD disklabel depends on sector/offset and endianess. We convert the md5sums
+# into the most common values (little endian, BSD_LABELSECTOR = 1, 
+# BSD_LABELOFFSET = 0) so that they can be easily compared to the expected
+# ones.
 BYTE_ORDER=$($TS_HELPER_SYSINFO byte-order)
-function fdisk_bsd_byte_order_clean
+function fdisk_bsd_offset_and_byte_order_clean
 {
-	[ $BYTE_ORDER = "BE" ] || return
-	sed -i \
-	-e "s/c2273b52976351db75596c47c10b0725/2e1cee529cb59c9341afef0443f196a1/" \
-	-e "s/9a234a5b99e37d2ce0d92b65437b93cd/b5c121c2091b2ff26b880551feac7112/" \
-	"$TS_OUTPUT"
+        if [ $BYTE_ORDER = "BE" ] ; then
+		# BSD_LABELSECTOR = 0, BSD_LABELOFFSET = 64
+		sed -i \
+		-e "s/c2273b52976351db75596c47c10b0725/2e1cee529cb59c9341afef0443f196a1/" \
+		-e "s/9a234a5b99e37d2ce0d92b65437b93cd/b5c121c2091b2ff26b880551feac7112/" \
+		"$TS_OUTPUT"
+
+		# BSD_LABELSECTOR = 1, BSD_LABELOFFSET = 0
+		sed -i \
+		-e "s/e990c8a1c2106a4cd4b008f16d71aaa6/2e1cee529cb59c9341afef0443f196a1/" \
+		-e "s/187a48c26e83d146b866868addc93702/b5c121c2091b2ff26b880551feac7112/" \
+		"$TS_OUTPUT"
+	else
+		# BSD_LABELSECTOR = 0, BSD_LABELOFFSET = 64
+		sed -i \
+		-e "s/78a922a80361cb73049bced72e0f8f1d/2e1cee529cb59c9341afef0443f196a1/" \
+		-e "s/fc2803672a0643ffe46da325629616fc/b5c121c2091b2ff26b880551feac7112/" \
+		"$TS_OUTPUT"
+	fi
 }
 
 function print_layout {
@@ -113,6 +130,6 @@ echo -e "${FDISK_CMD_BSD_LIST_TYPES}" | \
 	$TS_CMD_FDISK ${TEST_IMAGE_NAME} | \
 	sed 's/Reading .*//g; s/Welcome to fdisk .*//' >> $TS_OUTPUT 2>&1
 
-fdisk_bsd_byte_order_clean
+fdisk_bsd_offset_and_byte_order_clean
 ts_fdisk_clean ${TEST_IMAGE_NAME}
 ts_finalize
-- 
2.0.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] tests: fix fdisk/bsd for the two possible sectors/offsets
  2014-08-14 22:26 [PATCH] tests: fix fdisk/bsd for the two possible sectors/offsets Aurelien Jarno
@ 2014-08-20  9:46 ` Karel Zak
  0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2014-08-20  9:46 UTC (permalink / raw)
  To: Aurelien Jarno; +Cc: util-linux, Andreas Henriksson

On Fri, Aug 15, 2014 at 12:26:24AM +0200, Aurelien Jarno wrote:
>  tests/ts/fdisk/bsd | 33 +++++++++++++++++++++++++--------
>  1 file changed, 25 insertions(+), 8 deletions(-)

 Applied, thanks.

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-08-20  9:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-14 22:26 [PATCH] tests: fix fdisk/bsd for the two possible sectors/offsets Aurelien Jarno
2014-08-20  9:46 ` Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).