]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: add ts_check_native_byteorder
authorThomas Weißschuh <thomas@t-8ch.de>
Fri, 18 Nov 2022 16:40:15 +0000 (17:40 +0100)
committerThomas Weißschuh <thomas@t-8ch.de>
Sun, 27 Nov 2022 15:11:29 +0000 (16:11 +0100)
This can be used to skip tests that require that the machine executing
the tests has the same byteorder as the test executable.

Useful for tests emulated with qemu-user.

tests/functions.sh
tests/ts/lsfd/mkfds-tcp
tests/ts/lsfd/mkfds-udp

index 22bfc24c9368719f3cd8630e17edc1a32a969232..708296f4ee70cd934030fecb869e45d982905615 100644 (file)
@@ -126,6 +126,12 @@ function ts_check_wcsspn {
        fi
 }
 
+function ts_check_native_byteorder {
+       if [ "$QEMU_USER" == "1" ] && [ ! -e /sys/kernel/cpu_byteorder ]; then
+               ts_skip "non-native byteorder"
+       fi
+}
+
 function ts_report_skip {
        ts_report " SKIPPED ($1)"
 }
index f74333f644b2ad48b77c0675d247ffff8d093f39..259b520c3a55fb68d824fd7c893abba1fafe6675 100755 (executable)
@@ -22,7 +22,7 @@ ts_init "$*"
 
 ts_check_test_command "$TS_CMD_LSFD"
 ts_check_test_command "$TS_HELPER_MKFDS"
-ts_skip_qemu_user
+ts_check_native_byteorder
 
 ts_cd "$TS_OUTDIR"
 
index 5ac30c60b6160d53095e96881f12d437983ab2d5..7c97ab42b8440644420afaf0f2a4894fbed238e5 100755 (executable)
@@ -22,7 +22,7 @@ ts_init "$*"
 
 ts_check_test_command "$TS_CMD_LSFD"
 ts_check_test_command "$TS_HELPER_MKFDS"
-ts_skip_qemu_user
+ts_check_native_byteorder
 
 ts_cd "$TS_OUTDIR"