diff options
Diffstat (limited to '')
-rwxr-xr-x | src/tests/man-1 | 31 | ||||
-rwxr-xr-x | src/tests/man-10 | 26 | ||||
-rwxr-xr-x | src/tests/man-11 | 45 |
3 files changed, 102 insertions, 0 deletions
diff --git a/src/tests/man-1 b/src/tests/man-1 new file mode 100755 index 0000000..ff264d6 --- /dev/null +++ b/src/tests/man-1 @@ -0,0 +1,31 @@ +#! /bin/sh + +# Test for: +# https://bugs.debian.org/163347 + +: ${srcdir=.} +. "$srcdir/testlib.sh" + +: ${MAN=man} + +init +fake_config /usr/local/man /usr/share/man +MANPATH="$tmpdir/usr/local/man:$tmpdir/usr/share/man" +export MANPATH + +write_page md5sum 1 "$tmpdir/usr/share/man/man1/md5sum.1.gz" \ + UTF-8 gz '' 'md5sum \- Debian md5sum manual page' +write_page md5sum 1 "$tmpdir/usr/share/man/man1/md5sum.textutils.1.gz" \ + UTF-8 gz '' 'md5sum \- coreutils md5sum manual page' +mkdir -p "$tmpdir/usr/local/man/man1" +ln -s ../../../share/man/man1/md5sum.textutils.1.gz \ + "$tmpdir/usr/local/man/man1/md5sum.1.gz" +cat >"$tmpdir/1.exp" <<EOF +$abstmpdir/usr/share/man/man1/md5sum.textutils.1.gz +$abstmpdir/usr/share/man/man1/md5sum.1.gz +EOF +run $MAN -C "$tmpdir/manpath.config" -aw md5sum >"$tmpdir/1.out" +expect_pass 'symlinks with matching names win' \ + 'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"' + +finish diff --git a/src/tests/man-10 b/src/tests/man-10 new file mode 100755 index 0000000..75ec2a5 --- /dev/null +++ b/src/tests/man-10 @@ -0,0 +1,26 @@ +#! /bin/sh + +# Test that man can run from a deleted directory. +# https://bugs.debian.org/764384 + +: ${srcdir=.} +. "$srcdir/testlib.sh" + +: ${MAN=man} + +init +echo "MANDATORY_MANPATH $abstmpdir/usr/share/man" >"$tmpdir/manpath.config" +MANPATH="$abstmpdir/usr/share/man" +export MANPATH + +write_page test 1 "$tmpdir/usr/share/man/man1/test.1" \ + UTF-8 '' '' 'test \- test' +mkdir "$tmpdir/zombie" +cd "$tmpdir/zombie" +rmdir "$abstmpdir/zombie" || \ + skip "can't remove current working directory on this system" +run $MAN -C "$abstmpdir/manpath.config" test >/dev/null +code=$? +expect_pass 'run from deleted directory' 'test "$code" = 0' + +finish diff --git a/src/tests/man-11 b/src/tests/man-11 new file mode 100755 index 0000000..a16e41c --- /dev/null +++ b/src/tests/man-11 @@ -0,0 +1,45 @@ +#!/bin/sh + +# Test for: +# man chmod.2 => man 2 chmod +# man chmod.2p => man 2p chmod + +: ${srcdir=.} +. "$srcdir/testlib.sh" + +: ${MAN=man} + +init +fake_config /usr/share/man +MANPATH="$tmpdir/usr/share/man" +export MANPATH + +page_name="chmod" + +write_page "$page_name" 1 "$tmpdir/usr/share/man/man1/${page_name}.1.gz" \ + UTF-8 gz '' "$page_name \- coreutils $page_name manual page" +write_page "$page_name" 2 "$tmpdir/usr/share/man/man2/${page_name}.2.gz" \ + UTF-8 gz '' "$page_name \- $page_name() syscall manual page" + +cat >"$tmpdir/2.exp" <<EOF +$abstmpdir/usr/share/man/man2/${page_name}.2.gz +EOF + +run $MAN -C "$tmpdir/manpath.config" -aw "$page_name".2 >"$tmpdir/2.out" +expect_pass '"man name.2" is the same as "man 2 name"' \ + 'diff -u "$tmpdir/2.exp" "$tmpdir/2.out"' + +( + cd "$tmpdir/usr/share/man/man2/" + mv "${page_name}.2.gz" "${page_name}.2p.gz" +) + +cat >"$tmpdir/2p.exp" <<EOF +$abstmpdir/usr/share/man/man2/${page_name}.2p.gz +EOF + +run $MAN -C "$tmpdir/manpath.config" -aw "$page_name".2p >"$tmpdir/2p.out" +expect_pass '"man name.2p" is the same as "man 2p name"' \ + 'diff -u "$tmpdir/2p.exp" "$tmpdir/2p.out"' + +finish |