From 104b265f5f45f1faa9f1275767536d3187115e47 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thomas=20Wei=C3=9Fschuh?= Date: Fri, 18 Nov 2022 17:40:15 +0100 Subject: [PATCH] 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. --- tests/functions.sh | 6 ++++++ tests/ts/lsfd/mkfds-tcp | 2 +- tests/ts/lsfd/mkfds-udp | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) 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" -- 2.47.3