From: Thomas Weißschuh Date: Fri, 18 Nov 2022 16:40:15 +0000 (+0100) Subject: tests: add ts_check_native_byteorder X-Git-Tag: v2.39-rc1~367^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=104b265f5f45f1faa9f1275767536d3187115e47;p=thirdparty%2Futil-linux.git tests: add ts_check_native_byteorder 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. --- diff --git a/tests/functions.sh b/tests/functions.sh index 22bfc24c93..708296f4ee 100644 --- a/tests/functions.sh +++ b/tests/functions.sh @@ -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)" } diff --git a/tests/ts/lsfd/mkfds-tcp b/tests/ts/lsfd/mkfds-tcp index f74333f644..259b520c3a 100755 --- a/tests/ts/lsfd/mkfds-tcp +++ b/tests/ts/lsfd/mkfds-tcp @@ -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" diff --git a/tests/ts/lsfd/mkfds-udp b/tests/ts/lsfd/mkfds-udp index 5ac30c60b6..7c97ab42b8 100755 --- a/tests/ts/lsfd/mkfds-udp +++ b/tests/ts/lsfd/mkfds-udp @@ -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"