]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
document and clarify check for missing xlats
authorAlan T. DeKok <aland@freeradius.org>
Fri, 27 Sep 2019 17:44:23 +0000 (13:44 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 27 Sep 2019 17:44:45 +0000 (13:44 -0400)
doc/all.mk
scripts/build/missing-xlat-doc.sh
scripts/build/missing-xlat-doc.txt

index 8f872135baf1a430dcae2c7791264d8460126718..256f20c9e770a5d824d8d07179b9154c57f28cf1 100644 (file)
@@ -122,18 +122,10 @@ clean.doc:
 #
 update-check.doc:
        ${Q}echo "TEST-DOC UPDATE XLAT & RADDB DATABASE"
-       ${Q}./scripts/build/missing-xlat-doc.sh ${top_srcdir}/scripts/build/missing-xlat-doc.txt
+       ${Q}./scripts/build/missing-xlat-doc.sh ${top_srcdir}/scripts/build/missing-xlat-doc.txt
        ${Q}./scripts/build/missing-raddb-mod-conf.sh > ${top_srcdir}/scripts/build/missing-raddb-mod-conf.txt
 
 check.doc:
-       ${Q}echo "TEST-DOC XLAT CHECK";                                           \
-       check_xlatA="${top_srcdir}/scripts/build/missing-xlat-doc.txt";          \
-       check_xlatB="${BUILD_DIR}/tests/missing-xlat-doc.txt";                    \
-       ./scripts/build/missing-xlat-doc.sh > $${check_xlatB};                   \
-       if ! diff $${check_xlatA} $${check_xlatB}; then                           \
-               echo "FAILED: XLAT'S MISSING CHECKS: $$check_xlatA != $$check_xlatB"; \
-               exit 1;                                                               \
-       fi
        ${Q}echo "TEST-DOC RADDB CHECK";                                          \
        check_xlatA="${top_srcdir}/scripts/build/missing-raddb-mod-conf.txt";    \
        check_xlatB="${BUILD_DIR}/tests/missing-raddb-mod-conf.txt";              \
index d51575ffe818e62c73a35c16ba0b075ad522cd61..48a6b0e5a925b227f8149a4eef6d39a2d697dc39 100755 (executable)
@@ -2,14 +2,59 @@
 # Script used to verify the xlat funcs vs documentation
 
 # main()
+
+#
+#  Which API functions are used to register xlats
+#
 xlat_api_funcs="xlat_register|xlat_async_register"
 src_dir="src/"
 doc_xlat="doc/"
 
+#
+#  Where our output goes.
+#
+OUTPUT=$1
+shift
+
+#
+#  Where the correct output is located
+#
+CORRECT=$(echo $0 | sed 's/\.sh/.txt/')
+
+rm -f $OUTPUT
+mkdir -p $(dirname $OUTPUT)
+touch $OUTPUT
+
+#
+#  Search through all of the code for references to xlat API
+#  registration functions.  Then, pull out the names of the xlats
+#  which are registered.
+#
 grep --include "*.c" -E "($xlat_api_funcs).*\"" -r $src_dir 2>&1 | \
        perl -lpe 's/^.*"(.*)".*$/\1/' | sort | uniq | \
+
+#
+#  Search through the documentation for references to the names of the
+#  registered xlat functions.
+#
 while read _d; do
+        echo "CHECKING for %{$_d: ... }"
        if ! grep -q "%{$_d:" --include "*.adoc" -r $doc_xlat 2>&1; then
-               echo "%{$_d:...}"
+               echo "%{$_d:...}" >> $OUTPUT
        fi
 done
+
+#
+#  Files should be identical.  If not, panic.
+#
+if ! diff $OUTPUT $CORRECT 2>/dev/null ; then
+       echo "ERROR: Some registered xlats are not documented."
+       echo "Please compare the following two files:"
+       echo "    expected - $CORRECT"
+        echo "    found    - $OUTPUT"
+       echo
+       echo "If the found output is correct, then just copy that file to the expected output".
+       exit 1
+fi
+
+exit 0
index c29b05513925755f9b789f90a23c937a358aaf9c..e8e76af61c028dd6eb434574d958400c3656cc5b 100644 (file)
@@ -1,3 +1,5 @@
+%{aka_sim_id_method:...}
+%{aka_sim_id_type:...}
 %{attr:...}
 %{attr_by_num:...}
 %{attr_by_oid:...}