From 47b05a245d40cc350628710ced372f556c8758e8 Mon Sep 17 00:00:00 2001 From: Olof Johansson Date: Sun, 22 Mar 2015 18:00:25 +0100 Subject: [PATCH] build: Add doctest make target Running `make doctest` will make sure the manual page is synchronized with the available options. --- Makefile | 5 ++++- scripts/diff_man_help.sh | 9 ++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index d854cb6..87041a4 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ all: svtplay-dl -.PHONY: test cover pylint svtplay-dl +.PHONY: test cover doctest pylint svtplay-dl VERSION = 0.10.$(shell date +%Y.%m.%d) @@ -53,6 +53,9 @@ cover: pylint: $(MAKE) -C lib pylint +doctest: svtplay-dl + sh scripts/diff_man_help.sh + clean: $(MAKE) -C lib clean rm -f svtplay-dl diff --git a/scripts/diff_man_help.sh b/scripts/diff_man_help.sh index e11751d..b319e29 100644 --- a/scripts/diff_man_help.sh +++ b/scripts/diff_man_help.sh @@ -1,7 +1,5 @@ #!/bin/sh # Make sure the options listed in --help and the manual are in sync. -diff_opts="$@" -diff_opts=${diff_opts:-"-u"} TMPDIR=$(mktemp -d svtplay-man-test-XXXXXX) [ "$TMPDIR" ] || { echo "mktemp not available, using static dir" @@ -35,6 +33,7 @@ for file in $TMPDIR/options.*; do perl -i -pe 's/^(-.(?: [^-][^ ]+)?) (--.*)/\2 \1/' $file done -# There should be no difference. -diff $diff_opts $TMPDIR/options.* -#sha1sum $TMPDIR/options.* +[ "$(sha1sum<$TMPDIR/options.help)" = "$(sha1sum<$TMPDIR/options.man)" ] || { + diff -u $TMPDIR/options.help $TMPDIR/options.man + exit 1 +}