Cooking since 2014-03-16.
* t/test_man:
test-lib: Make colors work on FreeBSD.
test suite: Add sanity check for generated man pages.
-------------------------------------------------
- Various alsa-related fixes, mostly for the raspberry pi.
+ - The test suite has been extended to include sanity checks
+ for the generated man pages.
----------------------------------------
0.5.2 (2014-04-11) "orthogonal interior"
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")
--- /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
if [[ "$o_nocolor" != "true" && -n "$1" ]]; then
export TERM=$ORIGINAL_TERM
case "$1" in
- error) tput bold; tput setaf 1;;
- skip) tput setaf 5;;
+ error) tput $C_BOLD; tput $C_SETAF 1;;
+ skip) tput $C_SETAF 5;;
ok)
(($o_verbose == 0)) && return
- tput setaf 2;;
- pass) tput bold; tput setaf 2;;
- info) tput setaf 3;;
+ tput $C_SETAF 2;;
+ pass) tput $C_BOLD; tput $C_SETAF 2;;
+ info) tput $C_SETAF 3;;
run)
(($o_verbose == 0)) && return
- tput setaf 6;;
+ tput $C_SETAF 6;;
esac
fi
shift
printf "%s\n" "$*"
if [[ "$o_nocolor" != "true" && -n "$1" ]]; then
- tput sgr0
+ tput $C_SGR0
export TERM=dumb
fi
}
result="false"
[[ "$TERM" == "dumb" ]] && return
[[ -t 1 ]] || return
- tput bold >/dev/null 2>&1 || return
- tput setaf 1 >/dev/null 2>&1 || return
- tput sgr0 >/dev/null 2>&1 || return
+ C_BOLD='bold'
+ tput $C_BOLD &>/dev/null || {
+ C_BOLD='md'
+ tput $C_BOLD &>/dev/null
+ } || return
+ C_SETAF='setaf'
+ tput $C_SETAF 1 &>/dev/null || {
+ C_SETAF='AF'
+ tput $C_SETAF 1 &>/dev/null
+ } || return
+ C_SGR0='sgr0'
+ tput $C_SGR0 >/dev/null 2>&1 || {
+ C_SGR0='me'
+ tput $C_SGR0 &>/dev/null
+ } || return
result="true"
}
-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"