[PATCH] mkfs.minix.tests: fix the tests on big endian platform.
Yao Zhao
yao.zhao at windriver.com
Fri Jul 20 19:11:05 UTC 2012
minix filesystem will have a different md5sum if run on a big endian
platform as it is endian dependent filesystem.
Change test script to have correct md5sum on big endian platform.
Signed-off-by: Yao Zhao <yao.zhao at windriver.com>
---
testsuite/mkfs.minix.tests | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/testsuite/mkfs.minix.tests b/testsuite/mkfs.minix.tests
index 8a33c16..73cd913 100755
--- a/testsuite/mkfs.minix.tests
+++ b/testsuite/mkfs.minix.tests
@@ -8,7 +8,19 @@
# testing "test name" "options" "expected result" "file input" "stdin"
-testing "mkfs.minix" \
+# 'a' ascii is 0x61, on little endian is 97, on big endian is 1627389952
+get_a_value="$(echo -n "a" | od -i | head -1 | sed -e 's/ \+/ /g' | \
+ cut -d " " -f 2)"
+endian=0
+if [ "97" = "$get_a_value" ]; then
+ echo "little endian platform"
+else
+ echo "big endian platform"
+ endian=1
+fi
+
+if [ $endian -eq 0 ]; then
+ testing "mkfs.minix" \
"dd if=/dev/zero of=input bs=1k count=1024 2>/dev/null; mkfs.minix input; md5sum <input" \
"352 inodes\n"\
"1024 blocks\n"\
@@ -18,5 +30,17 @@ testing "mkfs.minix" \
"4f35f7afeba07d56055bed1f29ae20b7 -\n" \
"" \
""
+else
+ testing "mkfs.minix" \
+ "dd if=/dev/zero of=input bs=1k count=1024 2>/dev/null; mkfs.minix input; md5sum <input" \
+"352 inodes\n"\
+"1024 blocks\n"\
+"Firstdatazone=15 (15)\n"\
+"Zonesize=1024\n"\
+"Maxsize=268966912\n"\
+"5adbc1b3ccd20ca5d0ab5bc1e13ac3fc -\n" \
+ "" \
+ ""
+fi
exit $FAILCOUNT
--
1.7.9.5
More information about the busybox
mailing list