summaryrefslogtreecommitdiff
path: root/tests/tst-doc-version-policy.sh
diff options
context:
space:
mode:
authorkx <kx@radix-linux.su>2026-10-09 18:00:15 +0300
committerkx <kx@radix-linux.su>2026-10-09 18:00:15 +0300
commit065da3509019b15dd0e678072e6be629e5330bef (patch)
tree69c934c9e786ac048b4fbe8f4c4c5571661521f4 /tests/tst-doc-version-policy.sh
parentd130fe27fa753be02ed76fd9b277aa3c3d928eb9 (diff)
downloadlibmcpu-0.4.0.tar.xz
Version 0.4.00.4.0
Diffstat (limited to 'tests/tst-doc-version-policy.sh')
-rwxr-xr-xtests/tst-doc-version-policy.sh44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/tst-doc-version-policy.sh b/tests/tst-doc-version-policy.sh
new file mode 100755
index 0000000..cd50995
--- /dev/null
+++ b/tests/tst-doc-version-policy.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+set -e
+
+: "${TEST_SRCDIR:?}"
+
+TOP_SRCDIR=`cd "${TEST_SRCDIR}/.." && pwd`
+README="${TOP_SRCDIR}/README.md"
+MAN_DIR="${TOP_SRCDIR}/man"
+
+fail()
+{
+ echo "tst-doc-version-policy: $*" >&2
+ exit 1
+}
+
+# README is a current-interface document, not a release changelog. Keep
+# package release numbers in NEWS/ChangeLog and obtain the installed version
+# from the tools themselves.
+if grep -E 'LibMCPU [0-9]+\.[0-9]+\.[0-9]+|libmcpu-[0-9]+\.[0-9]+\.[0-9]+' \
+ "${README}" >/dev/null ; then
+ fail "README.md contains a release-bound LibMCPU version string"
+fi
+
+# Manual pages describe the interface contract. Their .TH source field is
+# deliberately version-independent so a release bump cannot leave stale
+# numbers behind.
+while IFS= read -r page ; do
+ header=`sed -n '1p' "${page}"`
+ case "${header}" in
+ *'"LibMCPU"'*)
+ ;;
+ *)
+ fail "${page}: .TH source field is not version-independent"
+ ;;
+ esac
+
+done < <(find "${MAN_DIR}" -type f \( -name '*.1' -o -name '*.7' \) | sort)
+
+if grep -ER 'LibMCPU [0-9]+\.[0-9]+\.[0-9]+' "${MAN_DIR}" >/dev/null ; then
+ fail "manual page contains a release-bound LibMCPU version string"
+fi
+
+exit 0