aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt (Google) <rostedt@goodmis.org>2022-09-21 20:29:38 -0400
committerSteven Rostedt (Google) <rostedt@goodmis.org>2022-09-21 21:52:19 -0400
commit5baf7a391247ac0e2b59f660cd7860035d29484c (patch)
tree1a0130135e5466bb9e59f041a39758cfbf181c10
parentee007a12a396ddbc0ee868940e8f90eb2daa720b (diff)
downloadtrace-cmd-5baf7a391247ac0e2b59f660cd7860035d29484c.tar.gz
libtracecmd: Add check-manpages.sh
Add the script check-manpages.sh that makes sure all the function that are documented in the man pages are show in the overall man page "libtracecmd" as well as making sure that all functions in trace-cmd.h is also documented. Link: https://lore.kernel.org/linux-trace-devel/20220922002940.3302285-4-rostedt@goodmis.org Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
-rw-r--r--Makefile5
-rwxr-xr-xcheck-manpages.sh54
2 files changed, 58 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 92ba4ba4..866625d7 100644
--- a/Makefile
+++ b/Makefile
@@ -508,7 +508,7 @@ install_gui: force
install_libs: libs
$(Q)$(MAKE) -C $(src)/lib/trace-cmd/ $@
-doc:
+doc: check_doc
$(MAKE) -C $(src)/Documentation all
doc_clean:
@@ -517,6 +517,9 @@ doc_clean:
install_doc:
$(MAKE) -C $(src)/Documentation install
+check_doc: force
+ $(Q)$(src)/check-manpages.sh $(src)/Documentation/libtracecmd
+
clean:
$(RM) *.o *~ *.a *.so .*.d
$(RM) tags TAGS cscope* $(PKG_CONFIG_SOURCE_FILE) $(VERSION_FILE)
diff --git a/check-manpages.sh b/check-manpages.sh
new file mode 100755
index 00000000..1166bbe8
--- /dev/null
+++ b/check-manpages.sh
@@ -0,0 +1,54 @@
+#!/bin/bash
+# SPDX-License-Identifier: LGPL-2.1
+# Copyright (C) 2022, Google Inc, Steven Rostedt <rostedt@goodmis.org>
+#
+# This checks if any function is listed in a man page that is not listed
+# in the main man page.
+
+if [ $# -lt 1 ]; then
+ echo "usage: check-manpages man-page-path"
+ exit 1
+fi
+
+cd $1
+
+MAIN=libtracecmd
+MAIN_FILE=${MAIN}.txt
+
+# Ignore man pages that do not contain functions
+IGNORE=""
+
+for man in ${MAIN}-*.txt; do
+
+ sed -ne '/^NAME/,/^SYNOP/{/^[a-z]/{s/, *$//;s/,/\n/g;s/ //g;s/-.*$/-/;/-/{s/-//p;q};p}}' $man | while read a; do
+ if [ "${IGNORE/$man/}" != "${IGNORE}" ]; then
+ continue
+ fi
+ if ! grep -q '\*'${a}'\*' $MAIN_FILE; then
+ if [ "$last" == "" ]; then
+ echo
+ fi
+ if [ "$last" != "$man" ]; then
+ echo "Missing functions from $MAIN_FILE that are in $man"
+ last=$man
+ fi
+ echo " ${a}"
+ fi
+ done
+done
+
+DEPRECATED=""
+
+sed -ne 's/^[a-z].*[ \*]\([a-z_][a-z_]*\)(.*/\1/p' -e 's/^\([a-z_][a-z_]*\)(.*/\1/p' ../../include/trace-cmd/trace-cmd.h | while read f; do
+ if ! grep -q '\*'${f}'\*' $MAIN_FILE; then
+ if [ "${DEPRECATED/\*$f\*/}" != "${DEPRECATED}" ]; then
+ continue;
+ fi
+ if [ "$last" == "" ]; then
+ echo
+ echo "Missing functions from $MAIN_FILE that are in tracefs.h"
+ last=$f
+ fi
+ echo " ${f}"
+ fi
+done