#
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"; \
# 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