From 45b1ca8eb045c87307deed1dfe1497314d64cbd6 Mon Sep 17 00:00:00 2001 From: Ruediger Meier Date: Wed, 11 Jun 2014 15:36:42 +0200 Subject: 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 --- tests/ts/utmp/utmp_functions.sh | 18 ++++++++++++++++++ tests/ts/utmp/utmpdump-tobin | 5 ++--- tests/ts/utmp/utmpdump-tobin-ipv6 | 5 ++--- tests/ts/utmp/utmpdump-totxt | 5 ++--- tests/ts/utmp/utmpdump-totxt-ipv6 | 5 ++--- 5 files changed, 26 insertions(+), 12 deletions(-) create mode 100644 tests/ts/utmp/utmp_functions.sh (limited to 'tests/ts') 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 -- cgit v1.2.3-55-g7522