re-import sources as agreed with the maintainer
This commit is contained in:
parent
71aff1b8fe
commit
dc0f77d5fd
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,2 @@
|
||||
SOURCES/man-db-2.7.6.1.tar.xz
|
||||
/man-db-2.7.5.tar.xz
|
||||
/man-db-2.7.6.1.tar.xz
|
||||
|
40
tests/man-db/Makefile
Normal file
40
tests/man-db/Makefile
Normal file
@ -0,0 +1,40 @@
|
||||
SH ?= sh
|
||||
|
||||
TESTS = \
|
||||
lexgrog-1 \
|
||||
man-1 \
|
||||
man-2 \
|
||||
man-3 \
|
||||
man-4 \
|
||||
man-5 \
|
||||
man-6 \
|
||||
man-7 \
|
||||
man-8 \
|
||||
man-9 \
|
||||
man-10 \
|
||||
man-11 \
|
||||
manconv-1 \
|
||||
manconv-2 \
|
||||
manconv-3 \
|
||||
mandb-1 \
|
||||
mandb-2 \
|
||||
mandb-3 \
|
||||
mandb-4 \
|
||||
mandb-5 \
|
||||
mandb-6 \
|
||||
mandb-7 \
|
||||
whatis-1 \
|
||||
zsoelim-1
|
||||
|
||||
export DBTYPE = gdbm
|
||||
export MANCONV = /usr/libexec/man-db/manconv
|
||||
|
||||
.PHONY: test $(TESTS)
|
||||
|
||||
test: $(TESTS)
|
||||
|
||||
fspause: fspause.c
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
$(TESTS): %: fspause
|
||||
$(SH) $@
|
51
tests/man-db/Makefile.am
Normal file
51
tests/man-db/Makefile.am
Normal file
@ -0,0 +1,51 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
##
|
||||
## Copyright (C) 2009, 2010, 2011 Colin Watson.
|
||||
##
|
||||
## This file is part of man-db.
|
||||
##
|
||||
## man-db is free software; you can redistribute it and/or modify it
|
||||
## under the terms of the GNU General Public License as published by
|
||||
## the Free Software Foundation; either version 2 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## man-db is distributed in the hope that it will be useful, but
|
||||
## WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with man-db; if not, write to the Free Software Foundation,
|
||||
## Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
TESTS_ENVIRONMENT = PATH=$(abs_builddir)/..:$$PATH; export PATH; \
|
||||
DBTYPE=$(DBTYPE); export DBTYPE; \
|
||||
MANDIR_LAYOUT=$(MANDIR_LAYOUT); export MANDIR_LAYOUT; \
|
||||
abs_top_builddir=$(abs_top_builddir); export abs_top_builddir; \
|
||||
@LOCALCHARSET_TESTS_ENVIRONMENT@; export CHARSETALIASDIR; \
|
||||
OVERRIDE_DIR="$(override_dir)"; export OVERRIDE_DIR;
|
||||
# Each test must use the configure-detected shell, not necessarily /bin/sh.
|
||||
AM_LOG_FLAGS = $(SHELL)
|
||||
ALL_TESTS = \
|
||||
lexgrog-1 \
|
||||
man-1 man-2 man-3 man-4 man-5 man-6 man-7 man-8 man-9 man-10 man-11 \
|
||||
manconv-1 manconv-2 manconv-3 \
|
||||
mandb-1 mandb-2 mandb-3 mandb-4 mandb-5 mandb-6 mandb-7 \
|
||||
whatis-1 \
|
||||
zsoelim-1
|
||||
if !CROSS_COMPILING
|
||||
TESTS = $(ALL_TESTS)
|
||||
endif
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-I$(top_builddir)/include \
|
||||
-I$(top_builddir)/gnulib/lib \
|
||||
-I$(top_srcdir)/gnulib/lib
|
||||
AM_CFLAGS = $(WARN_CFLAGS)
|
||||
check_PROGRAMS = fspause
|
||||
fspause_SOURCES = fspause.c
|
||||
fspause_LDADD = \
|
||||
$(top_builddir)/gnulib/lib/libgnu.la \
|
||||
$(LIB_NANOSLEEP)
|
||||
|
||||
dist_check_SCRIPTS = testlib.sh $(ALL_TESTS)
|
2227
tests/man-db/Makefile.in
Normal file
2227
tests/man-db/Makefile.in
Normal file
File diff suppressed because it is too large
Load Diff
7
tests/man-db/README
Normal file
7
tests/man-db/README
Normal file
@ -0,0 +1,7 @@
|
||||
man-db test suite modified to run against installed man-db
|
||||
|
||||
All files except the following are taken unmodified from upstream tarball:
|
||||
|
||||
Makefile
|
||||
fspause.c
|
||||
testlib.sh
|
133
tests/man-db/fspause.c
Normal file
133
tests/man-db/fspause.c
Normal file
@ -0,0 +1,133 @@
|
||||
/*
|
||||
* fspause.c: pause until a file timestamp updates
|
||||
*
|
||||
* Copyright (C) 2014 Colin Watson.
|
||||
*
|
||||
* This file is part of man-db.
|
||||
*
|
||||
* man-db is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* man-db is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with man-db; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
static char *filename;
|
||||
static int fd = -1;
|
||||
|
||||
#define MUST(name, cond) \
|
||||
do { \
|
||||
if (!(cond)) { \
|
||||
fprintf (stderr, "fspause: " name " failed\n"); \
|
||||
abort (); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
struct timespec get_stat_mtime (struct stat const *st)
|
||||
{
|
||||
return st->st_mtim;
|
||||
}
|
||||
|
||||
int timespec_cmp (struct timespec a, struct timespec b)
|
||||
{
|
||||
if (a.tv_sec < b.tv_sec)
|
||||
return -1;
|
||||
if (a.tv_sec > b.tv_sec)
|
||||
return 1;
|
||||
|
||||
return a.tv_nsec - b.tv_nsec;
|
||||
}
|
||||
|
||||
char *xstrdup (char const *string)
|
||||
{
|
||||
size_t n = strlen (string) + 1;
|
||||
void *p = malloc (n);
|
||||
|
||||
if (!p && n != 0) {
|
||||
fprintf (stderr, "fspause: memory exhausted\n");
|
||||
abort ();
|
||||
}
|
||||
|
||||
return memcpy (p, string, n);
|
||||
}
|
||||
|
||||
static void unlink_tempfile (void)
|
||||
{
|
||||
if (fd >= 0) {
|
||||
MUST ("close", close (fd) >= 0);
|
||||
MUST ("unlink", unlink (filename) >= 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void delay (int delay_ns)
|
||||
{
|
||||
struct timespec delay_ts;
|
||||
|
||||
delay_ts.tv_sec = delay_ns / 1000000000;
|
||||
delay_ts.tv_nsec = delay_ns % 1000000000;
|
||||
for (;;) {
|
||||
errno = 0;
|
||||
if (nanosleep (&delay_ts, NULL) == 0)
|
||||
break;
|
||||
MUST ("nanosleep", errno == 0 || errno == EINTR);
|
||||
}
|
||||
}
|
||||
|
||||
static int try_delay (struct stat *st, int delay_ns)
|
||||
{
|
||||
struct timespec start_ts, end_ts;
|
||||
|
||||
start_ts = get_stat_mtime (st);
|
||||
delay (delay_ns);
|
||||
MUST ("write", write (fd, "\n", 1) == 1);
|
||||
MUST ("fstat", fstat (fd, st) >= 0);
|
||||
end_ts = get_stat_mtime (st);
|
||||
return timespec_cmp (start_ts, end_ts) != 0;
|
||||
}
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
struct stat st;
|
||||
int delay_ns;
|
||||
|
||||
filename = xstrdup ("fspause.tmp.XXXXXX");
|
||||
MUST ("mkstemp", (fd = mkstemp (filename)) >= 0);
|
||||
atexit (unlink_tempfile);
|
||||
MUST ("fstat", fstat (fd, &st) >= 0);
|
||||
|
||||
/* 0x40000000 nanoseconds is just over a second. The effective
|
||||
* maximum delay we will allow is thus about two seconds. This
|
||||
* saves us having to keep track of anything more complicated than a
|
||||
* single signed 32-bit int.
|
||||
*/
|
||||
for (delay_ns = 1; delay_ns < 0x40000000; delay_ns *= 2) {
|
||||
if (try_delay (&st, delay_ns))
|
||||
return 0;
|
||||
}
|
||||
|
||||
fprintf (stderr,
|
||||
"fspause: temporary file timestamp refuses to change!\n");
|
||||
return 1;
|
||||
}
|
18
tests/man-db/lexgrog-1
Executable file
18
tests/man-db/lexgrog-1
Executable file
@ -0,0 +1,18 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Basic lexgrog tests.
|
||||
|
||||
: ${srcdir=.}
|
||||
. "$srcdir/testlib.sh"
|
||||
|
||||
: ${LEXGROG=lexgrog}
|
||||
|
||||
init
|
||||
|
||||
write_page lextest 1 "$tmpdir/usr/share/man/man1/lextest.1.gz" UTF-8 gz '' \
|
||||
'lextest \- simple lexgrog test'
|
||||
echo "$tmpdir/usr/share/man/man1/lextest.1.gz: \"lextest - simple lexgrog test\"" >"$tmpdir/1.exp"
|
||||
run $LEXGROG "$tmpdir/usr/share/man/man1/lextest.1.gz" >"$tmpdir/1.out"
|
||||
expect_pass 'simple lexgrog test' 'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
|
||||
|
||||
finish
|
31
tests/man-db/man-1
Executable file
31
tests/man-db/man-1
Executable file
@ -0,0 +1,31 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Test for:
|
||||
# http://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
|
26
tests/man-db/man-10
Executable file
26
tests/man-db/man-10
Executable file
@ -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
|
45
tests/man-db/man-11
Executable file
45
tests/man-db/man-11
Executable file
@ -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
|
23
tests/man-db/man-2
Executable file
23
tests/man-db/man-2
Executable file
@ -0,0 +1,23 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Test for:
|
||||
# http://bugs.debian.org/608490
|
||||
|
||||
: ${srcdir=.}
|
||||
. "$srcdir/testlib.sh"
|
||||
|
||||
: ${MAN=man}
|
||||
|
||||
init
|
||||
fake_config /usr/share/man
|
||||
MANPATH="$tmpdir/usr/share/man"
|
||||
export MANPATH
|
||||
|
||||
write_page file 1 "$tmpdir/file.1" UTF-8 '' '' 'file \- test'
|
||||
chmod +x "$tmpdir/file.1"
|
||||
PATH="$PATH:$tmpdir" run $MAN \
|
||||
-C "$tmpdir/manpath.config" "$tmpdir/file.1" >/dev/null
|
||||
code=$?
|
||||
expect_pass 'executable page on path' 'test "$code" = 0'
|
||||
|
||||
finish
|
41
tests/man-db/man-3
Executable file
41
tests/man-db/man-3
Executable file
@ -0,0 +1,41 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Test for:
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=684977
|
||||
|
||||
: ${srcdir=.}
|
||||
. "$srcdir/testlib.sh"
|
||||
|
||||
case $MANDIR_LAYOUT in
|
||||
""|GNU)
|
||||
;;
|
||||
*)
|
||||
skip "only applicable to GNU layout"
|
||||
;;
|
||||
esac
|
||||
|
||||
: ${MAN=man}
|
||||
|
||||
init
|
||||
fake_config /usr/share/man
|
||||
MANPATH="$tmpdir/usr/share/man"
|
||||
export MANPATH
|
||||
|
||||
# Force default section order.
|
||||
cat >>"$tmpdir/manpath.config" <<EOF
|
||||
SECTION 1 n l 8 3 0 2 5 4 9 6 7
|
||||
EOF
|
||||
|
||||
write_page md5sum 3pm "$tmpdir/usr/share/man/man3/open.3pm.gz" \
|
||||
UTF-8 gz '' 'open \- section 3pm'
|
||||
write_page md5sum 3p "$tmpdir/usr/share/man/man3p/open.3p.gz" \
|
||||
UTF-8 gz '' 'open \- section 3p'
|
||||
cat >"$tmpdir/1.exp" <<EOF
|
||||
$abstmpdir/usr/share/man/man3p/open.3p.gz
|
||||
$abstmpdir/usr/share/man/man3/open.3pm.gz
|
||||
EOF
|
||||
run $MAN -C "$tmpdir/manpath.config" -aw 3p open >"$tmpdir/1.out"
|
||||
expect_pass 'exact section matches win' \
|
||||
'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
|
||||
|
||||
finish
|
173
tests/man-db/man-4
Executable file
173
tests/man-db/man-4
Executable file
@ -0,0 +1,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
|
90
tests/man-db/man-5
Executable file
90
tests/man-db/man-5
Executable file
@ -0,0 +1,90 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Test for relative .so links between man pages in the same section (e.g. ".so bar.1").
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=693458
|
||||
|
||||
: ${srcdir=.}
|
||||
. "$srcdir/testlib.sh"
|
||||
|
||||
: ${MAN=man}
|
||||
|
||||
init
|
||||
fake_config /usr/share/man
|
||||
MANPATH="$tmpdir/usr/share/man"
|
||||
export MANPATH
|
||||
|
||||
cat >"$tmpdir/fake-program" <<EOF
|
||||
#! /bin/sh
|
||||
exec cat
|
||||
EOF
|
||||
chmod +x "$tmpdir/fake-program"
|
||||
PATH="$abstmpdir:$PATH"
|
||||
export PATH
|
||||
|
||||
cat >>"$tmpdir/manpath.config" <<EOF
|
||||
DEFINE tbl fake-program
|
||||
DEFINE nroff fake-program
|
||||
EOF
|
||||
|
||||
# There are 2 kind of tests. First, when destination is not gzipped, what means
|
||||
# that .so link contains full filename and second, when the destination is
|
||||
# gzipped, and .so link doesn't contain the file suffix.
|
||||
|
||||
write_page test 1 "$tmpdir/usr/share/man/man1/test.1" \
|
||||
UTF-8 '' '' 'test \- top-level test page'
|
||||
echo '.so man1/test.1' >"$tmpdir/usr/share/man/man1/test-fullso.1"
|
||||
echo '.so test.1' >"$tmpdir/usr/share/man/man1/test-relso.1"
|
||||
|
||||
write_page testb 1 "$tmpdir/usr/share/man/man1/testb.1.gz" \
|
||||
UTF-8 'gz' '' 'testb \- top-level test page'
|
||||
echo '.so man1/testb.1' >"$tmpdir/usr/share/man/man1/test-fullsob.1"
|
||||
echo '.so testb.1' >"$tmpdir/usr/share/man/man1/test-relsob.1"
|
||||
|
||||
cat >"$tmpdir/1.exp" <<'EOF'
|
||||
.TH test 1
|
||||
.SH NAME
|
||||
test \- top-level test page
|
||||
.SH DESCRIPTION
|
||||
test
|
||||
EOF
|
||||
|
||||
cat >"$tmpdir/2.exp" <<'EOF'
|
||||
.TH testb 1
|
||||
.SH NAME
|
||||
testb \- top-level test page
|
||||
.SH DESCRIPTION
|
||||
test
|
||||
EOF
|
||||
|
||||
run $MAN -C "$tmpdir/manpath.config" test | \
|
||||
grep -v '^\.l[flt] ' >"$tmpdir/1.out"
|
||||
expect_pass 'test(1) without .so link' \
|
||||
'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
|
||||
|
||||
run $MAN -C "$tmpdir/manpath.config" test-fullso | \
|
||||
grep -v '^\.l[flt] ' >"$tmpdir/2.out"
|
||||
expect_pass 'test-fullso(1) .so link with section' \
|
||||
'diff -u "$tmpdir/1.exp" "$tmpdir/2.out"'
|
||||
|
||||
run $MAN -C "$tmpdir/manpath.config" test-relso | \
|
||||
grep -v '^\.l[flt] ' >"$tmpdir/3.out"
|
||||
expect_pass 'test-relso(1) .so link without section' \
|
||||
'diff -u "$tmpdir/1.exp" "$tmpdir/3.out"'
|
||||
|
||||
|
||||
run $MAN -C "$tmpdir/manpath.config" testb | \
|
||||
grep -v '^\.l[flt] ' >"$tmpdir/4.out"
|
||||
expect_pass 'testb(1) without .so link; gzipped' \
|
||||
'diff -u "$tmpdir/2.exp" "$tmpdir/4.out"'
|
||||
|
||||
run $MAN -C "$tmpdir/manpath.config" test-fullsob | \
|
||||
grep -v '^\.l[flt] ' >"$tmpdir/5.out"
|
||||
expect_pass 'test-fullsob(1) .so link with section; gzipped' \
|
||||
'diff -u "$tmpdir/2.exp" "$tmpdir/5.out"'
|
||||
|
||||
run $MAN -C "$tmpdir/manpath.config" test-relsob | \
|
||||
grep -v '^\.l[flt] ' >"$tmpdir/6.out"
|
||||
expect_pass 'test-relsob(1) .so link without section; gzipped' \
|
||||
'diff -u "$tmpdir/2.exp" "$tmpdir/6.out"'
|
||||
|
||||
finish
|
28
tests/man-db/man-6
Executable file
28
tests/man-db/man-6
Executable file
@ -0,0 +1,28 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Testing empty locales on systems without /usr/share/i18n/SUPPORTED file.
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=657409
|
||||
#
|
||||
# File /usr/share/i18n/SUPPORTED must be missing for this test to be effective.
|
||||
#
|
||||
|
||||
: ${srcdir=.}
|
||||
. "$srcdir/testlib.sh"
|
||||
|
||||
: ${MAN=man}
|
||||
|
||||
init
|
||||
fake_config /usr/share/man
|
||||
|
||||
write_page test 1 "$tmpdir/usr/share/man/man1/test.1" \
|
||||
UTF-8 '' '' 'test \- top-level test page'
|
||||
|
||||
LANG=
|
||||
LC_CTYPE=
|
||||
LC_ALL=
|
||||
run $MAN -C "$tmpdir/manpath.config" -E UTF-8 test > /dev/null
|
||||
# $? is deliberately expanded here.
|
||||
expect_pass 'missing locales' "test $? -eq 0"
|
||||
|
||||
finish
|
||||
|
31
tests/man-db/man-7
Executable file
31
tests/man-db/man-7
Executable file
@ -0,0 +1,31 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Test for invalid DB entry.
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=841431
|
||||
|
||||
: ${srcdir=.}
|
||||
. "$srcdir/testlib.sh"
|
||||
|
||||
: ${MAN=man}
|
||||
: ${MANDB=mandb}
|
||||
|
||||
init
|
||||
fake_config /usr/share/man
|
||||
MANPATH="$tmpdir/usr/share/man"
|
||||
export MANPATH
|
||||
|
||||
MAN_TEST_DISABLE_UNDOCUMENTED=1
|
||||
export MAN_TEST_DISABLE_UNDOCUMENTED
|
||||
|
||||
write_page test 1 "$tmpdir/usr/share/man/man1/test.1" \
|
||||
UTF-8 '' '' 'test \- top-level test page'
|
||||
run $MANDB -C "$tmpdir/manpath.config" -u -q "$tmpdir/usr/share/man"
|
||||
|
||||
rm -f "$tmpdir/usr/share/man/man1/test.1"
|
||||
|
||||
echo "No manual entry for test" > "$tmpdir/1.exp"
|
||||
LC_ALL=C run $MAN -C "$tmpdir/manpath.config" test 2> "$tmpdir/1.out"
|
||||
expect_pass 'invalid DB entry' \
|
||||
'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
|
||||
|
||||
finish
|
58
tests/man-db/man-8
Executable file
58
tests/man-db/man-8
Executable file
@ -0,0 +1,58 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Test additional language-specific requests for localized man pages.
|
||||
|
||||
: ${srcdir=.}
|
||||
. "$srcdir/testlib.sh"
|
||||
|
||||
: ${MAN=man}
|
||||
|
||||
init
|
||||
fake_config /usr/share/man
|
||||
MANPATH="$tmpdir/usr/share/man"
|
||||
export MANPATH
|
||||
|
||||
cat >"$tmpdir/fake-program" <<EOF
|
||||
#! /bin/sh
|
||||
exec cat
|
||||
EOF
|
||||
chmod +x "$tmpdir/fake-program"
|
||||
PATH="$abstmpdir:$PATH"
|
||||
export PATH
|
||||
|
||||
cat >>"$tmpdir/manpath.config" <<EOF
|
||||
DEFINE tbl fake-program
|
||||
DEFINE nroff fake-program
|
||||
EOF
|
||||
|
||||
write_page test 1 "$tmpdir/usr/share/man/man1/test.1" \
|
||||
UTF-8 '' '' 'test \- top-level test page'
|
||||
|
||||
write_page test 1 "$tmpdir/usr/share/man/xyzzy/man1/test.1" \
|
||||
UTF-8 '' '' 'test \- xyzzy language page for test'
|
||||
|
||||
write_page xyz 1 "$tmpdir/usr/share/man/man1/xyz.1" \
|
||||
UTF-8 '' '' 'test \- top-level xyz page'
|
||||
|
||||
cat >"$tmpdir/1.exp" <<'EOF'
|
||||
. mso xyzzy.tmac
|
||||
.hla xyzzy
|
||||
test \- xyzzy language page for test
|
||||
EOF
|
||||
|
||||
cat >"$tmpdir/2.exp" <<'EOF'
|
||||
.TH xyz 1
|
||||
test \- top-level xyz page
|
||||
EOF
|
||||
|
||||
run $MAN -L xyzzy_foo.bar -C "$tmpdir/manpath.config" test |\
|
||||
grep 'xyzzy' >"$tmpdir/1.out"
|
||||
expect_pass 'language-specific requests for localized man page' \
|
||||
'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
|
||||
|
||||
run $MAN -L xyzzy_foo.bar -C "$tmpdir/manpath.config" xyz |\
|
||||
grep 'xyz' >"$tmpdir/2.out"
|
||||
expect_pass 'no language-specific requests for top-level man page' \
|
||||
'diff -u "$tmpdir/2.exp" "$tmpdir/2.out"'
|
||||
|
||||
finish
|
46
tests/man-db/man-9
Executable file
46
tests/man-db/man-9
Executable file
@ -0,0 +1,46 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Testing override dir. This test covers both use cases - when override dir is
|
||||
# enabled and when it's not.
|
||||
#
|
||||
|
||||
: ${srcdir=.}
|
||||
. "$srcdir/testlib.sh"
|
||||
|
||||
: ${MAN=man}
|
||||
|
||||
if [ -n "$OVERRIDE_DIR" ]; then
|
||||
OVERRIDE=$OVERRIDE_DIR
|
||||
else
|
||||
OVERRIDE="override"
|
||||
fi
|
||||
|
||||
init
|
||||
fake_config /usr/share/man
|
||||
mkdir -p "${tmpdir}/usr/share/man/${OVERRIDE}/man1"
|
||||
MANPATH="$tmpdir/usr/share/man"
|
||||
export MANPATH
|
||||
|
||||
|
||||
write_page abc 1 "${tmpdir}/usr/share/man/man1/abc.1" \
|
||||
UTF-8 '' '' 'abc \- top-level test page'
|
||||
write_page abc 1 "${tmpdir}/usr/share/man/${OVERRIDE}/man1/abc.1" \
|
||||
UTF-8 '' '' 'abc \- modified test page'
|
||||
|
||||
if [ -n "$OVERRIDE_DIR" ]; then
|
||||
cat >"$tmpdir/1.exp" <<EOF
|
||||
$abstmpdir/usr/share/man/${OVERRIDE}/man1/abc.1
|
||||
$abstmpdir/usr/share/man/man1/abc.1
|
||||
EOF
|
||||
else
|
||||
cat >"$tmpdir/1.exp" <<EOF
|
||||
$abstmpdir/usr/share/man/man1/abc.1
|
||||
EOF
|
||||
fi
|
||||
|
||||
|
||||
run $MAN -C "$tmpdir/manpath.config" -aw abc >"$tmpdir/1.out"
|
||||
expect_pass 'testing override dir' \
|
||||
'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
|
||||
|
||||
finish
|
43
tests/man-db/manconv-1
Executable file
43
tests/man-db/manconv-1
Executable file
@ -0,0 +1,43 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Test manconv's support for Emacs-style coding: tags.
|
||||
|
||||
: ${srcdir=.}
|
||||
. "$srcdir/testlib.sh"
|
||||
|
||||
: ${MANCONV=manconv}
|
||||
|
||||
init
|
||||
|
||||
cat >"$tmpdir/1.exp" <<'EOF'
|
||||
'\" -*- coding: ISO-8859-1
|
||||
á
|
||||
EOF
|
||||
iconv -f UTF-8 -t ISO-8859-1 <"$tmpdir/1.exp" >"$tmpdir/1.inp"
|
||||
run $MANCONV -f UTF-8 -t UTF-8 <"$tmpdir/1.inp" >"$tmpdir/1.out"
|
||||
expect_pass 'simple coding tag' 'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
|
||||
|
||||
cat >"$tmpdir/2.exp" <<'EOF'
|
||||
'\" -*- mode: troff; coding: ISO-8859-1
|
||||
á
|
||||
EOF
|
||||
iconv -f UTF-8 -t ISO-8859-1 <"$tmpdir/2.exp" >"$tmpdir/2.inp"
|
||||
run $MANCONV -f UTF-8 -t UTF-8 <"$tmpdir/2.inp" >"$tmpdir/2.out"
|
||||
expect_pass 'mode and coding tags' 'diff -u "$tmpdir/2.exp" "$tmpdir/2.out"'
|
||||
|
||||
cat >"$tmpdir/3.exp" <<'EOF'
|
||||
'\" -*- mode: troff; coding: ISO-LATIN-1
|
||||
á
|
||||
EOF
|
||||
iconv -f UTF-8 -t ISO-8859-1 <"$tmpdir/3.exp" >"$tmpdir/3.inp"
|
||||
run $MANCONV -f UTF-8 -t UTF-8 <"$tmpdir/3.inp" >"$tmpdir/3.out"
|
||||
expect_pass 'iso-latin-1 coding alias' 'diff -u "$tmpdir/3.exp" "$tmpdir/3.out"'
|
||||
|
||||
cat >"$tmpdir/4.inp" <<'EOF'
|
||||
'\" -*- nroff -*-
|
||||
EOF
|
||||
run $MANCONV -f UTF-8 -t UTF-8 <"$tmpdir/4.inp" >"$tmpdir/4.out"
|
||||
expect_pass 'preprocessor comment but no coding tag' \
|
||||
'diff -u "$tmpdir/4.inp" "$tmpdir/4.out"'
|
||||
|
||||
finish
|
75
tests/man-db/manconv-2
Executable file
75
tests/man-db/manconv-2
Executable file
@ -0,0 +1,75 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Test manconv's handling of various odd encoding combinations.
|
||||
|
||||
: ${srcdir=.}
|
||||
. "$srcdir/testlib.sh"
|
||||
|
||||
: ${MANCONV=manconv}
|
||||
|
||||
init
|
||||
|
||||
(for x in $(seq 160 255); do
|
||||
printf "\\$(printf %03o "$x")"
|
||||
done
|
||||
echo) >"$tmpdir/1.inp"
|
||||
|
||||
iconv -f ISO-8859-1 -t UTF-8 <"$tmpdir/1.inp" >"$tmpdir/1.exp"
|
||||
run $MANCONV -f UTF-8:ISO-8859-1 -t UTF-8 <"$tmpdir/1.inp" >"$tmpdir/1.out"
|
||||
expect_pass '-f UTF-8:ISO-8859-1 -t UTF-8 on ISO-8859-1 input' \
|
||||
'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
|
||||
|
||||
iconv -f ISO-8859-2 -t UTF-8 <"$tmpdir/1.inp" >"$tmpdir/1-latin2.exp"
|
||||
run $MANCONV -f UTF-8:ISO-8859-2 -t UTF-8 \
|
||||
<"$tmpdir/1.inp" >"$tmpdir/1-latin2.out"
|
||||
expect_pass '-f UTF-8:ISO-8859-2 -t UTF-8 on ISO-8859-2 input' \
|
||||
'diff -u "$tmpdir/1-latin2.exp" "$tmpdir/1-latin2.out"'
|
||||
|
||||
(for x in $(seq 1 1000); do
|
||||
printf '‐'
|
||||
done
|
||||
echo 'Б' | iconv -f UTF-8 -t KOI8-R
|
||||
echo '‐') >"$tmpdir/2.inp"
|
||||
iconv -f KOI8-R -t UTF-8 <"$tmpdir/2.inp" >"$tmpdir/2.exp"
|
||||
run $MANCONV -f UTF-8:KOI8-R -t UTF-8 <"$tmpdir/2.inp" >"$tmpdir/2.out"
|
||||
expect_pass '-f UTF-8:KOI8-R -t UTF-8 on KOI8-R input with UTF-8 prefix' \
|
||||
'diff -u "$tmpdir/2.exp" "$tmpdir/2.out"'
|
||||
|
||||
(for x in $(seq 160 255); do
|
||||
printf "\\$(printf %03o "$x")"
|
||||
done
|
||||
echo) | iconv -f ISO-8859-1 -t UTF-8 >"$tmpdir/3.inp"
|
||||
run $MANCONV -f UTF-8:ISO-8859-1 -t UTF-8 <"$tmpdir/3.inp" >"$tmpdir/3.out"
|
||||
expect_pass '-f UTF-8:ISO-8859-1 -t UTF-8 preserves UTF-8 input' \
|
||||
'diff -u "$tmpdir/3.inp" "$tmpdir/3.out"'
|
||||
|
||||
# U+00B7 MIDDLE DOT is not representable in ISO-8859-2, and so should be
|
||||
# omitted. However, manconv should still recognise that the input was UTF-8
|
||||
# rather than falling back to ISO-8859-2.
|
||||
cat >"$tmpdir/4.inp" <<'EOF'
|
||||
š·ł
|
||||
EOF
|
||||
iconv -f UTF-8 -t ISO-8859-2 >"$tmpdir/4.exp" <<EOF
|
||||
šł
|
||||
EOF
|
||||
run $MANCONV -f UTF-8:ISO-8859-2 -t ISO-8859-2//IGNORE \
|
||||
<"$tmpdir/4.inp" >"$tmpdir/4.out"
|
||||
expect_pass 'recognises input encoding and omits invalid output character' \
|
||||
'diff -u "$tmpdir/4.exp" "$tmpdir/4.out"'
|
||||
|
||||
# 0xAE does not exist in ISO-8859-7, so manconv won't be able to recode this
|
||||
# to UTF-8 without conversion errors. (In the original case where this was
|
||||
# seen in the wild, the coding: tag should actually have read ISO-8859-13.)
|
||||
iconv -f UTF-8 -t ISO-8859-13 >"$tmpdir/5.inp" <<'EOF'
|
||||
'\" -*- coding: ISO-8859-7
|
||||
REGISTERED SIGN: ®
|
||||
trailing data
|
||||
EOF
|
||||
iconv -f ISO-8859-7 -t UTF-8//IGNORE \
|
||||
<"$tmpdir/5.inp" >"$tmpdir/5.exp" 2>/dev/null
|
||||
run $MANCONV -f UTF-8:ISO-8859-1 -t UTF-8//IGNORE \
|
||||
<"$tmpdir/5.inp" >"$tmpdir/5.out"
|
||||
expect_pass 'copes with invalid input characters' \
|
||||
'diff -u "$tmpdir/5.exp" "$tmpdir/5.out"'
|
||||
|
||||
finish
|
15
tests/man-db/manconv-3
Executable file
15
tests/man-db/manconv-3
Executable file
@ -0,0 +1,15 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Test manconv's handling of incomplete characters at end of file.
|
||||
|
||||
: ${srcdir=.}
|
||||
. "$srcdir/testlib.sh"
|
||||
|
||||
: ${MANCONV=manconv}
|
||||
|
||||
init
|
||||
|
||||
printf '\314' >"$tmpdir/1.inp" # 0xCC
|
||||
expect_pass 'incomplete character at EOF' '! run $MANCONV -f EUC-JP -t UTF-8//IGNORE <"$tmpdir/1.inp" >/dev/null'
|
||||
|
||||
finish
|
24
tests/man-db/mandb-1
Executable file
24
tests/man-db/mandb-1
Executable file
@ -0,0 +1,24 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Basic mandb tests.
|
||||
|
||||
: ${srcdir=.}
|
||||
. "$srcdir/testlib.sh"
|
||||
|
||||
: ${MANDB=mandb}
|
||||
: ${ACCESSDB=accessdb}
|
||||
|
||||
init
|
||||
fake_config /usr/share/man
|
||||
MANPATH="$tmpdir/usr/share/man"
|
||||
export MANPATH
|
||||
db_ext="$(db_ext)"
|
||||
|
||||
write_page test 1 "$tmpdir/usr/share/man/man1/test.1.gz" UTF-8 gz t \
|
||||
'test \- simple mandb test'
|
||||
run $MANDB -C "$tmpdir/manpath.config" -u -q "$tmpdir/usr/share/man"
|
||||
echo 'test -> "- 1 1 MTIME A - - gz simple mandb test"' >"$tmpdir/1.exp"
|
||||
accessdb_filter "$tmpdir/usr/share/man/index$db_ext" >"$tmpdir/1.out"
|
||||
expect_pass 'simple mandb test' 'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
|
||||
|
||||
finish
|
67
tests/man-db/mandb-2
Executable file
67
tests/man-db/mandb-2
Executable file
@ -0,0 +1,67 @@
|
||||
#! /bin/sh
|
||||
|
||||
# What happens when a manual page changes from a regular file to a symbolic
|
||||
# link and back?
|
||||
# http://bugs.debian.org/490582
|
||||
|
||||
: ${srcdir=.}
|
||||
. "$srcdir/testlib.sh"
|
||||
|
||||
: ${MANDB=mandb}
|
||||
: ${ACCESSDB=accessdb}
|
||||
|
||||
init
|
||||
fake_config /usr/share/man
|
||||
MANPATH="$tmpdir/usr/share/man"
|
||||
export MANPATH
|
||||
db_ext="$(db_ext)"
|
||||
|
||||
write_page fs 5 "$tmpdir/usr/share/man/man5/fs.5.gz" \
|
||||
UTF-8 gz t 'fs \- fs(5)'
|
||||
run $MANDB -C "$tmpdir/manpath.config" -u -q "$tmpdir/usr/share/man"
|
||||
cat >"$tmpdir/1.exp" <<EOF
|
||||
fs -> "- 5 5 MTIME A - - gz fs(5)"
|
||||
EOF
|
||||
accessdb_filter "$tmpdir/usr/share/man/index$db_ext" >"$tmpdir/1.out"
|
||||
expect_pass 'fs(5) setup' 'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
|
||||
|
||||
./fspause
|
||||
write_page filesystems 5 "$tmpdir/usr/share/man/man5/filesystems.5.gz" \
|
||||
UTF-8 gz t 'filesystems \- filesystems(5)'
|
||||
ln -sf filesystems.5.gz "$tmpdir/usr/share/man/man5/fs.5.gz"
|
||||
run $MANDB -C "$tmpdir/manpath.config" -u -q "$tmpdir/usr/share/man"
|
||||
cat >"$tmpdir/2.exp" <<EOF
|
||||
filesystems -> "- 5 5 MTIME A - - gz filesystems(5)"
|
||||
fs -> "- 5 5 MTIME B - - gz filesystems(5)"
|
||||
EOF
|
||||
accessdb_filter "$tmpdir/usr/share/man/index$db_ext" >"$tmpdir/2.out"
|
||||
expect_pass 'mandb notices regular file -> symlink' \
|
||||
'diff -u "$tmpdir/2.exp" "$tmpdir/2.out"'
|
||||
|
||||
./fspause
|
||||
ln -sf fs.5.gz "$tmpdir/usr/share/man/man5/fs2.5.gz"
|
||||
run $MANDB -C "$tmpdir/manpath.config" -u -q "$tmpdir/usr/share/man"
|
||||
cat >"$tmpdir/3.exp" <<EOF
|
||||
filesystems -> "- 5 5 MTIME A - - gz filesystems(5)"
|
||||
fs -> "- 5 5 MTIME B - - gz filesystems(5)"
|
||||
fs2 -> "- 5 5 MTIME B - - gz filesystems(5)"
|
||||
EOF
|
||||
accessdb_filter "$tmpdir/usr/share/man/index$db_ext" >"$tmpdir/3.out"
|
||||
expect_pass 'mandb notices two-level symlink' \
|
||||
'diff -u "$tmpdir/3.exp" "$tmpdir/3.out"'
|
||||
|
||||
./fspause
|
||||
rm -f "$tmpdir/usr/share/man/man5/fs.5.gz"
|
||||
write_page fs 5 "$tmpdir/usr/share/man/man5/fs.5.gz" \
|
||||
UTF-8 gz t 'fs \- new fs(5)'
|
||||
run $MANDB -C "$tmpdir/manpath.config" -u -q "$tmpdir/usr/share/man"
|
||||
cat >"$tmpdir/4.exp" <<EOF
|
||||
filesystems -> "- 5 5 MTIME A - - gz filesystems(5)"
|
||||
fs -> "- 5 5 MTIME A - - gz new fs(5)"
|
||||
fs2 -> "- 5 5 MTIME B - - gz filesystems(5)"
|
||||
EOF
|
||||
accessdb_filter "$tmpdir/usr/share/man/index$db_ext" >"$tmpdir/4.out"
|
||||
expect_pass 'mandb notices symlink -> regular file' \
|
||||
'diff -u "$tmpdir/4.exp" "$tmpdir/4.out"'
|
||||
|
||||
finish
|
55
tests/man-db/mandb-3
Executable file
55
tests/man-db/mandb-3
Executable file
@ -0,0 +1,55 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Ensure that we don't repeatedly rescan when a whatis entry turns into a
|
||||
# broken link.
|
||||
|
||||
: ${srcdir=.}
|
||||
. "$srcdir/testlib.sh"
|
||||
|
||||
: ${MANDB=mandb}
|
||||
: ${ACCESSDB=accessdb}
|
||||
|
||||
init
|
||||
fake_config /usr/share/man
|
||||
MANPATH="$tmpdir/usr/share/man"
|
||||
export MANPATH
|
||||
db_ext="$(db_ext)"
|
||||
|
||||
NL='
|
||||
'
|
||||
|
||||
write_page test 1 "$tmpdir/usr/share/man/man1/test.1.gz" UTF-8 gz t \
|
||||
"test \- test page${NL}.br${NL}testlink \- link to test page"
|
||||
run $MANDB -C "$tmpdir/manpath.config" -u -q "$tmpdir/usr/share/man"
|
||||
cat >"$tmpdir/1.exp" <<EOF
|
||||
test -> "- 1 1 MTIME A - - gz test page"
|
||||
testlink -> "- 1 1 MTIME C test - gz "
|
||||
EOF
|
||||
accessdb_filter "$tmpdir/usr/share/man/index$db_ext" >"$tmpdir/1.out"
|
||||
expect_pass 'setup' 'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
|
||||
|
||||
./fspause
|
||||
echo '.so nonexistent.1' | gzip -9c >"$tmpdir/usr/share/man/man1/testlink.1.gz"
|
||||
run $MANDB -C "$tmpdir/manpath.config" -u -q "$tmpdir/usr/share/man"
|
||||
cat >"$tmpdir/2.exp" <<EOF
|
||||
test -> "- 1 1 MTIME A - - gz test page"
|
||||
testlink -> "- 1 1 MTIME C test - gz "
|
||||
EOF
|
||||
accessdb_filter "$tmpdir/usr/share/man/index$db_ext" >"$tmpdir/2.out"
|
||||
expect_pass 'broken whatis' 'diff -u "$tmpdir/2.exp" "$tmpdir/2.out"'
|
||||
|
||||
./fspause
|
||||
LC_ALL=C run $MANDB -C "$tmpdir/manpath.config" -u \
|
||||
"$tmpdir/usr/share/man" >"$tmpdir/3.out" 2>/dev/null
|
||||
cat >"$tmpdir/3.exp" <<EOF
|
||||
Purging old database entries in $abstmpdir/usr/share/man...
|
||||
Processing manual pages under $abstmpdir/usr/share/man...
|
||||
Processing manual pages under $abstmpdir/usr/share/man/cat1...
|
||||
0 man subdirectories contained newer manual pages.
|
||||
0 manual pages were added.
|
||||
0 stray cats were added.
|
||||
0 old database entries were purged.
|
||||
EOF
|
||||
expect_pass 'mandb does not rescan' 'diff -u "$tmpdir/3.exp" "$tmpdir/3.out"'
|
||||
|
||||
finish
|
60
tests/man-db/mandb-4
Executable file
60
tests/man-db/mandb-4
Executable file
@ -0,0 +1,60 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Test for:
|
||||
# http://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
|
30
tests/man-db/mandb-5
Executable file
30
tests/man-db/mandb-5
Executable file
@ -0,0 +1,30 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Test handling of empty files.
|
||||
# http://bugs.debian.org/622104
|
||||
|
||||
: ${srcdir=.}
|
||||
. "$srcdir/testlib.sh"
|
||||
|
||||
: ${MANDB=mandb}
|
||||
|
||||
init
|
||||
fake_config /usr/share/man /usr/X11R6/man
|
||||
MANPATH="$tmpdir/usr/share/man"
|
||||
export MANPATH
|
||||
db_ext="$(db_ext)"
|
||||
|
||||
mkdir -p "$tmpdir/usr/share/man/man1"
|
||||
touch "$tmpdir/usr/share/man/man1/empty.1"
|
||||
gzip -9 "$tmpdir/usr/share/man/man1/empty.1"
|
||||
run $MANDB -C "$tmpdir/manpath.config" -u -q "$tmpdir/usr/share/man"
|
||||
# $? is deliberately expanded here.
|
||||
expect_pass 'empty page' "test $? -eq 0"
|
||||
|
||||
./fspause
|
||||
ln -s empty.1.gz "$tmpdir/usr/share/man/man1/empty2.1.gz"
|
||||
run $MANDB -C "$tmpdir/manpath.config" -u -q "$tmpdir/usr/share/man"
|
||||
# $? is deliberately expanded here.
|
||||
expect_pass 'symlink to empty page' "test $? -eq 0"
|
||||
|
||||
finish
|
25
tests/man-db/mandb-6
Executable file
25
tests/man-db/mandb-6
Executable file
@ -0,0 +1,25 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Test for double free or corruption crash with bogus filename and symlink of man page.
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=702904
|
||||
|
||||
: ${srcdir=.}
|
||||
. "$srcdir/testlib.sh"
|
||||
|
||||
: ${MANDB=mandb}
|
||||
|
||||
init
|
||||
fake_config /usr/share/man
|
||||
MANPATH="$tmpdir/usr/share/man"
|
||||
export MANPATH
|
||||
|
||||
mkdir -p "$tmpdir/usr/share/man/man8"
|
||||
mkdir -p "$tmpdir/usr/lib/aa-bbb"
|
||||
write_page test1 8 "$tmpdir/usr/lib/aa-bbb/aa-test1.8.gz" UTF-8 gz t \
|
||||
'test1 \- testing man page'
|
||||
ln -s "../../../lib/aa-bbb/aa-test1.8.gz" "$tmpdir/usr/share/man/man8/aa-test1.8.gz"
|
||||
run $MANDB -C "$tmpdir/manpath.config" -u -q "$tmpdir/usr/share/man"
|
||||
# $? is deliberately expanded here.
|
||||
expect_pass 'double free' "test $? -eq 0"
|
||||
|
||||
finish
|
28
tests/man-db/mandb-7
Executable file
28
tests/man-db/mandb-7
Executable file
@ -0,0 +1,28 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Don't create CACHEDIR.TAG in manpath
|
||||
|
||||
: ${srcdir=.}
|
||||
. "$srcdir/testlib.sh"
|
||||
|
||||
: ${MANDB=mandb}
|
||||
|
||||
init
|
||||
fake_config /usr/share/man
|
||||
mkdir -p "$tmpdir/usr/share/man"
|
||||
mkdir -p "$tmpdir/usr/dir/man"
|
||||
mkdir -p "$tmpdir/var/cache/man"
|
||||
echo "MANDATORY_MANPATH $abstmpdir/usr/share/man" > "$tmpdir/manpath.config"
|
||||
echo "MANDATORY_MANPATH $abstmpdir/usr/dir/man" >> "$tmpdir/manpath.config"
|
||||
echo "MANDB_MAP $abstmpdir/usr/share/man $abstmpdir/var/cache/man" >> "$tmpdir/manpath.config"
|
||||
|
||||
write_page test 1 "$tmpdir/usr/share/man/man1/test.1" UTF-8 '' '' \
|
||||
'test \- simple mandb test'
|
||||
write_page test2 1 "$tmpdir/usr/dir/man/man1/test2.1" UTF-8 '' '' \
|
||||
'test2 \- simple mandb test'
|
||||
run $MANDB -C "$tmpdir/manpath.config" -q "$tmpdir/usr/share/man:$tmpdir/usr/dir/man"
|
||||
expect_pass "CACHEDIR.TAG exists" "[ -e $tmpdir/var/cache/man/CACHEDIR.TAG ]"
|
||||
expect_pass "CACHEDIR.TAG doesn't exist 01" "[ ! -e $tmpdir/usr/share/man/CACHEDIR.TAG ]"
|
||||
expect_pass "CACHEDIR.TAG doesn't exist 02" "[ ! -e $tmpdir/usr/dir/man/CACHEDIR.TAG ]"
|
||||
|
||||
finish
|
105
tests/man-db/testlib.sh
Normal file
105
tests/man-db/testlib.sh
Normal file
@ -0,0 +1,105 @@
|
||||
failures=0
|
||||
|
||||
# Save tests the trouble of exporting variables they set when executing 'run'.
|
||||
export LC_ALL
|
||||
|
||||
# Isolate tests from whatever the system configuration may happen to be.
|
||||
MAN_TEST_DISABLE_SYSTEM_CONFIG=1
|
||||
export MAN_TEST_DISABLE_SYSTEM_CONFIG
|
||||
|
||||
init () {
|
||||
# Create a temporary directory in /tmp or ./ ,
|
||||
# put path to it into $tmpdir and $abstmpdir,
|
||||
# remove it on exit.
|
||||
{
|
||||
tmpdir=$(mktemp -d) &&
|
||||
abstmpdir="$tmpdir" &&
|
||||
test -d "$tmpdir"
|
||||
} || {
|
||||
tmpdir="tmp-${0##*/}"
|
||||
abstmpdir="$(pwd -P)/$tmpdir"
|
||||
mkdir "$tmpdir"
|
||||
} ||
|
||||
exit $?
|
||||
trap 'rm -rf "$tmpdir"' HUP INT QUIT TERM
|
||||
}
|
||||
|
||||
run () {
|
||||
"$@"
|
||||
}
|
||||
|
||||
fake_config () {
|
||||
for dir; do
|
||||
echo "MANDATORY_MANPATH $tmpdir$dir"
|
||||
done >"$tmpdir/manpath.config"
|
||||
}
|
||||
|
||||
db_ext () {
|
||||
case $DBTYPE in
|
||||
gdbm) echo .db ;;
|
||||
btree) echo .bt ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Arguments: name section path encoding compression_extension preprocessor_line name_line
|
||||
write_page () {
|
||||
mkdir -p "${3%/*}"
|
||||
>"$3.tmp1"
|
||||
if [ "$6" ]; then
|
||||
echo "'\\\" $6" >>"$3.tmp1"
|
||||
fi
|
||||
cat >>"$3.tmp1" <<EOF
|
||||
.TH $1 $2
|
||||
.SH NAME
|
||||
$7
|
||||
.SH DESCRIPTION
|
||||
test
|
||||
EOF
|
||||
iconv -f UTF-8 -t "$4" <"$3.tmp1" >"$3.tmp2"
|
||||
case $5 in
|
||||
'') cat ;;
|
||||
gz|z) gzip -9c ;;
|
||||
Z) compress -c ;;
|
||||
bz2) bzip2 -9c ;;
|
||||
lzma) lzma -9c ;;
|
||||
esac <"$3.tmp2" >"$3"
|
||||
rm -f "$3.tmp1" "$3.tmp2"
|
||||
}
|
||||
|
||||
accessdb_filter () {
|
||||
# e.g. 'test -> "- 1 1 1250702063 A - - gz simple mandb test"'
|
||||
run $ACCESSDB "$1" | grep -v '^\$' | \
|
||||
sed 's/\(-> "[^ ][^ ]* [^ ][^ ]* [^ ][^ ]* \)[^ ][^ ]* [^ ][^ ]* /\1MTIME /'
|
||||
}
|
||||
|
||||
expect_pass () {
|
||||
ret=0
|
||||
eval "$2" || ret=$?
|
||||
if [ "$ret" = 0 ]; then
|
||||
echo " PASS: $1"
|
||||
else
|
||||
failures="$(($failures + 1))"
|
||||
echo " FAIL: $1"
|
||||
fi
|
||||
}
|
||||
|
||||
skip () {
|
||||
echo " SKIP: $1"
|
||||
rm -rf "$abstmpdir"
|
||||
exit 77
|
||||
}
|
||||
|
||||
finish () {
|
||||
case $failures in
|
||||
0)
|
||||
rm -rf "$abstmpdir"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
if [ -z "$TEST_FAILURE_KEEP" ]; then
|
||||
rm -rf "$abstmpdir"
|
||||
fi
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
56
tests/man-db/whatis-1
Executable file
56
tests/man-db/whatis-1
Executable file
@ -0,0 +1,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
|
61
tests/man-db/zsoelim-1
Executable file
61
tests/man-db/zsoelim-1
Executable file
@ -0,0 +1,61 @@
|
||||
#! /bin/sh
|
||||
|
||||
# Test for:
|
||||
# http://bugs.debian.org/503472
|
||||
|
||||
: ${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
|
||||
|
||||
cat >"$tmpdir/fake-program" <<EOF
|
||||
#! /bin/sh
|
||||
exec cat
|
||||
EOF
|
||||
chmod +x "$tmpdir/fake-program"
|
||||
PATH="$abstmpdir:$PATH"
|
||||
export PATH
|
||||
|
||||
cat >>"$tmpdir/manpath.config" <<EOF
|
||||
DEFINE tbl fake-program
|
||||
DEFINE nroff fake-program
|
||||
EOF
|
||||
|
||||
write_page test 1 "$tmpdir/usr/share/man/man1/test.1" \
|
||||
UTF-8 '' '' 'test \- top-level test page'
|
||||
echo '.so man7/test2.7' >>"$tmpdir/usr/share/man/man1/test.1"
|
||||
write_page test2 7 "$tmpdir/usr/local/man/man7/test2.7" \
|
||||
UTF-8 '' '' 'test2 \- second-level local test page'
|
||||
echo '.so test3.1' >>"$tmpdir/usr/local/man/man7/test2.7"
|
||||
write_page test3 1 "$tmpdir/usr/local/man/man1/test3.1" \
|
||||
UTF-8 '' '' 'test3 \- third-level local test page'
|
||||
write_page test3 1 "$tmpdir/usr/share/man/man1/test3.1" \
|
||||
UTF-8 '' '' 'test3 \- third-level test page'
|
||||
cat >"$tmpdir/1.exp" <<'EOF'
|
||||
.TH test 1
|
||||
.SH NAME
|
||||
test \- top-level test page
|
||||
.SH DESCRIPTION
|
||||
test
|
||||
.TH test2 7
|
||||
.SH NAME
|
||||
test2 \- second-level local test page
|
||||
.SH DESCRIPTION
|
||||
test
|
||||
.TH test3 1
|
||||
.SH NAME
|
||||
test3 \- third-level test page
|
||||
.SH DESCRIPTION
|
||||
test
|
||||
EOF
|
||||
run $MAN -C "$tmpdir/manpath.config" test | \
|
||||
grep -v '^\.l[flt] ' >"$tmpdir/1.out"
|
||||
expect_pass 'test(1) expanded correctly' \
|
||||
'diff -u "$tmpdir/1.exp" "$tmpdir/1.out"'
|
||||
|
||||
finish
|
13
tests/tests.yml
Normal file
13
tests/tests.yml
Normal file
@ -0,0 +1,13 @@
|
||||
- hosts: localhost
|
||||
roles:
|
||||
- role: standard-test-beakerlib
|
||||
tags:
|
||||
- atomic
|
||||
- classic
|
||||
- container
|
||||
tests:
|
||||
- upstream-test-suite
|
||||
required_packages:
|
||||
- man-db
|
||||
- gcc
|
||||
- make
|
27
tests/upstream-test-suite
Executable file
27
tests/upstream-test-suite
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
. /usr/share/beakerlib/beakerlib.sh
|
||||
|
||||
TEST="/BaseOS/man-db/Sanity/upstream-test-suite"
|
||||
|
||||
PACKAGES=${PACKAGES:-"man-db"}
|
||||
REQUIRES=${REQUIRES:-"gcc make"}
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup
|
||||
rlAssertRpm --all
|
||||
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
|
||||
rlRun "cp -r man-db/* $TmpDir/." 0 "Copying test suite"
|
||||
rlRun "pushd $TmpDir"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest
|
||||
rlRun "make test" 0 "Running tests"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup
|
||||
rlRun "popd"
|
||||
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
|
||||
rlPhaseEnd
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
Loading…
Reference in New Issue
Block a user