summaryrefslogtreecommitdiffstats
path: root/src/tests/man-4
blob: a72931105559a7e9ad3b0c924d9df936cdbc4e9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
#! /bin/sh

# Test for wildcards in MANDATORY_MANPATH in config file and in MANPATH.
#   https://bugzilla.redhat.com/show_bug.cgi?id=677669

: ${srcdir=.}
. "$srcdir/testlib.sh"

: ${MAN=man}

init
> "$tmpdir/manpath.config"

MAN_TEST_DISABLE_PATH=1
export MAN_TEST_DISABLE_PATH

write_page manx 1 "$tmpdir/usr/share/man/man1/manx.1.gz" \
    UTF-8 gz '' 'manx \- an interface to the on-line reference manuals'
write_page manpathx 1 "$tmpdir/usr/share/prog/a/man/man1/manpathx.1.gz" \
    UTF-8 gz '' 'manpathx \- determine search path for manual pages'
write_page whatisx 1 "$tmpdir/usr/share/prog/b/man/man1/whatisx.1.gz" \
    UTF-8 gz '' 'whatisx \- display manual page descriptions'

#
# Testing -M option
#

# Without wildcards
Mpath="$tmpdir/usr/share/man"

run $MAN -C "$tmpdir/manpath.config" \
    -aw -M "${Mpath}" manpathx > "$tmpdir/1.out" 2> /dev/null
> "$tmpdir/1.exp"
expect_pass 'wildcards: -M option: without wildcards: check missing man page' \
    'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'

run $MAN -C "$tmpdir/manpath.config" \
    -aw -M "${Mpath}" manx > "$tmpdir/1.out"
cat > "$tmpdir/1.exp" <<EOF
$abstmpdir/usr/share/man/man1/manx.1.gz
EOF
expect_pass 'wildcards: -M option: without wildcards: check existing man page' \
    'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'

# With wildcards
Mpath="$tmpdir/usr/share/prog/*/man"

run $MAN -C "$tmpdir/manpath.config" \
    -aw -M "${Mpath}" manx > "$tmpdir/1.out" 2> /dev/null
> "$tmpdir/1.exp"
expect_pass 'wildcards: -M option: with wildcards: check missing man page' \
    'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'

run $MAN -C "$tmpdir/manpath.config" \
    -aw -M "${Mpath}" manpathx > "$tmpdir/1.out"
cat > "$tmpdir/1.exp" <<EOF
$abstmpdir/usr/share/prog/a/man/man1/manpathx.1.gz
EOF
expect_pass 'wildcards: -M option: with wildcards: check existing man page' \
    'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'

Mpath="$tmpdir/usr/share/prog/[ab]/man"

run $MAN -C "$tmpdir/manpath.config" \
    -aw -M "${Mpath}" whatisx > "$tmpdir/1.out"
cat > "$tmpdir/1.exp" <<EOF
$abstmpdir/usr/share/prog/b/man/man1/whatisx.1.gz
EOF
expect_pass 'wildcards: -M option: with wildcards: check existing man page II' \
    'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'

#
# Testing MANPATH
#

# Without wildcards
MANPATH="$tmpdir/usr/share/man"
export MANPATH

run $MAN -C "$tmpdir/manpath.config" \
    -aw manpathx > "$tmpdir/1.out" 2> /dev/null
> "$tmpdir/1.exp"
expect_pass 'wildcards: MANPATH: without wildcards: check missing man page' \
    'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'

run $MAN -C "$tmpdir/manpath.config" \
    -aw manx > "$tmpdir/1.out"
cat > "$tmpdir/1.exp" <<EOF
$abstmpdir/usr/share/man/man1/manx.1.gz
EOF
expect_pass 'wildcards: MANPATH: without wildcards: check existing man page' \
    'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'

# With wildcards
MANPATH="$tmpdir/usr/share/prog/*/man"
export MANPATH

run $MAN -C "$tmpdir/manpath.config" \
    -aw manx > "$tmpdir/1.out" 2> /dev/null
> "$tmpdir/1.exp"
expect_pass 'wildcards: MANPATH: with wildcards: check missing man page' \
    'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'

run $MAN -C "$tmpdir/manpath.config" \
    -aw manpathx > "$tmpdir/1.out"
cat > "$tmpdir/1.exp" <<EOF
$abstmpdir/usr/share/prog/a/man/man1/manpathx.1.gz
EOF
expect_pass 'wildcards: MANPATH: with wildcards: check existing man page' \
    'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'

MANPATH="$tmpdir/usr/share/prog/[ab]/man"
export MANPATH

run $MAN -C "$tmpdir/manpath.config" \
    -aw whatisx > "$tmpdir/1.out"
cat > "$tmpdir/1.exp" <<EOF
$abstmpdir/usr/share/prog/b/man/man1/whatisx.1.gz
EOF
expect_pass 'wildcards: MANPATH: with wildcards: check existing man page II' \
    'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'

unset MANPATH

#
# Testing MANDATORY_MANPATH
#

# Without wildcards
fake_config /usr/share/man

run $MAN -C "$tmpdir/manpath.config" \
    -aw manpathx > "$tmpdir/1.out" 2> /dev/null
> "$tmpdir/1.exp"
expect_pass 'wildcards: MANDATORY_MANPATH: without wildcards: check missing man page' \
    'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'

run $MAN -C "$tmpdir/manpath.config" \
    -aw manx > "$tmpdir/1.out"
cat > "$tmpdir/1.exp" <<EOF
$abstmpdir/usr/share/man/man1/manx.1.gz
EOF
expect_pass 'wildcards: MANDATORY_MANPATH: without wildcards: check existing man page' \
    'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'

# With wildcards
fake_config "/usr/share/prog/*/man"

run $MAN -C "$tmpdir/manpath.config" \
    -aw manx > "$tmpdir/1.out" 2> /dev/null
> "$tmpdir/1.exp"
expect_pass 'wildcards: MANDATORY_MANPATH: with wildcards: check missing man page' \
    'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'

run $MAN -C "$tmpdir/manpath.config" \
    -aw manpathx > "$tmpdir/1.out"
cat > "$tmpdir/1.exp" <<EOF
$abstmpdir/usr/share/prog/a/man/man1/manpathx.1.gz
EOF
expect_pass 'wildcards: MANDATORY_MANPATH: with wildcards: check existing man page' \
    'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'

fake_config "/usr/share/prog/[ab]/man"

run $MAN -C "$tmpdir/manpath.config" \
    -aw whatisx > "$tmpdir/1.out"
cat > "$tmpdir/1.exp" <<EOF
$abstmpdir/usr/share/prog/b/man/man1/whatisx.1.gz
EOF
expect_pass 'wildcards: MANDATORY_MANPATH: with wildcards: check existing man page II' \
    'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'

finish