]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: skip utmpdump tests for exotic archs
authorRuediger Meier <ruediger.meier@ga-group.nl>
Wed, 11 Jun 2014 13:36:42 +0000 (15:36 +0200)
committerRuediger Meier <ruediger.meier@ga-group.nl>
Wed, 11 Jun 2014 23:09:04 +0000 (01:09 +0200)
We introduce utmp_functions.sh and skip tests if size of utmp struct
does not match our wtmp test data.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
tests/ts/utmp/utmp_functions.sh [new file with mode: 0644]
tests/ts/utmp/utmpdump-tobin
tests/ts/utmp/utmpdump-tobin-ipv6
tests/ts/utmp/utmpdump-totxt
tests/ts/utmp/utmpdump-totxt-ipv6

diff --git a/tests/ts/utmp/utmp_functions.sh b/tests/ts/utmp/utmp_functions.sh
new file mode 100644 (file)
index 0000000..74a100c
--- /dev/null
@@ -0,0 +1,18 @@
+ts_check_test_command "$TS_CMD_UTMPDUMP"
+ts_check_test_command "$TS_HELPER_SYSINFO"
+
+function utmp_struct_size {
+       local size
+       # probably "utmpdump -r" could be improved regarding white spaces ...
+       local txt="[0] [00000] [    ] [        ] [            ] [                    ] [0.0.0.0        ] [                            ]"
+
+       size=$(echo "$txt" | "$TS_CMD_UTMPDUMP" -r 2>/dev/null | wc -c \
+               && exit ${PIPESTATUS[1]})
+       ret=$?
+       [ $ret -eq 0 ] || size="0"
+       echo "$size"
+       return $ret
+}
+
+BYTE_ORDER=$($TS_HELPER_SYSINFO byte-order) || ts_failed "byte-order failed"
+SIZEOF_UTMP=$(utmp_struct_size) || ts_failed "utmp_struct_size failed"
index 9caa8df0b342c429bfb502547e29cb8032c4dbb3..2f14bfc149d2408f9c5c15748437db1afc919f9f 100755 (executable)
@@ -18,9 +18,8 @@ TS_DESC="to binary"
 . $TS_TOPDIR/functions.sh
 ts_init "$*"
 
-ts_check_test_command "$TS_CMD_UTMPDUMP"
-
-BYTE_ORDER=$($TS_HELPER_SYSINFO byte-order)
+. "$TS_SELF/utmp_functions.sh"
+[ $SIZEOF_UTMP -eq 384 ] || ts_skip "utmp struct size $SIZEOF_UTMP"
 
 export LANG=C
 export TZ=GMT
index 4686574558c1ef893352a191258a589d8e866a4e..e0b19cd1300b02c0e73dac4cc01b2f1a4a21a8e7 100755 (executable)
@@ -18,9 +18,8 @@ TS_DESC="IPv6 to binary"
 . $TS_TOPDIR/functions.sh
 ts_init "$*"
 
-ts_check_test_command "$TS_CMD_UTMPDUMP"
-
-BYTE_ORDER=$($TS_HELPER_SYSINFO byte-order)
+. "$TS_SELF/utmp_functions.sh"
+[ $SIZEOF_UTMP -eq 384 ] || ts_skip "utmp struct size $SIZEOF_UTMP"
 
 export LANG=C
 export TZ=GMT
index 50259110cf94fee3ec3b9b36661e4ff55967d7fa..37d376a8ba822d27b2d02dcca8fde1e57c08f0d7 100755 (executable)
@@ -18,9 +18,8 @@ TS_DESC="to text"
 . $TS_TOPDIR/functions.sh
 ts_init "$*"
 
-ts_check_test_command "$TS_CMD_UTMPDUMP"
-
-BYTE_ORDER=$($TS_HELPER_SYSINFO byte-order)
+. "$TS_SELF/utmp_functions.sh"
+[ $SIZEOF_UTMP -eq 384 ] || ts_skip "utmp struct size $SIZEOF_UTMP"
 
 export LANG=C
 export TZ=GMT
index 7ef61803faf3f0c09e81d0c6f4d964dba59a75a6..1b217838637bd414104d8de6603e7a55b5dc4ec4 100755 (executable)
@@ -18,9 +18,8 @@ TS_DESC="IPv6 to text"
 . $TS_TOPDIR/functions.sh
 ts_init "$*"
 
-ts_check_test_command "$TS_CMD_UTMPDUMP"
-
-BYTE_ORDER=$($TS_HELPER_SYSINFO byte-order)
+. "$TS_SELF/utmp_functions.sh"
+[ $SIZEOF_UTMP -eq 384 ] || ts_skip "utmp struct size $SIZEOF_UTMP"
 
 export LANG=C
 export TZ=GMT