]> git.ipfire.org Git - thirdparty/mtr.git/commitdiff
test(dist): cover tarball version metadata 638/head
authorDarafei Praliaskouski <me@komzpa.net>
Fri, 8 May 2026 14:23:45 +0000 (18:23 +0400)
committerDarafei Praliaskouski <me@komzpa.net>
Sat, 9 May 2026 11:12:36 +0000 (15:12 +0400)
Makefile.am
test/dist-version.sh [new file with mode: 0755]

index f18a7d7a7bb782f8a8b8c857ee2939450babe2c8..ec2d140538da773656a2dc05c583ecc83c619eb0 100644 (file)
@@ -8,12 +8,14 @@ EXTRA_DIST = \
 sbin_PROGRAMS = mtr mtr-packet
 TESTS = \
        test/capability-drop.py \
+       test/dist-version.sh \
        test/cmdparse.py \
        test/param.py \
        test/probe.py
 
 TEST_FILES = \
        test/capability-drop.py \
+       test/dist-version.sh \
        test/cmdparse.py \
        test/mtrpacket.py \
        test/param.py \
diff --git a/test/dist-version.sh b/test/dist-version.sh
new file mode 100755 (executable)
index 0000000..833a24b
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/sh
+#
+#   mtr  --  a network diagnostic tool
+#   Copyright (C) 2026  Darafei Praliaskouski
+#
+#   This program is free software; you can redistribute it and/or modify
+#   it under the terms of the GNU General Public License version 2 as
+#   published by the Free Software Foundation.
+#
+
+set -eu
+
+distdir=mtr-dist-version-test
+expected_version=$(build-aux/git-version-gen .tarball-version)
+
+cleanup() {
+    rm -rf "$distdir"
+}
+trap cleanup EXIT INT TERM
+
+cleanup
+"${MAKE:-make}" distdir distdir="$distdir" >/dev/null
+
+test -f "$distdir/.tarball-version"
+actual_version=$(cat "$distdir/.tarball-version")
+test "$actual_version" = "$expected_version"
+
+configure_version=$("$distdir/configure" --version | sed -n '1p')
+test "$configure_version" = "mtr configure $expected_version"