blob: 07b18a5b8a92d92619c787529917cd9634d870f4 (
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
|
#! /bin/sh
# Test that whatis behaves appropriately when given a path to an executable.
: ${srcdir=.}
. "$srcdir/testlib.sh"
: ${MANDB=mandb}
: ${WHATIS=whatis}
init
fake_config /usr/share/man /usr/local/man
cat >>"$tmpdir/manpath.config" <<EOF
MANPATH_MAP $tmpdir/usr/bin $tmpdir/usr/share/man
MANPATH_MAP $tmpdir/usr/local/bin $tmpdir/usr/local/man
EOF
MANPATH="$tmpdir/usr/share/man:$tmpdir/usr/local/man"
export MANPATH
write_page test 1 "$tmpdir/usr/share/man/man1/test.1.gz" \
UTF-8 gz '' 'test \- /usr/bin/test'
write_page test 8 "$tmpdir/usr/local/man/man8/test.8.gz" \
UTF-8 gz '' 'test \- /usr/local/bin/test'
mkdir -p "$tmpdir/usr/bin" "$tmpdir/usr/local/bin"
touch "$tmpdir/usr/bin/test" "$tmpdir/usr/local/bin/test"
chmod +x "$tmpdir/usr/bin/test" "$tmpdir/usr/local/bin/test"
run $MANDB -C "$tmpdir/manpath.config" -u -q \
"$tmpdir/usr/share/man:$tmpdir/usr/local/man"
cat >"$tmpdir/1.exp" <<EOF
test (1) - /usr/bin/test
test (8) - /usr/local/bin/test
EOF
PATH="$PATH:$tmpdir/usr/bin:$tmpdir/usr/local/bin" run $WHATIS \
-C "$tmpdir/manpath.config" test >"$tmpdir/1.out"
expect_pass 'simple name returns all matches' \
'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
cat >"$tmpdir/2.exp" <<EOF
test (1) - /usr/bin/test
EOF
PATH="$PATH:$tmpdir/usr/bin:$tmpdir/usr/local/bin" run $WHATIS \
-C "$tmpdir/manpath.config" "$tmpdir/usr/bin/test" >"$tmpdir/2.out"
expect_pass '/usr/bin/test only returns appropriate match' \
'diff -u "$tmpdir/2.exp" "$tmpdir/2.out"'
cat >"$tmpdir/3.exp" <<EOF
test (8) - /usr/local/bin/test
EOF
PATH="$PATH:$tmpdir/usr/bin:$tmpdir/usr/local/bin" run $WHATIS \
-C "$tmpdir/manpath.config" "$tmpdir/usr/local/bin/test" \
>"$tmpdir/3.out"
expect_pass '/usr/local/bin/test only returns appropriate match' \
'diff -u "$tmpdir/3.exp" "$tmpdir/3.out"'
finish
|