summaryrefslogtreecommitdiff
path: root/tools/check-compare-generated.sh
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-11-01 18:28:37 +0100
committerThomas Haller <thaller@redhat.com>2020-11-02 16:42:31 +0100
commit9e1316c267c6eb956db6ac1083c36987e054888e (patch)
treef26f01bb60532b093ae1f607b2e28ab3ccc524d9 /tools/check-compare-generated.sh
parentae1b86fb82674701ce28857061dffb449edd7ea9 (diff)
downloadNetworkManager-th/build-generate-docs.tar.gz
build: rename "tools/check-settings-docs.sh" to "check-compare-generated.sh"th/build-generate-docs
It's a better name, because the script merely compiles files and is not specific to "settings-docs.h".
Diffstat (limited to 'tools/check-compare-generated.sh')
-rwxr-xr-xtools/check-compare-generated.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/check-compare-generated.sh b/tools/check-compare-generated.sh
new file mode 100755
index 0000000000..44b70f95c6
--- /dev/null
+++ b/tools/check-compare-generated.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+set -e
+
+srcdir="$1"
+builddir="$2"
+doc_h="$3"
+
+[ -n "$NMTST_NO_CHECK_SETTINGS_DOCS" ] && exit 0
+
+cmp -s "${srcdir}/${doc_h}.in" "${builddir}/${doc_h}" && exit 0
+
+if [ "$NM_TEST_REGENERATE" = 1 ] ; then
+ cp -f "${builddir}/${doc_h}" "${srcdir}/${doc_h}.in"
+else
+ echo "*** Error: the generated file '${builddir}/${doc_h}' differs from the source file '${srcdir}/${doc_h}.in'. You probably should copy the generated file over to the source file. You can skip this test by setting NMTST_NO_CHECK_SETTINGS_DOCS=yes. You can also automatically copy the file by rerunning the test with NM_TEST_REGENERATE=1"
+ exit 1
+fi