summaryrefslogtreecommitdiffstats
path: root/debian/tests/upstream-simulation-test-suite
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 17:35:04 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 17:35:04 +0000
commit214f81cd9b7c94c10b633627034c21daaee837b2 (patch)
tree63f193ca9b27d4095af5ac000565ef928ddbb5f6 /debian/tests/upstream-simulation-test-suite
parentAdding upstream version 4.0. (diff)
downloadchrony-214f81cd9b7c94c10b633627034c21daaee837b2.tar.xz
chrony-214f81cd9b7c94c10b633627034c21daaee837b2.zip
Adding debian version 4.0-8+deb11u2.debian/4.0-8+deb11u2debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/tests/upstream-simulation-test-suite')
-rw-r--r--debian/tests/upstream-simulation-test-suite41
1 files changed, 41 insertions, 0 deletions
diff --git a/debian/tests/upstream-simulation-test-suite b/debian/tests/upstream-simulation-test-suite
new file mode 100644
index 0000000..cee406d
--- /dev/null
+++ b/debian/tests/upstream-simulation-test-suite
@@ -0,0 +1,41 @@
+#!/bin/sh
+# Upstream makes use of “clknetsim” to test how well “chronyd” controls the
+# system clocks in various conditions. Due to “clknetsim” not being available
+# in Debian, let’s use autopkgtest facility to build it in a container and
+# test “chronyd” from there.
+
+set -e
+
+testdir="$PWD/test/simulation"
+clknetsim_ver=c4ccc2d
+clknetsim_src=https://github.com/mlichvar/clknetsim/archive/"$clknetsim_ver"/clknetsim-"$clknetsim_ver".tar.gz
+clknetsim_archive=$(basename "$clknetsim_src")
+
+export CLKNETSIM_PATH="$AUTOPKGTEST_TMP"
+
+# Always use the same seed to get deterministic results
+export CLKNETSIM_RANDOM_SEED=24505
+
+DEB_HOST_MULTIARCH=$(dpkg-architecture -qDEB_HOST_MULTIARCH)
+
+# The simulation tests are only supported on Linux.
+dpkg-architecture -ilinux-any || exit 77
+
+prepare_clknetsim() {
+ # This symbolic link is necessary to prevent clknetsim from FTBFS.
+ ln -s /usr/include/"$DEB_HOST_MULTIARCH"/sys/time.h /usr/include/sys/
+
+ wget -P "$CLKNETSIM_PATH" "$clknetsim_src" 2>&1 || exit 77
+ tar -xvzf "$CLKNETSIM_PATH"/"$clknetsim_archive" \
+ -C "$CLKNETSIM_PATH" --strip-components=1 2>&1 || exit 77
+
+ if [ ! -x "$CLKNETSIM_PATH/clknetsim" ] && [ ! -e "$CLKNETSIM_PATH/clknetsim.so" ]; then
+ make -C "$CLKNETSIM_PATH" 2>&1
+ fi
+}
+
+run_test() {
+ cd "$testdir" && ./run -i 20 -m 2
+}
+
+prepare_clknetsim && run_test