sigwaittest: Test sigwait() latency
Add sigwaittest from the rt-tests suite (>= v1.4).
The x86_64 and armeabi architecture binaries are build using a Debian
stretch root filesystem.
arm64 binaries were build using a Debian buster root filesystem.
The command to build the binaries is: "CLFAGS=-static make"
Signed-off-by: Daniel Wagner <wagi@monom.org>
diff --git a/automated/linux/sigwaittest/sigwaittest.sh b/automated/linux/sigwaittest/sigwaittest.sh
new file mode 100755
index 0000000..ac6c2ae
--- /dev/null
+++ b/automated/linux/sigwaittest/sigwaittest.sh
@@ -0,0 +1,44 @@
+#!/bin/sh -e
+# shellcheck disable=SC1090
+# shellcheck disable=SC2154
+# sigwaittest starts two threads or, optionally, forks two processes that
+# are synchronized via signals and measures the latency between sending
+# a signal and returning from sigwait()
+
+TEST_DIR=$(dirname "$(realpath "$0")")
+OUTPUT="${TEST_DIR}/output"
+LOGFILE="${OUTPUT}/sigwaittest.log"
+RESULT_FILE="${OUTPUT}/result.txt"
+DURATION="5m"
+MAX_LATENCY="100"
+
+usage() {
+ echo "Usage: $0 [-D duration] [-m latency]" 1>&2
+ exit 1
+}
+
+while getopts ":D:m:" opt; do
+ case "${opt}" in
+ D) DURATION="${OPTARG}" ;;
+ m) MAX_LATENCY="${OPTARG}" ;;
+ *) usage ;;
+ esac
+done
+
+. "${TEST_DIR}/../../lib/sh-test-lib"
+
+! check_root && error_msg "Please run this script as root."
+create_out_dir "${OUTPUT}"
+
+# Run sigwaittest.
+if ! binary=$(command -v sigwaittest); then
+ detect_abi
+ # shellcheck disable=SC2154
+ binary="./bin/${abi}/sigwaittest"
+fi
+
+"${binary}" -t -a -p 98 -D "${DURATION}" | tee "${LOGFILE}"
+
+# Parse test log.
+../../lib/parse_rt_tests_results.py sigwaittest "${LOGFILE}" "${MAX_LATENCY}" \
+ | tee -a "${RESULT_FILE}"