0e32193b7c0b09a5c7320fb2a31367a49b3c2537
[paraslash.git] / t / t0005-man.sh
1 #!/usr/bin/env bash
2
3 test_description='Parse generated man pages.
4
5 Simple sanity checks of some man pages.
6
7 * para_audiod: Check that list of audiod commands is present
8 * para_server: Check that list of server/afs commands is present
9 * para_play: Check that list of play commands is present
10
11 * para_{recv,filter,write,audiod}: Check for presence of
12 filter/receiver/writer options as appropriate '
13
14 . ${0%/*}/test-lib.sh
15
16 rfw_regex='Options for .\{100,\}Options for ' # recv/filter/writer
17
18 grep_man()
19 {
20         local regex="$1" exe="$2"
21         tr '\n' ' ' < "$o_man_dir/para_$exe.1" | grep -q "$regex"
22 }
23
24 # check that options of all reveivers/filters/writers are contained
25 # in the man pages
26
27 regex="$rfw_regex"
28 test_expect_success 'para_recv: receiver options' "grep_man '$regex' recv"
29 test_expect_success 'para_filter: filter options' "grep_man '$regex' filter"
30 test_expect_success 'para_write: writer options' "grep_man '$regex' write"
31 test_require_objects "audiod"
32 if [[ -n "$result" ]]; then
33         test_skip 'para_audiod' "missing object(s): $result"
34 else
35         test_expect_success 'para_audiod: recv/filter/writer options' \
36                 "grep_man '$regex' audiod"
37 fi
38
39 # check various command lists
40
41 test_require_objects "audiod"
42 if [[ -n "$result" ]]; then
43         test_skip 'para_audiod' "missing object(s): $result"
44 else
45         regex='LIST OF AUDIOD COMMANDS.\{200,\}'
46         test_expect_success 'para_audiod: command list' \
47                 "grep_man '$regex' audiod"
48 fi
49
50 test_require_objects "server"
51 missing_objects="$result"
52 if [[ -n "$missing_objects" ]]; then
53         test_skip "para_server" "missing object(s): $missing_objects"
54 else
55         regex='LIST OF SERVER COMMANDS.\{100,\}LIST OF AFS COMMANDS'
56         test_expect_success 'para_server: server/afs commands' \
57                 "grep_man '$regex' server"
58 fi
59
60 # para_play is always built
61 regex='LIST OF COMMANDS.\{100,\}'
62 test_expect_success 'para_play: play commands' "grep_man '$regex' play"
63 test_done