summaryrefslogtreecommitdiffstats
path: root/tests/ts/utmp
diff options
context:
space:
mode:
authorRuediger Meier2014-06-11 15:36:42 +0200
committerRuediger Meier2014-06-12 01:09:04 +0200
commit45b1ca8eb045c87307deed1dfe1497314d64cbd6 (patch)
treea958d07c87587a8068338f7b55c9f57c48401eca /tests/ts/utmp
parenttests: merge last/ and utmpdump/ into new utmp/ dir (diff)
downloadkernel-qcow2-util-linux-45b1ca8eb045c87307deed1dfe1497314d64cbd6.tar.gz
kernel-qcow2-util-linux-45b1ca8eb045c87307deed1dfe1497314d64cbd6.tar.xz
kernel-qcow2-util-linux-45b1ca8eb045c87307deed1dfe1497314d64cbd6.zip
tests: skip utmpdump tests for exotic archs
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>
Diffstat (limited to 'tests/ts/utmp')
-rw-r--r--tests/ts/utmp/utmp_functions.sh18
-rwxr-xr-xtests/ts/utmp/utmpdump-tobin5
-rwxr-xr-xtests/ts/utmp/utmpdump-tobin-ipv65
-rwxr-xr-xtests/ts/utmp/utmpdump-totxt5
-rwxr-xr-xtests/ts/utmp/utmpdump-totxt-ipv65
5 files changed, 26 insertions, 12 deletions
diff --git a/tests/ts/utmp/utmp_functions.sh b/tests/ts/utmp/utmp_functions.sh
new file mode 100644
index 000000000..74a100ce8
--- /dev/null
+++ b/tests/ts/utmp/utmp_functions.sh
@@ -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"
diff --git a/tests/ts/utmp/utmpdump-tobin b/tests/ts/utmp/utmpdump-tobin
index 9caa8df0b..2f14bfc14 100755
--- a/tests/ts/utmp/utmpdump-tobin
+++ b/tests/ts/utmp/utmpdump-tobin
@@ -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
diff --git a/tests/ts/utmp/utmpdump-tobin-ipv6 b/tests/ts/utmp/utmpdump-tobin-ipv6
index 468657455..e0b19cd13 100755
--- a/tests/ts/utmp/utmpdump-tobin-ipv6
+++ b/tests/ts/utmp/utmpdump-tobin-ipv6
@@ -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
diff --git a/tests/ts/utmp/utmpdump-totxt b/tests/ts/utmp/utmpdump-totxt
index 50259110c..37d376a8b 100755
--- a/tests/ts/utmp/utmpdump-totxt
+++ b/tests/ts/utmp/utmpdump-totxt
@@ -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
diff --git a/tests/ts/utmp/utmpdump-totxt-ipv6 b/tests/ts/utmp/utmpdump-totxt-ipv6
index 7ef61803f..1b2178386 100755
--- a/tests/ts/utmp/utmpdump-totxt-ipv6
+++ b/tests/ts/utmp/utmpdump-totxt-ipv6
@@ -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