--- /dev/null
+#!/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
-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;;
[[ -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"