[BACK]Return to regress.pl.1 CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc / regress

File: [cvsweb.bsd.lv] / mandoc / regress / regress.pl.1 (download)

Revision 1.5, Fri Mar 13 15:32:31 2020 UTC (4 years, 1 month ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_6, HEAD
Changes since 1.4: +5 -12 lines

Split tagging into a validation part including prioritization
in tag.{h,c} and {mdoc,man}_validate.c
and into a formatting part including command line argument checking
in term_tag.{h,c}, html.c, and {mdoc|man}_{term|html}.c.

Immediate functional benefits include:
* Improved prioritization of automatic tags for .Em and .Sy.
* Avoiding bogus automatic tags when .Em, .Fn, or .Sy are explicitly tagged.
* Explicit tagging of .Er and .Fl now works in HTML output.
* Automatic tagging of .IP and .TP now works in HTML output.
But mainly, this patch provides clean earth to build further improvements on.

Technical changes:
* Main program: Write a tag file for ASCII and UTF-8 output only.
* All formatters: There is no more need to delay writing the tags.
* mdoc(7)+man(7) formatters: No more need for elaborate syntax tree inspection.
* HTML formatter: If available, use the "string" attribute as the tag.
* HTML formatter: New function to write permalinks, to reduce code duplication.

Style cleanup in the vicinity while here:
* mdoc(7) terminal formatter: To set up bold font for children,
defer to termp_bold_pre() rather than calling term_fontpush() manually.
* mdoc(7) terminal formatter: Garbage collect some duplicate functions.
* mdoc(7) HTML formatter: Unify <code> handling, delete redundant functions.
* Where possible, use switch statements rather than if cascades.
* Get rid of some more Yoda notation.

The necessity for such changes was first discussed with kn@, but i didn't
bother him with a request to review the resulting -673/+782 line patch.

.\"	$Id: regress.pl.1,v 1.5 2020/03/13 15:32:31 schwarze Exp $
.\"
.\" Copyright (c) 2017, 2019, 2020 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: March 13 2020 $
.Dt REGRESS.PL 1
.Os
.Sh NAME
.Nm regress.pl
.Nd portable steering script for mandoc regression tests
.Sh SYNOPSIS
.Nm ./regress.pl
.Oo
.Ar directory Ns Op Pf / Ar test
.Op Ar modifier ...
.Oc
.Sh DESCRIPTION
The
.Nm
steering script allows running the
.Xr mandoc 1
regression suite on arbitrary operating systems,
even though the suite was originally designed for OpenBSD only.
.Pp
When run without an argument,
.Nm
runs the complete regression suite.
.Pp
The first argument is a Perl regular expression to match test names,
automatically anchored at the beginning of the names.
Test names are names of test input files without the file name extension
.Pa .in ,
for example
.Pa char/unicode/named .
.Pp
Any additional arguments modify the way the tests are run.
The default is
.Cm all .
The following modifiers are available:
.Bl -tag -width markdown
.It Cm all
Run all kinds of subtests.
This implies all other modifiers except
.Cm verbose
and
.Cm clean .
.It Cm ascii
Run subtests for
.Fl T Cm ascii
output mode.
.It Cm clean
Remove all output files created by running the tests.
.It Cm html
Run subtests for
.Fl T Cm html
output mode.
.It Cm lint
Run subtests for
.Fl T Cm lint
warning and error output.
.It Cm man
Run subtests for
.Fl T Cm man
output mode.
.It Cm markdown
Run subtests for
.Fl T Cm markdown
output mode.
.It Cm tag
Run subtests for automatic and manual tagging.
.It Cm utf8
Run subtests for
.Fl T Cm utf8
output mode.
.It Cm verbose
Display approximate indications of what is being done.
.El
.Sh EXIT STATUS
.Ex -std
.Sh EXAMPLES
The recommended invocation for casual users:
.Pp
.Dl ./regress.pl
.Pp
Maximum output:
.Pp
.Dl ./regress.pl \&. verbose
.Pp
Complete check, but keep the tree clean:
.Pp
.Dl ./regress.pl \&. all clean
.Pp
Investigate a specific failure:
.Pp
.Dl ./regress.pl mdoc/Bd/broken man verbose
.Sh HISTORY
The
.Nm
script appeared in release 1.14.1 of the portable
.Sy mandoc
distribution.
.Sh AUTHORS
.An Ingo Schwarze Aq Mt schwarze@openbsd.org
.Sh CAVEATS
This script is not optimized for elegance.
Regression suites for other software should not copy the design.
.Pp
The problem it solves is that the
.Sy mandoc
regression suite is tightly integrated into the regression
testing system of the OpenBSD base system, which requires
both OpenBSD
.Xr make 1 ,
working neither with POSIX make nor with GNU make, and which
also requires the OpenBSD-specific Makefile fragments in
.Pa /usr/share/mk .
The workaround of parsing the Makefiles by hand and constructing
the required command lines by hand is unavoidably messy; it's
the classic no-no of parsing a language with an ad-hoc incomplete
parser.
But the problem of providing this regression suite for other
operating systems stood unsolved for many years, and no cleaner
solution was found that could be implemented with reasonable effort.
So maybe this is better than nothing.
.Pp
The top-level Makefiles for running this regression suite on
OpenBSD are not included in the portable distribution.
They are too OpenBSD-specific to be useful elsewhere,
and on OpenBSD itself, the suite ought be run natively from
.Pa /usr/src/regress/usr.bin/mandoc
and not from the portable distribution.
.Pp
The
.Pa db
subdirectory of the regression suite is not included.
It uses a Makefile structure that differs vastly from the
rest of the suite.
.Sh BUGS
The C library function
.Xr wcwidth 3
is known to be buggy on Solaris, which may cause failures in the
regression suite, usually because output lines containing affected
Unicode characters wrap too early.
.Pp
The regression suite does not work at all on Solaris 10 or earlier
because the Perl interpreter provided with those systems is too old.