From dbe2fcef2cd31fd8c1a23cf985c00689277c8125 Mon Sep 17 00:00:00 2001 From: Peter Marschall Date: Sun, 27 May 2018 14:04:28 +0200 Subject: [PATCH] test-manpages.sh: make more robust & more easily readable Call the tools to be tested with option '--help' to avoid triggering automatic actions when no option is given. Exampleswhy the old behaviour is bad: - opensc-notify: blocks the build - opensc-explorer: tries to open the card --- doc/tools/test-manpage.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/tools/test-manpage.sh b/doc/tools/test-manpage.sh index 8fdb0913..be12d0f2 100755 --- a/doc/tools/test-manpage.sh +++ b/doc/tools/test-manpage.sh @@ -6,7 +6,11 @@ TOOLS=`find "${SOURCE_PATH}/doc/tools" -name "*.1.xml" | sed -E -e "s|.*/([a-z0- ALL=1 for T in $TOOLS; do - SWITCHES=`${SOURCE_PATH}/src/tools/${T} 2>&1 | awk '{if (match($0,"--[a-zA-Z0-9-]*",a) != 0) print a[0]} {if (match($0," -[a-zA-Z0-9]",a) != 0) print a[0]}'` + SWITCHES=$( ${SOURCE_PATH}/src/tools/${T} --help 2>&1 \ + | grep -v "unrecognized option '--help'" \ + | awk '{if (match($0,"--[a-zA-Z0-9-]*",a) != 0) print a[0]} + {if (match($0," -[a-zA-Z0-9]",a) != 0) print a[0]}' ) + for S in $SWITCHES; do grep -q -- "$S" ${SOURCE_PATH}/doc/tools/${T}.1.xml || { echo "${T}: missing switch $S"; ALL=0; }; done