Merge branch 'refs/heads/t/ff'
[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 grep_man()
17 {
18         local regex="$1" exe="$2"
19         tr '\n' ' ' < "$o_man_dir/para_$exe.1" | grep -q "$regex"
20 }
21
22 # check that options of all reveivers/filters/writers are contained
23 # in the man pages
24
25 test_expect_success 'para_recv: receiver options' "grep_man 'RECEIVERS' recv"
26 test_expect_success 'para_filter: filter options' "grep_man 'FILTERS' filter"
27 test_expect_success 'para_write: writer options' "grep_man 'WRITERS' write"
28 test_require_objects "audiod"
29 if [[ -n "$result" ]]; then
30         test_skip 'para_audiod' "missing object(s): $result"
31 else
32         test_expect_success 'para_audiod: receivers' \
33                 "grep_man 'RECEIVERS' audiod"
34         test_expect_success 'para_audiod: filters' \
35                 "grep_man 'FILTERS' audiod"
36         test_expect_success 'para_audiod: writers' \
37                 "grep_man 'WRITERS' audiod"
38 fi
39
40 # check various command lists
41
42 test_require_objects "audiod"
43 if [[ -n "$result" ]]; then
44         test_skip 'para_audiod' "missing object(s): $result"
45 else
46         regex='LIST OF AUDIOD COMMANDS.\{200,\}'
47         test_expect_success 'para_audiod: command list' \
48                 "grep_man '$regex' audiod"
49 fi
50
51 test_require_objects "server"
52 missing_objects="$result"
53 if [[ -n "$missing_objects" ]]; then
54         test_skip "para_server" "missing object(s): $missing_objects"
55 else
56         regex='LIST OF SERVER COMMANDS.\{100,\}'
57         test_expect_success 'para_server: server/afs commands' \
58                 "grep_man '$regex' server"
59 fi
60
61 # para_play is always built
62 regex='LIST OF COMMANDS.\{100,\}'
63 test_expect_success 'para_play: play commands' "grep_man '$regex' play"
64 test_done