From: Andre Noll Date: Thu, 16 Jan 2014 22:54:24 +0000 (+0100) Subject: test suite: Add sanity check for generated man pages. X-Git-Tag: v0.5.3~21^2~1 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=0a4967c495ac46a5b7d7440e5e5a6df43d5a8f04 test suite: Add sanity check for generated man pages. The build system of v0.5.0 and v0.5.1 missed to include options for receivers, filters and writers. The new test makes sure this never happens again. --- diff --git a/t/makefile.test b/t/makefile.test index a2bd4e53..6ef9ac84 100644 --- a/t/makefile.test +++ b/t/makefile.test @@ -8,6 +8,7 @@ test_options += --results-dir $(results_dir) test_options += --trash-dir $(trash_dir) test_options += --executables "$(prefixed_executables)" test_options += --objects "$(basename $(all_objs))" +test_options += --man-dir $(man_dir) ifdef V ifeq ("$(origin V)", "command line") diff --git a/t/t0005-man.sh b/t/t0005-man.sh new file mode 100755 index 00000000..7a627aad --- /dev/null +++ b/t/t0005-man.sh @@ -0,0 +1,64 @@ +#!/usr/bin/env bash + +test_description='Parse generated man pages. + +Simple sanity checks of some man pages. + +* para_audiod: Check that list of audiod commands is present +* para_server: Check that list of server/afs commands is present +* para_play: Check that list of play commands is present + +* para_{recv,filter,write,audiod}: Check for presence of +filter/receiver/writer options as appropriate ' + +. ${0%/*}/test-lib.sh + +rfw_regex='Options for .\{100,\}Options for ' # recv/filter/writer + +grep_man() +{ + local regex="$1" exe="$2" + tr '\n' ' ' < "$o_man_dir/para_$exe.1" | grep -q "$regex" +} + +# check that options of all reveivers/filters/writers are contained +# in the man pages + +regex="$rfw_regex" +test_expect_success 'para_recv: receiver options' "grep_man '$regex' recv" +test_expect_success 'para_filter: filter options' "grep_man '$regex' filter" +test_expect_success 'para_write: writer options' "grep_man '$regex' write" +test_require_objects "audiod" +if [[ -n "$result" ]]; then + test_skip 'para_audiod' "missing object(s): $result" +else + test_expect_success 'para_audiod: recv/filter/writer options' \ + "grep_man '$regex' audiod" +fi + +# check various command lists + +test_require_objects "audiod" +if [[ -n "$result" ]]; then + test_skip 'para_audiod' "missing object(s): $result" +else + regex='LIST OF AUDIOD COMMANDS.\{200,\}' + test_expect_success 'para_audiod: command list' \ + "grep_man '$regex' audiod" +fi + +test_require_objects "server" +missing_objects="$result" +if [[ -n "$missing_objects" ]]; then + test_skip "para_server" "missing object(s): $missing_objects" +else + regex='LIST OF SERVER COMMANDS.\{100,\}LIST OF AFS COMMANDS' + test_expect_success 'para_server: server/afs commands' \ + "grep_man '$regex' server" +fi + +# para_play is always built +regex='LIST OF COMMANDS.\{100,\}' +test_expect_success 'para_play: play commands' "grep_man '$regex' play" +regex="$rfw_regex" +test_done diff --git a/t/test-lib.sh b/t/test-lib.sh index f1bb8cf6..f3768b65 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -235,6 +235,7 @@ parse_options() -v=1|--verbose=1) o_verbose="1"; shift;; -v|--verbose|-v=2|--verbose=2) o_verbose="2"; shift;; --no-color) o_nocolor="true"; shift;; + --man-dir) export o_man_dir="$2"; shift; shift;; --results-dir) o_results_dir="$2"; shift; shift;; --trash-dir) o_trash_dir="$2"; shift; shift;; --executables-dir) export o_executables_dir="$2"; shift; shift;; @@ -265,11 +266,13 @@ fixup_dirs() [[ -z "$o_results_dir" ]] && o_results_dir="$test_dir/test-results" [[ -z "$o_executables_dir" ]] && o_executables_dir="$test_dir/.." [[ -z "$o_trash_dir" ]] && o_trash_dir="$test_dir/trashes" + [[ -z "$o_man_dir" ]] && o_man_dir="$test_dir/../build/man/man1" # we want alsolute paths because relative paths become invalid # after changing to the trash dir [[ -n "${o_results_dir##/*}" ]] && o_results_dir="$wd/$o_results_dir" [[ -n "${o_executables_dir##/*}" ]] && o_executables_dir="$wd/$o_results_dir" + [[ -n "${o_man_dir##/*}" ]] && o_man_dir="$wd/$o_man_dir" [[ -n "${o_trash_dir##/*}" ]] && o_trash_dir="$wd/$o_trash_dir" mkdir -p "$o_results_dir"