summaryrefslogtreecommitdiffstats
path: root/src/tests/mandb-symlink-beats-whatis-ref
blob: 379bbe00a5dcdaa57d9999571e18f4c287e77226 (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
#! /bin/sh

# Test for:
#   https://bugs.debian.org/204249

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

: ${MANDB=mandb}
: ${ACCESSDB=accessdb}

init
fake_config /usr/share/man /usr/X11R6/man
MANPATH="$tmpdir/usr/share/man:$tmpdir/usr/X11R6/man"
export MANPATH
db_ext="$(db_ext)"

write_page xterm 1x "$tmpdir/usr/X11R6/man/man1/xterm.1x.gz" \
	UTF-8 gz '' 'xterm \- terminal emulator for X'
mkdir -p "$tmpdir/usr/share/man/man1"
ln -s ../../../X11R6/man/man1/xterm.1x.gz \
      "$tmpdir/usr/share/man/man1/x-terminal-emulator.1.gz"
run $MANDB -C "$tmpdir/manpath.config" -u -q \
	"$tmpdir/usr/share/man:$tmpdir/usr/X11R6/man"
cat >"$tmpdir/1-share.exp" <<EOF
x-terminal-emulator -> "- 1 1 MTIME B - - gz terminal emulator for X"
EOF
cat >"$tmpdir/1-X11R6.exp" <<EOF
xterm -> "- 1x 1 MTIME A - - gz terminal emulator for X"
EOF
accessdb_filter "$tmpdir/usr/share/man/index$db_ext" >"$tmpdir/1-share.out"
accessdb_filter "$tmpdir/usr/X11R6/man/index$db_ext" >"$tmpdir/1-X11R6.out"
expect_pass '/usr/share/man x-terminal-emulator -> xterm' \
	    'diff -u "$tmpdir/1-share.exp" "$tmpdir/1-share.out"'
expect_pass '/usr/X11R6/man x-terminal-emulator -> xterm' \
	    'diff -u "$tmpdir/1-X11R6.exp" "$tmpdir/1-X11R6.out"'

./fspause
write_page uxterm 1x "$tmpdir/usr/X11R6/man/man1/uxterm.1x.gz" \
	UTF-8 gz '' \
	'uxterm \- X terminal emulator for Unicode (UTF-8) environments'
ln -sf ../../../X11R6/man/man1/uxterm.1x.gz \
      "$tmpdir/usr/share/man/man1/x-terminal-emulator.1.gz"
run $MANDB -C "$tmpdir/manpath.config" -u -q \
	"$tmpdir/usr/share/man:$tmpdir/usr/X11R6/man"
cat >"$tmpdir/2-share.exp" <<EOF
x-terminal-emulator -> "- 1 1 MTIME B - - gz X terminal emulator for Unicode (UTF-8) environments"
EOF
cat >"$tmpdir/2-X11R6.exp" <<EOF
uxterm -> "- 1x 1 MTIME A - - gz X terminal emulator for Unicode (UTF-8) environments"
xterm -> "- 1x 1 MTIME A - - gz terminal emulator for X"
EOF
accessdb_filter "$tmpdir/usr/share/man/index$db_ext" >"$tmpdir/2-share.out"
accessdb_filter "$tmpdir/usr/X11R6/man/index$db_ext" >"$tmpdir/2-X11R6.out"
expect_pass '/usr/share/man x-terminal-emulator -> uxterm' \
	    'diff -u "$tmpdir/2-share.exp" "$tmpdir/2-share.out"'
expect_pass '/usr/X11R6/man x-terminal-emulator -> uxterm' \
	    'diff -u "$tmpdir/2-X11R6.exp" "$tmpdir/2-X11R6.out"'

finish