Import of ATF 0.4
Changes in this release: * Added two new manual pages, atf-c++-api and atf-sh-api, describing the C++ and POSIX shell interfaces used to write test programs. * Added a pkg-config file, useful to get the flags to build against the C++ library or to easily detect the presence of ATF. * Added a way for test cases to require a specific architecture and/or machine type through the new 'require.arch' and 'require.machine' meta-data properties, respectively. * Added the 'timeout' property to test cases, useful to set an upper-bound limit for the test's run time and thus prevent global test program stalls due to the test case's misbehavior. * Added the atf-exec(1) internal utility, used to execute a command after changing the process group it belongs to. * Added the atf-killpg(1) internal utility, used to kill process groups. * Multiple portability fixes. Of special interest, full support for SunOS (Solaris Express Developer Edition 2007/09) using the Sun Studio 12 C++ compiler. * Fixed a serious bug that prevented atf-run(1) from working at all under Fedora 8 x86_64. Due to the nature of the bug, other platforms were likely affected too.
This commit is contained in:
parent
0523aae770
commit
f6f54bd63a
|
@ -1,6 +1,6 @@
|
|||
Automated Testing Framework (atf)
|
||||
Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
All rights reserved.
|
||||
Automated Testing Framework (atf)
|
||||
The NetBSD Foundation, Inc.
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
|
||||
Authors
|
||||
|
@ -17,4 +17,5 @@ Authors
|
|||
Summer of Code 2007 program.
|
||||
|
||||
|
||||
-- EOF
|
||||
---------------------------------------------------------------------------
|
||||
End of document
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
Automated Testing Framework (atf)
|
||||
Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
All rights reserved.
|
||||
Automated Testing Framework (atf)
|
||||
The NetBSD Foundation, Inc.
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
|
||||
License
|
||||
=======
|
||||
|
||||
Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
@ -70,4 +70,5 @@ is put here just to clarify this fact.
|
|||
Author: Julio M. Merino Vidal <jmmv84@gmail.com>
|
||||
|
||||
|
||||
-- EOF
|
||||
---------------------------------------------------------------------------
|
||||
End of document
|
||||
|
|
|
@ -1,2 +1,31 @@
|
|||
This file was intentionally left empty.
|
||||
TODO: Explain how to see the logs.
|
||||
Automated Testing Framework (atf)
|
||||
The NetBSD Foundation, Inc.
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
|
||||
Detailed list of changes
|
||||
========================
|
||||
|
||||
ATF does not use this file because the detailed list of changes is
|
||||
available where it was meant to be: in the source code repository.
|
||||
The repository's history contains a much more detailed list of changes
|
||||
than what could be represented here, including ancestry graphs, patches
|
||||
between revisions and digital signatures of every change.
|
||||
|
||||
In order to access the repository, please visit ATF's web site for more
|
||||
instructions. At the time of this writing, the site was located at:
|
||||
|
||||
http://www.NetBSD.org/~jmmv/atf/
|
||||
|
||||
Also, at the time of this writing, the version control system used to
|
||||
manage the ATF source code tree was Monotone, whose last known address
|
||||
was:
|
||||
|
||||
http://www.monotone.ca/
|
||||
|
||||
Additionally you can find the list of the most important changes between
|
||||
formal releases in the NEWS file.
|
||||
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
End of document
|
||||
|
|
|
@ -1,234 +1,175 @@
|
|||
Installation Instructions
|
||||
*************************
|
||||
Automated Testing Framework (atf)
|
||||
The NetBSD Foundation, Inc.
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
|
||||
2006 Free Software Foundation, Inc.
|
||||
|
||||
This file is free documentation; the Free Software Foundation gives
|
||||
unlimited permission to copy, distribute and modify it.
|
||||
Introduction
|
||||
============
|
||||
|
||||
Basic Installation
|
||||
==================
|
||||
ATF uses the GNU Automake, GNU Autoconf and GNU Libtool utilities as its
|
||||
build system. These are used only when compiling the application from the
|
||||
source code package. If you want to install ATF from a binary package, you
|
||||
do not need to read this document.
|
||||
|
||||
Briefly, the shell commands `./configure; make; make install' should
|
||||
configure, build, and install this package. The following
|
||||
more-detailed instructions are generic; see the `README' file for
|
||||
instructions specific to this package.
|
||||
For the impatient:
|
||||
|
||||
The `configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a `Makefile' in each directory of the package.
|
||||
It may also create one or more `.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script `config.status' that
|
||||
you can run in the future to recreate the current configuration, and a
|
||||
file `config.log' containing compiler output (useful mainly for
|
||||
debugging `configure').
|
||||
$ ./configure
|
||||
$ make
|
||||
$ make check
|
||||
Gain root privileges
|
||||
# make install
|
||||
Drop root privileges
|
||||
$ make installcheck
|
||||
|
||||
It can also use an optional file (typically called `config.cache'
|
||||
and enabled with `--cache-file=config.cache' or simply `-C') that saves
|
||||
the results of its tests to speed up reconfiguring. Caching is
|
||||
disabled by default to prevent problems with accidental use of stale
|
||||
cache files.
|
||||
Or alternatively, install as a regular user into your home directory:
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how `configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the `README' so they can
|
||||
be considered for the next release. If you are using the cache, and at
|
||||
some point `config.cache' contains results you don't want to keep, you
|
||||
may remove or edit it.
|
||||
$ ./configure --prefix ~/local
|
||||
$ make
|
||||
$ make check
|
||||
$ make install
|
||||
$ make installcheck
|
||||
|
||||
The file `configure.ac' (or `configure.in') is used to create
|
||||
`configure' by a program called `autoconf'. You need `configure.ac' if
|
||||
you want to change it or regenerate `configure' using a newer version
|
||||
of `autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
Dependencies
|
||||
============
|
||||
|
||||
1. `cd' to the directory containing the package's source code and type
|
||||
`./configure' to configure the package for your system.
|
||||
To build and use ATF successfully you need:
|
||||
|
||||
Running `configure' might take a while. While running, it prints
|
||||
some messages telling which features it is checking for.
|
||||
* A standards-compliant C/C++ complier. For example, GNU GCC 2.95 will not
|
||||
work.
|
||||
* A POSIX shell interpreter.
|
||||
* A make(1) utility.
|
||||
|
||||
2. Type `make' to compile the package.
|
||||
If you are building ATF from the code on the repository, you will also need
|
||||
the following tools. The versions listed here are the ones used to build
|
||||
the files bundled in the last formal release, but these are not strictly
|
||||
required. Newer ones will most likely work and, maybe, some slightly older
|
||||
ones:
|
||||
|
||||
3. Optionally, type `make check' to run any self-tests that come with
|
||||
the package.
|
||||
* GNU autoconf 2.61
|
||||
* GNU automake 1.10
|
||||
* GNU libtool 1.5.24 (1.1220.2.455 2007/06/24 02:13:29)
|
||||
|
||||
4. Type `make install' to install the programs and any data files and
|
||||
documentation.
|
||||
|
||||
5. You can remove the program binaries and object files from the
|
||||
source code directory by typing `make clean'. To also remove the
|
||||
files that `configure' created (so you can compile the package for
|
||||
a different kind of computer), type `make distclean'. There is
|
||||
also a `make maintainer-clean' target, but that is intended mainly
|
||||
for the package's developers. If you use it, you may have to get
|
||||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
Regenerating the build system
|
||||
=============================
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
If you are building ATF from code extracted from the repository, you must
|
||||
first regenerate the files used by the build system. You will also need to
|
||||
do this if you modify one of configure.ac or Makefile.am. To do this,
|
||||
simply run:
|
||||
|
||||
Some systems require unusual options for compilation or linking that the
|
||||
`configure' script does not know about. Run `./configure --help' for
|
||||
details on some of the pertinent environment variables.
|
||||
$ autoreconf -is
|
||||
|
||||
You can give `configure' initial values for configuration parameters
|
||||
by setting variables in the command line or in the environment. Here
|
||||
is an example:
|
||||
For formal releases, no extra steps are needed.
|
||||
|
||||
./configure CC=c99 CFLAGS=-g LIBS=-lposix
|
||||
|
||||
*Note Defining Variables::, for more details.
|
||||
General build procedure
|
||||
=======================
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
To build and install the source package, you must follow these steps:
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you can use GNU `make'. `cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the `configure' script. `configure' automatically checks for the
|
||||
source code in the directory that `configure' is in and in `..'.
|
||||
1. Configure the sources to adapt to your operating system. This is done
|
||||
using the 'configure' script located on the sources' top directory, and
|
||||
it is usually invoked without arguments unless you want to change the
|
||||
installation prefix. More details on this procedure are given on a
|
||||
later section.
|
||||
|
||||
With a non-GNU `make', it is safer to compile the package for one
|
||||
architecture at a time in the source code directory. After you have
|
||||
installed the package for one architecture, use `make distclean' before
|
||||
reconfiguring for another architecture.
|
||||
2. Build the sources to generate the binaries and scripts. Simply run
|
||||
'make' on the sources' top directory after configuring them. No
|
||||
problems should arise.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
3. Check that the programs built in the previous step work before
|
||||
installing them. Run 'make check' for this. Any serious problems will
|
||||
pop up here. (Be aware that on, some systems, GNU Libtool will break
|
||||
these checks. If you get some failures, try reconfiguring the project
|
||||
providing the '--disable-fast-install' flag to 'configure' and then
|
||||
rebuild and recheck.
|
||||
|
||||
By default, `make install' installs the package's commands under
|
||||
`/usr/local/bin', include files under `/usr/local/include', etc. You
|
||||
can specify an installation prefix other than `/usr/local' by giving
|
||||
`configure' the option `--prefix=PREFIX'.
|
||||
4. Install the program by running 'make install'. You may need to become
|
||||
root to issue this step.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
|
||||
PREFIX as the prefix for installing programs and libraries.
|
||||
Documentation and other data files still use the regular prefix.
|
||||
5. Issue any manual installation steps that may be required. These are
|
||||
described later in their own section.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like `--bindir=DIR' to specify different values for particular
|
||||
kinds of files. Run `configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them.
|
||||
6. Check that the installed programs work by running 'make installcheck'.
|
||||
You do not need to be root to do this, even though some checks will not
|
||||
be run otherwise.
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving `configure' the
|
||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
Configuration flags
|
||||
===================
|
||||
|
||||
Some packages pay attention to `--enable-FEATURE' options to
|
||||
`configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||
is something like `gnu-as' or `x' (for the X Window System). The
|
||||
`README' should mention any `--enable-' and `--with-' options that the
|
||||
package recognizes.
|
||||
The most common, standard flags given to 'configure' are:
|
||||
|
||||
For packages that use the X Window System, `configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the `configure' options `--x-includes=DIR' and
|
||||
`--x-libraries=DIR' to specify their locations.
|
||||
* Flag: --prefix=directory
|
||||
Possible values: Any path
|
||||
Default: /usr/local
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
Specifies where the program (binaries and all associated files) will be
|
||||
installed.
|
||||
|
||||
There may be some features `configure' cannot figure out automatically,
|
||||
but needs to determine by the type of machine the package will run on.
|
||||
Usually, assuming the package is built to be run on the _same_
|
||||
architectures, `configure' can figure that out, but if it prints a
|
||||
message saying it cannot guess the machine type, give it the
|
||||
`--build=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name which has the form:
|
||||
* Flag: --sysconfdir=directory
|
||||
Possible values: Any path
|
||||
Default: /usr/local/etc
|
||||
|
||||
CPU-COMPANY-SYSTEM
|
||||
Specifies where the installed programs will look for configuration files.
|
||||
'/atf' will be appended to the given path unless ATF_CONFSUBDIR is
|
||||
redefined as explained later on.
|
||||
|
||||
where SYSTEM can have one of these forms:
|
||||
* Flag: --help
|
||||
|
||||
OS KERNEL-OS
|
||||
Shows information about all available flags and exits immediately,
|
||||
without running any configuration tasks.
|
||||
|
||||
See the file `config.sub' for the possible values of each field. If
|
||||
`config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the machine type.
|
||||
The following flags are specific to ATF's 'configure' script:
|
||||
|
||||
If you are _building_ compiler tools for cross-compiling, you should
|
||||
use the option `--target=TYPE' to select the type of system they will
|
||||
produce code for.
|
||||
* Variable: ATF_CONFSUBDIR
|
||||
Possible values: empty, a relative path.
|
||||
Default: atf.
|
||||
|
||||
If you want to _use_ a cross compiler, that generates code for a
|
||||
platform different from the build platform, you should specify the
|
||||
"host" platform (i.e., that on which the generated programs will
|
||||
eventually be run) with `--host=TYPE'.
|
||||
Specifies the subdirectory of the configuration directory (given by the
|
||||
--sysconfdir argument) under which ATF will search for its configuration
|
||||
files.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
* Variable: ATF_WORKDIR
|
||||
Possible values: empty, an absolute path.
|
||||
Default: /tmp or /var/tmp, depending on availability.
|
||||
|
||||
If you want to set default values for `configure' scripts to share, you
|
||||
can create a site shell script called `config.site' that gives default
|
||||
values for variables like `CC', `cache_file', and `prefix'.
|
||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
`CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all `configure' scripts look for a site script.
|
||||
Specifies the directory that ATF will use to place its temporary files
|
||||
and work directories for test cases. This is just a default and can
|
||||
be overriden at run time.
|
||||
|
||||
Defining Variables
|
||||
==================
|
||||
* Flag: --enable-developer
|
||||
Possible values: yes, no
|
||||
Default: Depends on the version number. Stable versions define this
|
||||
to 'no' while all others have it set to 'yes'.
|
||||
|
||||
Variables not defined in a site shell script can be set in the
|
||||
environment passed to `configure'. However, some packages may run
|
||||
configure again during the build, and the customized values of these
|
||||
variables may be lost. In order to avoid this problem, you should set
|
||||
them in the `configure' command line, using `VAR=value'. For example:
|
||||
Enables several features useful for development, such as the inclusion
|
||||
of debugging symbols in all objects or the enabling of warnings during
|
||||
compilation.
|
||||
|
||||
./configure CC=/usr/local2/bin/gcc
|
||||
* Flag: --enable-unstable-shared
|
||||
Possible values: yes, no
|
||||
Default: no.
|
||||
|
||||
causes the specified `gcc' to be used as the C compiler (unless it is
|
||||
overridden in the site shell script).
|
||||
Forces the building of shared libraries in addition to static ones.
|
||||
The build of shared libraries is currently disabled because their ABIs
|
||||
and APIs are unstable and subject to change. This flag is provided for
|
||||
development purposes only and will be removed once the libraries are
|
||||
stable enough.
|
||||
|
||||
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
|
||||
an Autoconf bug. Until the bug is fixed you can use this workaround:
|
||||
|
||||
CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
|
||||
Post-installation steps
|
||||
=======================
|
||||
|
||||
`configure' Invocation
|
||||
======================
|
||||
After installing ATF, you have to register the DTDs it provides into the
|
||||
system-wide XML catalog. See the comments at the top of the files in
|
||||
${datadir}/share/xml/atf to see the correct public identifiers. This
|
||||
directory will typically be /usr/local/share/xml/atf or /usr/share/xml/atf.
|
||||
Failure to do so will lead to further errors when processing the XML
|
||||
files generated by atf-report.
|
||||
|
||||
`configure' recognizes the following options to control how it operates.
|
||||
|
||||
`--help'
|
||||
`-h'
|
||||
Print a summary of the options to `configure', and exit.
|
||||
|
||||
`--version'
|
||||
`-V'
|
||||
Print the version of Autoconf used to generate the `configure'
|
||||
script, and exit.
|
||||
|
||||
`--cache-file=FILE'
|
||||
Enable the cache: use and save the results of the tests in FILE,
|
||||
traditionally `config.cache'. FILE defaults to `/dev/null' to
|
||||
disable caching.
|
||||
|
||||
`--config-cache'
|
||||
`-C'
|
||||
Alias for `--cache-file=config.cache'.
|
||||
|
||||
`--quiet'
|
||||
`--silent'
|
||||
`-q'
|
||||
Do not print messages saying which checks are being made. To
|
||||
suppress all normal output, redirect it to `/dev/null' (any error
|
||||
messages will still be shown).
|
||||
|
||||
`--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
`configure' can determine that directory automatically.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options. Run
|
||||
`configure --help' for more details.
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
End of document
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#
|
||||
# Automated Testing Framework (atf)
|
||||
#
|
||||
# Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
# Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
|
@ -41,10 +41,12 @@
|
|||
doc_DATA = AUTHORS COPYING NEWS README ROADMAP
|
||||
EXTRA_DIST = $(doc_DATA)
|
||||
|
||||
dist-hook: admin/revision-dist.h check-readme check-style
|
||||
dist-hook: $(srcdir)/admin/revision-dist.h check-install check-style
|
||||
|
||||
AM_CPPFLAGS = -DATF_CONFDIR=\"$(atf_confdir)\" \
|
||||
AM_CPPFLAGS = -DATF_ARCH=\"$(atf_arch)\" \
|
||||
-DATF_CONFDIR=\"$(atf_confdir)\" \
|
||||
-DATF_LIBEXECDIR=\"$(libexecdir)\" \
|
||||
-DATF_MACHINE=\"$(atf_machine)\" \
|
||||
-DATF_PKGDATADIR=\"$(pkgdatadir)\" \
|
||||
-DATF_SHELL=\"$(ATF_SHELL)\" \
|
||||
-DATF_WORKDIR=\"$(ATF_WORKDIR)\"
|
||||
|
@ -57,15 +59,15 @@ ATF_COMPILE_SH = ./tools/atf-host-compile
|
|||
# `admin' directory.
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
.PHONY: check-readme
|
||||
check-readme:
|
||||
$(srcdir)/admin/check-readme.sh $(srcdir)/README
|
||||
.PHONY: check-install
|
||||
check-install:
|
||||
$(srcdir)/admin/check-install.sh $(srcdir)/INSTALL
|
||||
|
||||
.phony: check-style
|
||||
check-style:
|
||||
$(srcdir)/admin/check-style.sh
|
||||
|
||||
EXTRA_DIST += admin/check-readme.sh \
|
||||
EXTRA_DIST += admin/check-install.sh \
|
||||
admin/check-style-common.awk \
|
||||
admin/check-style-cpp.awk \
|
||||
admin/check-style-man.awk \
|
||||
|
@ -121,6 +123,8 @@ libatf_la_SOURCES = atf/application.cpp \
|
|||
atf/parser.hpp \
|
||||
atf/sanity.cpp \
|
||||
atf/sanity.hpp \
|
||||
atf/signals.cpp \
|
||||
atf/signals.hpp \
|
||||
atf/tests.cpp \
|
||||
atf/tests.hpp \
|
||||
atf/text.cpp \
|
||||
|
@ -151,6 +155,8 @@ atf_HEADERS = atf/application.hpp \
|
|||
atf/utils.hpp
|
||||
atfdir = $(includedir)/atf
|
||||
|
||||
dist_man_MANS = atf/atf-c++-api.3
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# `data' directory.
|
||||
# -------------------------------------------------------------------------
|
||||
|
@ -167,6 +173,19 @@ egdir = $(atf_egdir)
|
|||
eg_DATA = data/atf-run.hooks
|
||||
EXTRA_DIST += $(eg_DATA)
|
||||
|
||||
pkgconfigdir = $(atf_pkgconfigdir)
|
||||
pkgconfig_DATA = data/atf.pc
|
||||
CLEANFILES += data/atf.pc
|
||||
EXTRA_DIST += data/atf.pc.in
|
||||
data/atf.pc: $(srcdir)/data/atf.pc.in
|
||||
test -d data || mkdir -p data
|
||||
sed -e 's,__ATF_VERSION__,@PACKAGE_VERSION@,g' \
|
||||
-e 's,__CXX__,$(CXX),g' \
|
||||
-e 's,__INCLUDEDIR__,$(includedir),g' \
|
||||
-e 's,__LIBDIR__,$(libdir),g' \
|
||||
<$(srcdir)/data/atf.pc.in >data/atf.pc.tmp
|
||||
mv data/atf.pc.tmp data/atf.pc
|
||||
|
||||
xsldir = $(atf_xsldir)
|
||||
xsl_DATA = data/tests-results.xsl
|
||||
EXTRA_DIST += $(xsl_DATA)
|
||||
|
@ -179,9 +198,9 @@ man_MANS = doc/atf.7
|
|||
CLEANFILES += doc/atf.7
|
||||
EXTRA_DIST += doc/atf.7.in
|
||||
|
||||
dist_man_MANS = doc/atf-formats.5 \
|
||||
doc/atf-test-case.4 \
|
||||
doc/atf-test-program.1
|
||||
dist_man_MANS += doc/atf-formats.5 \
|
||||
doc/atf-test-case.4 \
|
||||
doc/atf-test-program.1
|
||||
|
||||
doc/atf.7: $(srcdir)/doc/atf.7.in
|
||||
test -d doc || mkdir -p doc
|
||||
|
@ -189,17 +208,24 @@ doc/atf.7: $(srcdir)/doc/atf.7.in
|
|||
<$(srcdir)/doc/atf.7.in >doc/atf.7.tmp
|
||||
mv doc/atf.7.tmp doc/atf.7
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# `m4' directory.
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# `subrs' directory.
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
subrs_DATA = subrs/atf.config.subr \
|
||||
subrs/atf.footer.subr \
|
||||
subrs_DATA = subrs/atf.footer.subr \
|
||||
subrs/atf.header.subr \
|
||||
subrs/atf.init.subr
|
||||
subrsdir = $(pkgdatadir)
|
||||
EXTRA_DIST += $(subrs_DATA)
|
||||
|
||||
dist_man_MANS += subrs/atf-sh-api.3
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# `tests/bootstrap' directory.
|
||||
# -------------------------------------------------------------------------
|
||||
|
@ -288,11 +314,32 @@ testsdir = $(exec_prefix)/tests
|
|||
pkgtestsdir = $(exec_prefix)/tests/atf
|
||||
|
||||
installcheck-local:
|
||||
cd $(pkgtestsdir) && $(TESTS_ENVIRONMENT) atf-run | atf-report
|
||||
logfile=$$(pwd)/installcheck.log; \
|
||||
cd $(pkgtestsdir); \
|
||||
$(TESTS_ENVIRONMENT) atf-run | tee $${logfile} | atf-report; \
|
||||
res=$${?}; \
|
||||
echo; \
|
||||
echo "The verbatim output of atf-run has been saved to" \
|
||||
"installcheck.log"; \
|
||||
exit $${res}
|
||||
CLEANFILES += installcheck.log
|
||||
|
||||
pkgtests_DATA = tests/atf/Atffile
|
||||
EXTRA_DIST += $(pkgtests_DATA)
|
||||
|
||||
atf_data_DATA = tests/atf/data/Atffile
|
||||
atf_datadir = $(pkgtestsdir)/data
|
||||
EXTRA_DIST += $(atf_data_DATA)
|
||||
|
||||
atf_data_SCRIPTS = tests/atf/data/t_pkg_config
|
||||
CLEANFILES += tests/atf/data/t_pkg_config
|
||||
EXTRA_DIST += tests/atf/data/t_pkg_config.sh
|
||||
tests/atf/data/t_pkg_config: \
|
||||
$(srcdir)/tests/atf/data/t_pkg_config.sh \
|
||||
$(ATF_COMPILE_DEPS)
|
||||
test -d tests/atf/data || mkdir -p tests/atf/data
|
||||
$(ATF_COMPILE_SH) -o $@ $(srcdir)/tests/atf/data/t_pkg_config.sh
|
||||
|
||||
atf_formats_DATA = tests/atf/formats/Atffile \
|
||||
tests/atf/formats/d_atffile_1 \
|
||||
tests/atf/formats/d_atffile_1.expout \
|
||||
|
@ -680,6 +727,22 @@ tests/atf/tools/t_atf_config: $(srcdir)/tests/atf/tools/t_atf_config.sh \
|
|||
test -d tests/atf/tools || mkdir -p tests/atf/tools
|
||||
$(ATF_COMPILE_SH) -o $@ $(srcdir)/tests/atf/tools/t_atf_config.sh
|
||||
|
||||
atf_tools_SCRIPTS += tests/atf/tools/t_atf_exec
|
||||
CLEANFILES += tests/atf/tools/t_atf_exec
|
||||
EXTRA_DIST += tests/atf/tools/t_atf_exec.sh
|
||||
tests/atf/tools/t_atf_exec: $(srcdir)/tests/atf/tools/t_atf_exec.sh \
|
||||
$(ATF_COMPILE_DEPS)
|
||||
test -d tests/atf/tools || mkdir -p tests/atf/tools
|
||||
$(ATF_COMPILE_SH) -o $@ $(srcdir)/tests/atf/tools/t_atf_exec.sh
|
||||
|
||||
atf_tools_SCRIPTS += tests/atf/tools/t_atf_killpg
|
||||
CLEANFILES += tests/atf/tools/t_atf_killpg
|
||||
EXTRA_DIST += tests/atf/tools/t_atf_killpg.sh
|
||||
tests/atf/tools/t_atf_killpg: $(srcdir)/tests/atf/tools/t_atf_killpg.sh \
|
||||
$(ATF_COMPILE_DEPS)
|
||||
test -d tests/atf/tools || mkdir -p tests/atf/tools
|
||||
$(ATF_COMPILE_SH) -o $@ $(srcdir)/tests/atf/tools/t_atf_killpg.sh
|
||||
|
||||
atf_tools_SCRIPTS += tests/atf/tools/t_atf_report
|
||||
CLEANFILES += tests/atf/tools/t_atf_report
|
||||
EXTRA_DIST += tests/atf/tools/t_atf_report.sh
|
||||
|
@ -735,6 +798,11 @@ tests_atf_units_t_sanity_SOURCES = tests/atf/units/t_sanity.cpp
|
|||
tests_atf_units_t_sanity_LDADD = -latf
|
||||
tests_atf_units_t_sanity_LDFLAGS = -L.
|
||||
|
||||
atf_units_PROGRAMS += tests/atf/units/t_signals
|
||||
tests_atf_units_t_signals_SOURCES = tests/atf/units/t_signals.cpp
|
||||
tests_atf_units_t_signals_LDADD = -latf
|
||||
tests_atf_units_t_signals_LDFLAGS = -L.
|
||||
|
||||
atf_units_PROGRAMS += tests/atf/units/t_tests
|
||||
tests_atf_units_t_tests_SOURCES = tests/atf/units/t_tests.cpp
|
||||
tests_atf_units_t_tests_LDADD = -latf
|
||||
|
@ -775,11 +843,13 @@ tests_build_libuseless_a_SOURCES = \
|
|||
tests/build/t_include_macros_hpp.cpp \
|
||||
tests/build/t_include_parser_hpp.cpp \
|
||||
tests/build/t_include_sanity_hpp.cpp \
|
||||
tests/build/t_include_signals_hpp.cpp \
|
||||
tests/build/t_include_tests_hpp.cpp \
|
||||
tests/build/t_include_text_hpp.cpp \
|
||||
tests/build/t_include_ui_hpp.cpp \
|
||||
tests/build/t_include_user_hpp.cpp \
|
||||
tests/build/t_include_utils_hpp.cpp
|
||||
tests/build/t_include_utils_hpp.cpp \
|
||||
tests/build/t_use_macros_hpp.cpp
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# `tools' directory.
|
||||
|
@ -814,12 +884,24 @@ tools_atf_compile_LDADD = -latf
|
|||
tools_atf_compile_LDFLAGS = -L.
|
||||
dist_man_MANS += tools/atf-compile.1
|
||||
|
||||
libexec_PROGRAMS += tools/atf-exec
|
||||
tools_atf_exec_SOURCES = tools/atf-exec.cpp
|
||||
tools_atf_exec_LDADD = -latf
|
||||
tools_atf_exec_LDFLAGS = -L.
|
||||
dist_man_MANS += tools/atf-exec.1
|
||||
|
||||
libexec_PROGRAMS += tools/atf-format
|
||||
tools_atf_format_SOURCES = tools/atf-format.cpp
|
||||
tools_atf_format_LDADD = -latf
|
||||
tools_atf_format_LDFLAGS = -L.
|
||||
dist_man_MANS += tools/atf-format.1
|
||||
|
||||
libexec_PROGRAMS += tools/atf-killpg
|
||||
tools_atf_killpg_SOURCES = tools/atf-killpg.cpp
|
||||
tools_atf_killpg_LDADD = -latf
|
||||
tools_atf_killpg_LDFLAGS = -L.
|
||||
dist_man_MANS += tools/atf-killpg.1
|
||||
|
||||
bin_PROGRAMS += tools/atf-report
|
||||
tools_atf_report_SOURCES = tools/atf-report.cpp
|
||||
tools_atf_report_LDADD = -latf
|
||||
|
@ -839,7 +921,7 @@ tools_atf_version_LDFLAGS = -L.
|
|||
dist_man_MANS += tools/atf-version.1
|
||||
|
||||
BUILT_SOURCES = revision.h
|
||||
revision.h: admin/revision.h admin/revision-dist.h
|
||||
revision.h: admin/revision.h $(srcdir)/admin/revision-dist.h
|
||||
@if [ -f admin/revision.h ]; then \
|
||||
cmp -s admin/revision.h revision.h || \
|
||||
cp admin/revision.h revision.h; \
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#
|
||||
# Automated Testing Framework (atf)
|
||||
#
|
||||
# Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
# Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
|
@ -76,6 +76,7 @@ PRE_UNINSTALL = :
|
|||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
target_triplet = @target@
|
||||
check_PROGRAMS = tests/bootstrap/h_app_empty$(EXEEXT) \
|
||||
tests/bootstrap/h_app_opts_args$(EXEEXT) \
|
||||
tests/bootstrap/h_tp_basic_cpp$(EXEEXT)
|
||||
|
@ -92,6 +93,7 @@ atf_units_PROGRAMS = tests/atf/units/t_config$(EXEEXT) \
|
|||
tests/atf/units/t_fs$(EXEEXT) tests/atf/units/t_io$(EXEEXT) \
|
||||
tests/atf/units/t_parser$(EXEEXT) \
|
||||
tests/atf/units/t_sanity$(EXEEXT) \
|
||||
tests/atf/units/t_signals$(EXEEXT) \
|
||||
tests/atf/units/t_tests$(EXEEXT) \
|
||||
tests/atf/units/t_text$(EXEEXT) \
|
||||
tests/atf/units/t_user$(EXEEXT) \
|
||||
|
@ -99,25 +101,28 @@ atf_units_PROGRAMS = tests/atf/units/t_config$(EXEEXT) \
|
|||
bin_PROGRAMS = tools/atf-config$(EXEEXT) tools/atf-compile$(EXEEXT) \
|
||||
tools/atf-report$(EXEEXT) tools/atf-run$(EXEEXT) \
|
||||
tools/atf-version$(EXEEXT)
|
||||
libexec_PROGRAMS = tools/atf-cleanup$(EXEEXT) \
|
||||
tools/atf-format$(EXEEXT)
|
||||
libexec_PROGRAMS = tools/atf-cleanup$(EXEEXT) tools/atf-exec$(EXEEXT) \
|
||||
tools/atf-format$(EXEEXT) tools/atf-killpg$(EXEEXT)
|
||||
subdir = .
|
||||
DIST_COMMON = README $(am__configure_deps) $(atf_HEADERS) \
|
||||
$(dist_man_MANS) $(include_HEADERS) $(srcdir)/Makefile.am \
|
||||
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
|
||||
$(top_srcdir)/configure $(top_srcdir)/subrs/atf.config.subr.in \
|
||||
AUTHORS COPYING ChangeLog INSTALL NEWS admin/config.guess \
|
||||
admin/config.sub admin/depcomp admin/install-sh \
|
||||
admin/ltmain.sh admin/missing
|
||||
$(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \
|
||||
admin/config.guess admin/config.sub admin/depcomp \
|
||||
admin/install-sh admin/ltmain.sh admin/missing
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/cxx-std-funcs.m4 \
|
||||
$(top_srcdir)/m4/developer-mode.m4 \
|
||||
$(top_srcdir)/m4/module-application.m4 \
|
||||
$(top_srcdir)/m4/module-env.m4 $(top_srcdir)/m4/module-fs.m4 \
|
||||
$(top_srcdir)/m4/module-sanity.m4 $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
||||
configure.lineno config.status.lineno
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = config.h
|
||||
CONFIG_CLEAN_FILES = subrs/atf.config.subr
|
||||
CONFIG_CLEAN_FILES =
|
||||
ARFLAGS = cru
|
||||
tests_build_libuseless_a_AR = $(AR) $(ARFLAGS)
|
||||
tests_build_libuseless_a_LIBADD =
|
||||
|
@ -136,11 +141,13 @@ am_tests_build_libuseless_a_OBJECTS = \
|
|||
tests/build/t_include_macros_hpp.$(OBJEXT) \
|
||||
tests/build/t_include_parser_hpp.$(OBJEXT) \
|
||||
tests/build/t_include_sanity_hpp.$(OBJEXT) \
|
||||
tests/build/t_include_signals_hpp.$(OBJEXT) \
|
||||
tests/build/t_include_tests_hpp.$(OBJEXT) \
|
||||
tests/build/t_include_text_hpp.$(OBJEXT) \
|
||||
tests/build/t_include_ui_hpp.$(OBJEXT) \
|
||||
tests/build/t_include_user_hpp.$(OBJEXT) \
|
||||
tests/build/t_include_utils_hpp.$(OBJEXT)
|
||||
tests/build/t_include_utils_hpp.$(OBJEXT) \
|
||||
tests/build/t_use_macros_hpp.$(OBJEXT)
|
||||
tests_build_libuseless_a_OBJECTS = \
|
||||
$(am_tests_build_libuseless_a_OBJECTS)
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
|
@ -153,27 +160,29 @@ am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(atf_formatsdir)" \
|
|||
"$(DESTDIR)$(atf_test_programsdir)" \
|
||||
"$(DESTDIR)$(atf_toolsdir)" "$(DESTDIR)$(atf_unitsdir)" \
|
||||
"$(DESTDIR)$(bindir)" "$(DESTDIR)$(libexecdir)" \
|
||||
"$(DESTDIR)$(atf_formatsdir)" \
|
||||
"$(DESTDIR)$(atf_datadir)" "$(DESTDIR)$(atf_formatsdir)" \
|
||||
"$(DESTDIR)$(atf_sh_interfacedir)" \
|
||||
"$(DESTDIR)$(atf_test_programsdir)" \
|
||||
"$(DESTDIR)$(atf_toolsdir)" "$(DESTDIR)$(man1dir)" \
|
||||
"$(DESTDIR)$(man4dir)" "$(DESTDIR)$(man5dir)" \
|
||||
"$(DESTDIR)$(man7dir)" "$(DESTDIR)$(atf_formatsdir)" \
|
||||
"$(DESTDIR)$(man3dir)" "$(DESTDIR)$(man4dir)" \
|
||||
"$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man7dir)" \
|
||||
"$(DESTDIR)$(atf_datadir)" "$(DESTDIR)$(atf_formatsdir)" \
|
||||
"$(DESTDIR)$(atf_sh_interfacedir)" \
|
||||
"$(DESTDIR)$(atf_test_programsdir)" \
|
||||
"$(DESTDIR)$(atf_toolsdir)" "$(DESTDIR)$(atf_unitsdir)" \
|
||||
"$(DESTDIR)$(cssdir)" "$(DESTDIR)$(docdir)" \
|
||||
"$(DESTDIR)$(dtddir)" "$(DESTDIR)$(egdir)" \
|
||||
"$(DESTDIR)$(hooksdir)" "$(DESTDIR)$(pkgtestsdir)" \
|
||||
"$(DESTDIR)$(subrsdir)" "$(DESTDIR)$(xsldir)" \
|
||||
"$(DESTDIR)$(atfdir)" "$(DESTDIR)$(includedir)"
|
||||
"$(DESTDIR)$(hooksdir)" "$(DESTDIR)$(pkgconfigdir)" \
|
||||
"$(DESTDIR)$(pkgtestsdir)" "$(DESTDIR)$(subrsdir)" \
|
||||
"$(DESTDIR)$(xsldir)" "$(DESTDIR)$(atfdir)" \
|
||||
"$(DESTDIR)$(includedir)"
|
||||
libLTLIBRARIES_INSTALL = $(INSTALL)
|
||||
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||
libatf_la_LIBADD =
|
||||
am_libatf_la_OBJECTS = atf/application.lo atf/atffile.lo atf/config.lo \
|
||||
atf/env.lo atf/exceptions.lo atf/expand.lo atf/formats.lo \
|
||||
atf/fs.lo atf/io.lo atf/parser.lo atf/sanity.lo atf/tests.lo \
|
||||
atf/text.lo atf/ui.lo atf/user.lo
|
||||
atf/fs.lo atf/io.lo atf/parser.lo atf/sanity.lo atf/signals.lo \
|
||||
atf/tests.lo atf/text.lo atf/ui.lo atf/user.lo
|
||||
libatf_la_OBJECTS = $(am_libatf_la_OBJECTS)
|
||||
atf_formatsPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
|
||||
atf_test_programsPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
|
||||
|
@ -289,6 +298,15 @@ tests_atf_units_t_sanity_LINK = $(LIBTOOL) --tag=CXX \
|
|||
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \
|
||||
$(AM_CXXFLAGS) $(CXXFLAGS) $(tests_atf_units_t_sanity_LDFLAGS) \
|
||||
$(LDFLAGS) -o $@
|
||||
am_tests_atf_units_t_signals_OBJECTS = \
|
||||
tests/atf/units/t_signals.$(OBJEXT)
|
||||
tests_atf_units_t_signals_OBJECTS = \
|
||||
$(am_tests_atf_units_t_signals_OBJECTS)
|
||||
tests_atf_units_t_signals_DEPENDENCIES =
|
||||
tests_atf_units_t_signals_LINK = $(LIBTOOL) --tag=CXX \
|
||||
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \
|
||||
$(AM_CXXFLAGS) $(CXXFLAGS) \
|
||||
$(tests_atf_units_t_signals_LDFLAGS) $(LDFLAGS) -o $@
|
||||
am_tests_atf_units_t_tests_OBJECTS = \
|
||||
tests/atf/units/t_tests.$(OBJEXT)
|
||||
tests_atf_units_t_tests_OBJECTS = \
|
||||
|
@ -364,12 +382,24 @@ tools_atf_config_DEPENDENCIES =
|
|||
tools_atf_config_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
|
||||
$(CXXFLAGS) $(tools_atf_config_LDFLAGS) $(LDFLAGS) -o $@
|
||||
am_tools_atf_exec_OBJECTS = tools/atf-exec.$(OBJEXT)
|
||||
tools_atf_exec_OBJECTS = $(am_tools_atf_exec_OBJECTS)
|
||||
tools_atf_exec_DEPENDENCIES =
|
||||
tools_atf_exec_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
|
||||
$(CXXFLAGS) $(tools_atf_exec_LDFLAGS) $(LDFLAGS) -o $@
|
||||
am_tools_atf_format_OBJECTS = tools/atf-format.$(OBJEXT)
|
||||
tools_atf_format_OBJECTS = $(am_tools_atf_format_OBJECTS)
|
||||
tools_atf_format_DEPENDENCIES =
|
||||
tools_atf_format_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
|
||||
$(CXXFLAGS) $(tools_atf_format_LDFLAGS) $(LDFLAGS) -o $@
|
||||
am_tools_atf_killpg_OBJECTS = tools/atf-killpg.$(OBJEXT)
|
||||
tools_atf_killpg_OBJECTS = $(am_tools_atf_killpg_OBJECTS)
|
||||
tools_atf_killpg_DEPENDENCIES =
|
||||
tools_atf_killpg_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
|
||||
$(CXXFLAGS) $(tools_atf_killpg_LDFLAGS) $(LDFLAGS) -o $@
|
||||
am_tools_atf_report_OBJECTS = tools/atf-report.$(OBJEXT)
|
||||
tools_atf_report_OBJECTS = $(am_tools_atf_report_OBJECTS)
|
||||
tools_atf_report_DEPENDENCIES =
|
||||
|
@ -388,12 +418,14 @@ tools_atf_version_DEPENDENCIES =
|
|||
tools_atf_version_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
|
||||
$(CXXFLAGS) $(tools_atf_version_LDFLAGS) $(LDFLAGS) -o $@
|
||||
atf_dataSCRIPT_INSTALL = $(INSTALL_SCRIPT)
|
||||
atf_formatsSCRIPT_INSTALL = $(INSTALL_SCRIPT)
|
||||
atf_sh_interfaceSCRIPT_INSTALL = $(INSTALL_SCRIPT)
|
||||
atf_test_programsSCRIPT_INSTALL = $(INSTALL_SCRIPT)
|
||||
atf_toolsSCRIPT_INSTALL = $(INSTALL_SCRIPT)
|
||||
SCRIPTS = $(atf_formats_SCRIPTS) $(atf_sh_interface_SCRIPTS) \
|
||||
$(atf_test_programs_SCRIPTS) $(atf_tools_SCRIPTS)
|
||||
SCRIPTS = $(atf_data_SCRIPTS) $(atf_formats_SCRIPTS) \
|
||||
$(atf_sh_interface_SCRIPTS) $(atf_test_programs_SCRIPTS) \
|
||||
$(atf_tools_SCRIPTS)
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@
|
||||
depcomp = $(SHELL) $(top_srcdir)/admin/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
|
@ -430,6 +462,7 @@ SOURCES = $(tests_build_libuseless_a_SOURCES) $(libatf_la_SOURCES) \
|
|||
$(tests_atf_units_t_io_SOURCES) \
|
||||
$(tests_atf_units_t_parser_SOURCES) \
|
||||
$(tests_atf_units_t_sanity_SOURCES) \
|
||||
$(tests_atf_units_t_signals_SOURCES) \
|
||||
$(tests_atf_units_t_tests_SOURCES) \
|
||||
$(tests_atf_units_t_text_SOURCES) \
|
||||
$(tests_atf_units_t_user_SOURCES) \
|
||||
|
@ -438,7 +471,8 @@ SOURCES = $(tests_build_libuseless_a_SOURCES) $(libatf_la_SOURCES) \
|
|||
$(tests_bootstrap_h_app_opts_args_SOURCES) \
|
||||
$(tests_bootstrap_h_tp_basic_cpp_SOURCES) \
|
||||
$(tools_atf_cleanup_SOURCES) $(tools_atf_compile_SOURCES) \
|
||||
$(tools_atf_config_SOURCES) $(tools_atf_format_SOURCES) \
|
||||
$(tools_atf_config_SOURCES) $(tools_atf_exec_SOURCES) \
|
||||
$(tools_atf_format_SOURCES) $(tools_atf_killpg_SOURCES) \
|
||||
$(tools_atf_report_SOURCES) $(tools_atf_run_SOURCES) \
|
||||
$(tools_atf_version_SOURCES)
|
||||
DIST_SOURCES = $(tests_build_libuseless_a_SOURCES) \
|
||||
|
@ -456,6 +490,7 @@ DIST_SOURCES = $(tests_build_libuseless_a_SOURCES) \
|
|||
$(tests_atf_units_t_io_SOURCES) \
|
||||
$(tests_atf_units_t_parser_SOURCES) \
|
||||
$(tests_atf_units_t_sanity_SOURCES) \
|
||||
$(tests_atf_units_t_signals_SOURCES) \
|
||||
$(tests_atf_units_t_tests_SOURCES) \
|
||||
$(tests_atf_units_t_text_SOURCES) \
|
||||
$(tests_atf_units_t_user_SOURCES) \
|
||||
|
@ -464,15 +499,18 @@ DIST_SOURCES = $(tests_build_libuseless_a_SOURCES) \
|
|||
$(tests_bootstrap_h_app_opts_args_SOURCES) \
|
||||
$(tests_bootstrap_h_tp_basic_cpp_SOURCES) \
|
||||
$(tools_atf_cleanup_SOURCES) $(tools_atf_compile_SOURCES) \
|
||||
$(tools_atf_config_SOURCES) $(tools_atf_format_SOURCES) \
|
||||
$(tools_atf_config_SOURCES) $(tools_atf_exec_SOURCES) \
|
||||
$(tools_atf_format_SOURCES) $(tools_atf_killpg_SOURCES) \
|
||||
$(tools_atf_report_SOURCES) $(tools_atf_run_SOURCES) \
|
||||
$(tools_atf_version_SOURCES)
|
||||
man1dir = $(mandir)/man1
|
||||
man3dir = $(mandir)/man3
|
||||
man4dir = $(mandir)/man4
|
||||
man5dir = $(mandir)/man5
|
||||
man7dir = $(mandir)/man7
|
||||
NROFF = nroff
|
||||
MANS = $(dist_man_MANS) $(man_MANS)
|
||||
atf_dataDATA_INSTALL = $(INSTALL_DATA)
|
||||
atf_formatsDATA_INSTALL = $(INSTALL_DATA)
|
||||
atf_sh_interfaceDATA_INSTALL = $(INSTALL_DATA)
|
||||
atf_test_programsDATA_INSTALL = $(INSTALL_DATA)
|
||||
|
@ -483,13 +521,14 @@ docDATA_INSTALL = $(INSTALL_DATA)
|
|||
dtdDATA_INSTALL = $(INSTALL_DATA)
|
||||
egDATA_INSTALL = $(INSTALL_DATA)
|
||||
hooksDATA_INSTALL = $(INSTALL_DATA)
|
||||
pkgconfigDATA_INSTALL = $(INSTALL_DATA)
|
||||
pkgtestsDATA_INSTALL = $(INSTALL_DATA)
|
||||
subrsDATA_INSTALL = $(INSTALL_DATA)
|
||||
xslDATA_INSTALL = $(INSTALL_DATA)
|
||||
DATA = $(atf_formats_DATA) $(atf_sh_interface_DATA) \
|
||||
DATA = $(atf_data_DATA) $(atf_formats_DATA) $(atf_sh_interface_DATA) \
|
||||
$(atf_test_programs_DATA) $(atf_tools_DATA) $(atf_units_DATA) \
|
||||
$(css_DATA) $(doc_DATA) $(dtd_DATA) $(eg_DATA) $(hooks_DATA) \
|
||||
$(pkgtests_DATA) $(subrs_DATA) $(xsl_DATA)
|
||||
$(pkgconfig_DATA) $(pkgtests_DATA) $(subrs_DATA) $(xsl_DATA)
|
||||
atfHEADERS_INSTALL = $(INSTALL_HEADER)
|
||||
includeHEADERS_INSTALL = $(INSTALL_HEADER)
|
||||
HEADERS = $(atf_HEADERS) $(include_HEADERS)
|
||||
|
@ -560,9 +599,9 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
|||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
SH_TRAP_DASH = @SH_TRAP_DASH@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
|
@ -577,10 +616,13 @@ am__leading_dot = @am__leading_dot@
|
|||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
atf_arch = @atf_arch@
|
||||
atf_confdir = @atf_confdir@
|
||||
atf_cssdir = @atf_cssdir@
|
||||
atf_dtddir = @atf_dtddir@
|
||||
atf_egdir = @atf_egdir@
|
||||
atf_machine = @atf_machine@
|
||||
atf_pkgconfigdir = @atf_pkgconfigdir@
|
||||
atf_xsldir = @atf_xsldir@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
|
@ -618,19 +660,24 @@ sbindir = @sbindir@
|
|||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target = @target@
|
||||
target_alias = @target_alias@
|
||||
target_cpu = @target_cpu@
|
||||
target_os = @target_os@
|
||||
target_vendor = @target_vendor@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
doc_DATA = AUTHORS COPYING NEWS README ROADMAP
|
||||
EXTRA_DIST = $(doc_DATA) admin/check-readme.sh \
|
||||
EXTRA_DIST = $(doc_DATA) admin/check-install.sh \
|
||||
admin/check-style-common.awk admin/check-style-cpp.awk \
|
||||
admin/check-style-man.awk admin/check-style-shell.awk \
|
||||
admin/check-style.sh admin/revision-dist.h $(css_DATA) \
|
||||
$(dtd_DATA) $(eg_DATA) $(xsl_DATA) doc/atf.7.in $(subrs_DATA) \
|
||||
tests/bootstrap/h_tp_basic_sh.sh \
|
||||
$(dtd_DATA) $(eg_DATA) data/atf.pc.in $(xsl_DATA) doc/atf.7.in \
|
||||
$(subrs_DATA) tests/bootstrap/h_tp_basic_sh.sh \
|
||||
tests/bootstrap/h_tp_atf_check_sh.sh tests/bootstrap/testsuite \
|
||||
tests/bootstrap/package.m4 tests/bootstrap/testsuite.at \
|
||||
$(testsuite_incs) $(pkgtests_DATA) $(atf_formats_DATA) \
|
||||
$(testsuite_incs) $(pkgtests_DATA) $(atf_data_DATA) \
|
||||
tests/atf/data/t_pkg_config.sh $(atf_formats_DATA) \
|
||||
tests/atf/formats/t_parsers.sh $(atf_sh_interface_DATA) \
|
||||
tests/atf/sh_interface/h_misc.sh \
|
||||
tests/atf/sh_interface/t_atf_check.sh \
|
||||
|
@ -648,11 +695,14 @@ EXTRA_DIST = $(doc_DATA) admin/check-readme.sh \
|
|||
tests/atf/test_programs/t_workdir.sh $(atf_tools_DATA) \
|
||||
tests/atf/tools/t_atf_cleanup.sh \
|
||||
tests/atf/tools/t_atf_compile.sh \
|
||||
tests/atf/tools/t_atf_config.sh \
|
||||
tests/atf/tools/t_atf_config.sh tests/atf/tools/t_atf_exec.sh \
|
||||
tests/atf/tools/t_atf_killpg.sh \
|
||||
tests/atf/tools/t_atf_report.sh tests/atf/tools/t_atf_run.sh \
|
||||
$(atf_units_DATA) tools/atf-host-compile.sh $(hooks_DATA)
|
||||
AM_CPPFLAGS = -DATF_CONFDIR=\"$(atf_confdir)\" \
|
||||
AM_CPPFLAGS = -DATF_ARCH=\"$(atf_arch)\" \
|
||||
-DATF_CONFDIR=\"$(atf_confdir)\" \
|
||||
-DATF_LIBEXECDIR=\"$(libexecdir)\" \
|
||||
-DATF_MACHINE=\"$(atf_machine)\" \
|
||||
-DATF_PKGDATADIR=\"$(pkgdatadir)\" \
|
||||
-DATF_SHELL=\"$(ATF_SHELL)\" \
|
||||
-DATF_WORKDIR=\"$(ATF_WORKDIR)\"
|
||||
|
@ -660,8 +710,10 @@ AM_CPPFLAGS = -DATF_CONFDIR=\"$(atf_confdir)\" \
|
|||
ATF_COMPILE_DEPS = $(srcdir)/subrs/atf.init.subr \
|
||||
tools/atf-host-compile
|
||||
ATF_COMPILE_SH = ./tools/atf-host-compile
|
||||
CLEANFILES = admin/revision.h doc/atf.7 tests/bootstrap/h_tp_basic_sh \
|
||||
tests/bootstrap/h_tp_atf_check_sh tests/atf/formats/t_parsers \
|
||||
CLEANFILES = admin/revision.h data/atf.pc doc/atf.7 \
|
||||
tests/bootstrap/h_tp_basic_sh \
|
||||
tests/bootstrap/h_tp_atf_check_sh installcheck.log \
|
||||
tests/atf/data/t_pkg_config tests/atf/formats/t_parsers \
|
||||
tests/atf/sh_interface/h_misc \
|
||||
tests/atf/sh_interface/t_atf_check \
|
||||
tests/atf/sh_interface/t_config \
|
||||
|
@ -675,7 +727,8 @@ CLEANFILES = admin/revision.h doc/atf.7 tests/bootstrap/h_tp_basic_sh \
|
|||
tests/atf/test_programs/t_status \
|
||||
tests/atf/test_programs/t_workdir \
|
||||
tests/atf/tools/t_atf_cleanup tests/atf/tools/t_atf_compile \
|
||||
tests/atf/tools/t_atf_config tests/atf/tools/t_atf_report \
|
||||
tests/atf/tools/t_atf_config tests/atf/tools/t_atf_exec \
|
||||
tests/atf/tools/t_atf_killpg tests/atf/tools/t_atf_report \
|
||||
tests/atf/tools/t_atf_run tools/atf-host-compile \
|
||||
tools/atf-host-compile.tmp revision.h
|
||||
|
||||
|
@ -706,6 +759,8 @@ libatf_la_SOURCES = atf/application.cpp \
|
|||
atf/parser.hpp \
|
||||
atf/sanity.cpp \
|
||||
atf/sanity.hpp \
|
||||
atf/signals.cpp \
|
||||
atf/signals.hpp \
|
||||
atf/tests.cpp \
|
||||
atf/tests.hpp \
|
||||
atf/text.cpp \
|
||||
|
@ -736,6 +791,11 @@ atf_HEADERS = atf/application.hpp \
|
|||
atf/utils.hpp
|
||||
|
||||
atfdir = $(includedir)/atf
|
||||
dist_man_MANS = atf/atf-c++-api.3 doc/atf-formats.5 \
|
||||
doc/atf-test-case.4 doc/atf-test-program.1 subrs/atf-sh-api.3 \
|
||||
tools/atf-config.1 tools/atf-cleanup.1 tools/atf-compile.1 \
|
||||
tools/atf-exec.1 tools/atf-format.1 tools/atf-killpg.1 \
|
||||
tools/atf-report.1 tools/atf-run.1 tools/atf-version.1
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# `data' directory.
|
||||
|
@ -746,6 +806,8 @@ dtddir = $(atf_dtddir)
|
|||
dtd_DATA = data/tests-results.dtd
|
||||
egdir = $(atf_egdir)
|
||||
eg_DATA = data/atf-run.hooks
|
||||
pkgconfigdir = $(atf_pkgconfigdir)
|
||||
pkgconfig_DATA = data/atf.pc
|
||||
xsldir = $(atf_xsldir)
|
||||
xsl_DATA = data/tests-results.xsl
|
||||
|
||||
|
@ -753,16 +815,16 @@ xsl_DATA = data/tests-results.xsl
|
|||
# `doc' directory.
|
||||
# -------------------------------------------------------------------------
|
||||
man_MANS = doc/atf.7
|
||||
dist_man_MANS = doc/atf-formats.5 doc/atf-test-case.4 \
|
||||
doc/atf-test-program.1 tools/atf-config.1 tools/atf-cleanup.1 \
|
||||
tools/atf-compile.1 tools/atf-format.1 tools/atf-report.1 \
|
||||
tools/atf-run.1 tools/atf-version.1
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# `m4' directory.
|
||||
# -------------------------------------------------------------------------
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# `subrs' directory.
|
||||
# -------------------------------------------------------------------------
|
||||
subrs_DATA = subrs/atf.config.subr \
|
||||
subrs/atf.footer.subr \
|
||||
subrs_DATA = subrs/atf.footer.subr \
|
||||
subrs/atf.header.subr \
|
||||
subrs/atf.init.subr
|
||||
|
||||
|
@ -802,6 +864,9 @@ testsuite_incs = $(srcdir)/tests/bootstrap/t_application_help.at \
|
|||
testsdir = $(exec_prefix)/tests
|
||||
pkgtestsdir = $(exec_prefix)/tests/atf
|
||||
pkgtests_DATA = tests/atf/Atffile
|
||||
atf_data_DATA = tests/atf/data/Atffile
|
||||
atf_datadir = $(pkgtestsdir)/data
|
||||
atf_data_SCRIPTS = tests/atf/data/t_pkg_config
|
||||
atf_formats_DATA = tests/atf/formats/Atffile \
|
||||
tests/atf/formats/d_atffile_1 \
|
||||
tests/atf/formats/d_atffile_1.expout \
|
||||
|
@ -1014,6 +1079,7 @@ tests_atf_tools_h_pass_LDADD = -latf
|
|||
tests_atf_tools_h_pass_LDFLAGS = -L.
|
||||
atf_tools_SCRIPTS = tests/atf/tools/t_atf_cleanup \
|
||||
tests/atf/tools/t_atf_compile tests/atf/tools/t_atf_config \
|
||||
tests/atf/tools/t_atf_exec tests/atf/tools/t_atf_killpg \
|
||||
tests/atf/tools/t_atf_report tests/atf/tools/t_atf_run
|
||||
atf_units_DATA = tests/atf/units/Atffile
|
||||
atf_unitsdir = $(pkgtestsdir)/units
|
||||
|
@ -1038,6 +1104,9 @@ tests_atf_units_t_parser_LDFLAGS = -L.
|
|||
tests_atf_units_t_sanity_SOURCES = tests/atf/units/t_sanity.cpp
|
||||
tests_atf_units_t_sanity_LDADD = -latf
|
||||
tests_atf_units_t_sanity_LDFLAGS = -L.
|
||||
tests_atf_units_t_signals_SOURCES = tests/atf/units/t_signals.cpp
|
||||
tests_atf_units_t_signals_LDADD = -latf
|
||||
tests_atf_units_t_signals_LDFLAGS = -L.
|
||||
tests_atf_units_t_tests_SOURCES = tests/atf/units/t_tests.cpp
|
||||
tests_atf_units_t_tests_LDADD = -latf
|
||||
tests_atf_units_t_tests_LDFLAGS = -L.
|
||||
|
@ -1069,11 +1138,13 @@ tests_build_libuseless_a_SOURCES = \
|
|||
tests/build/t_include_macros_hpp.cpp \
|
||||
tests/build/t_include_parser_hpp.cpp \
|
||||
tests/build/t_include_sanity_hpp.cpp \
|
||||
tests/build/t_include_signals_hpp.cpp \
|
||||
tests/build/t_include_tests_hpp.cpp \
|
||||
tests/build/t_include_text_hpp.cpp \
|
||||
tests/build/t_include_ui_hpp.cpp \
|
||||
tests/build/t_include_user_hpp.cpp \
|
||||
tests/build/t_include_utils_hpp.cpp
|
||||
tests/build/t_include_utils_hpp.cpp \
|
||||
tests/build/t_use_macros_hpp.cpp
|
||||
|
||||
tools_atf_config_SOURCES = tools/atf-config.cpp
|
||||
tools_atf_config_LDADD = -latf
|
||||
|
@ -1084,9 +1155,15 @@ tools_atf_cleanup_LDFLAGS = -L.
|
|||
tools_atf_compile_SOURCES = tools/atf-compile.cpp
|
||||
tools_atf_compile_LDADD = -latf
|
||||
tools_atf_compile_LDFLAGS = -L.
|
||||
tools_atf_exec_SOURCES = tools/atf-exec.cpp
|
||||
tools_atf_exec_LDADD = -latf
|
||||
tools_atf_exec_LDFLAGS = -L.
|
||||
tools_atf_format_SOURCES = tools/atf-format.cpp
|
||||
tools_atf_format_LDADD = -latf
|
||||
tools_atf_format_LDFLAGS = -L.
|
||||
tools_atf_killpg_SOURCES = tools/atf-killpg.cpp
|
||||
tools_atf_killpg_LDADD = -latf
|
||||
tools_atf_killpg_LDFLAGS = -L.
|
||||
tools_atf_report_SOURCES = tools/atf-report.cpp
|
||||
tools_atf_report_LDADD = -latf
|
||||
tools_atf_report_LDFLAGS = -L.
|
||||
|
@ -1154,8 +1231,6 @@ $(srcdir)/config.h.in: $(am__configure_deps)
|
|||
|
||||
distclean-hdr:
|
||||
-rm -f config.h stamp-h1
|
||||
subrs/atf.config.subr: $(top_builddir)/config.status $(top_srcdir)/subrs/atf.config.subr.in
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@
|
||||
|
||||
clean-checkLIBRARIES:
|
||||
-test -z "$(check_LIBRARIES)" || rm -f $(check_LIBRARIES)
|
||||
|
@ -1200,6 +1275,9 @@ tests/build/t_include_parser_hpp.$(OBJEXT): \
|
|||
tests/build/t_include_sanity_hpp.$(OBJEXT): \
|
||||
tests/build/$(am__dirstamp) \
|
||||
tests/build/$(DEPDIR)/$(am__dirstamp)
|
||||
tests/build/t_include_signals_hpp.$(OBJEXT): \
|
||||
tests/build/$(am__dirstamp) \
|
||||
tests/build/$(DEPDIR)/$(am__dirstamp)
|
||||
tests/build/t_include_tests_hpp.$(OBJEXT): \
|
||||
tests/build/$(am__dirstamp) \
|
||||
tests/build/$(DEPDIR)/$(am__dirstamp)
|
||||
|
@ -1212,6 +1290,8 @@ tests/build/t_include_user_hpp.$(OBJEXT): tests/build/$(am__dirstamp) \
|
|||
tests/build/t_include_utils_hpp.$(OBJEXT): \
|
||||
tests/build/$(am__dirstamp) \
|
||||
tests/build/$(DEPDIR)/$(am__dirstamp)
|
||||
tests/build/t_use_macros_hpp.$(OBJEXT): tests/build/$(am__dirstamp) \
|
||||
tests/build/$(DEPDIR)/$(am__dirstamp)
|
||||
tests/build/libuseless.a: $(tests_build_libuseless_a_OBJECTS) $(tests_build_libuseless_a_DEPENDENCIES) tests/build/$(am__dirstamp)
|
||||
-rm -f tests/build/libuseless.a
|
||||
$(tests_build_libuseless_a_AR) tests/build/libuseless.a $(tests_build_libuseless_a_OBJECTS) $(tests_build_libuseless_a_LIBADD)
|
||||
|
@ -1260,6 +1340,7 @@ atf/fs.lo: atf/$(am__dirstamp) atf/$(DEPDIR)/$(am__dirstamp)
|
|||
atf/io.lo: atf/$(am__dirstamp) atf/$(DEPDIR)/$(am__dirstamp)
|
||||
atf/parser.lo: atf/$(am__dirstamp) atf/$(DEPDIR)/$(am__dirstamp)
|
||||
atf/sanity.lo: atf/$(am__dirstamp) atf/$(DEPDIR)/$(am__dirstamp)
|
||||
atf/signals.lo: atf/$(am__dirstamp) atf/$(DEPDIR)/$(am__dirstamp)
|
||||
atf/tests.lo: atf/$(am__dirstamp) atf/$(DEPDIR)/$(am__dirstamp)
|
||||
atf/text.lo: atf/$(am__dirstamp) atf/$(DEPDIR)/$(am__dirstamp)
|
||||
atf/ui.lo: atf/$(am__dirstamp) atf/$(DEPDIR)/$(am__dirstamp)
|
||||
|
@ -1538,6 +1619,11 @@ tests/atf/units/t_sanity.$(OBJEXT): tests/atf/units/$(am__dirstamp) \
|
|||
tests/atf/units/t_sanity$(EXEEXT): $(tests_atf_units_t_sanity_OBJECTS) $(tests_atf_units_t_sanity_DEPENDENCIES) tests/atf/units/$(am__dirstamp)
|
||||
@rm -f tests/atf/units/t_sanity$(EXEEXT)
|
||||
$(tests_atf_units_t_sanity_LINK) $(tests_atf_units_t_sanity_OBJECTS) $(tests_atf_units_t_sanity_LDADD) $(LIBS)
|
||||
tests/atf/units/t_signals.$(OBJEXT): tests/atf/units/$(am__dirstamp) \
|
||||
tests/atf/units/$(DEPDIR)/$(am__dirstamp)
|
||||
tests/atf/units/t_signals$(EXEEXT): $(tests_atf_units_t_signals_OBJECTS) $(tests_atf_units_t_signals_DEPENDENCIES) tests/atf/units/$(am__dirstamp)
|
||||
@rm -f tests/atf/units/t_signals$(EXEEXT)
|
||||
$(tests_atf_units_t_signals_LINK) $(tests_atf_units_t_signals_OBJECTS) $(tests_atf_units_t_signals_LDADD) $(LIBS)
|
||||
tests/atf/units/t_tests.$(OBJEXT): tests/atf/units/$(am__dirstamp) \
|
||||
tests/atf/units/$(DEPDIR)/$(am__dirstamp)
|
||||
tests/atf/units/t_tests$(EXEEXT): $(tests_atf_units_t_tests_OBJECTS) $(tests_atf_units_t_tests_DEPENDENCIES) tests/atf/units/$(am__dirstamp)
|
||||
|
@ -1603,11 +1689,21 @@ tools/atf-config.$(OBJEXT): tools/$(am__dirstamp) \
|
|||
tools/atf-config$(EXEEXT): $(tools_atf_config_OBJECTS) $(tools_atf_config_DEPENDENCIES) tools/$(am__dirstamp)
|
||||
@rm -f tools/atf-config$(EXEEXT)
|
||||
$(tools_atf_config_LINK) $(tools_atf_config_OBJECTS) $(tools_atf_config_LDADD) $(LIBS)
|
||||
tools/atf-exec.$(OBJEXT): tools/$(am__dirstamp) \
|
||||
tools/$(DEPDIR)/$(am__dirstamp)
|
||||
tools/atf-exec$(EXEEXT): $(tools_atf_exec_OBJECTS) $(tools_atf_exec_DEPENDENCIES) tools/$(am__dirstamp)
|
||||
@rm -f tools/atf-exec$(EXEEXT)
|
||||
$(tools_atf_exec_LINK) $(tools_atf_exec_OBJECTS) $(tools_atf_exec_LDADD) $(LIBS)
|
||||
tools/atf-format.$(OBJEXT): tools/$(am__dirstamp) \
|
||||
tools/$(DEPDIR)/$(am__dirstamp)
|
||||
tools/atf-format$(EXEEXT): $(tools_atf_format_OBJECTS) $(tools_atf_format_DEPENDENCIES) tools/$(am__dirstamp)
|
||||
@rm -f tools/atf-format$(EXEEXT)
|
||||
$(tools_atf_format_LINK) $(tools_atf_format_OBJECTS) $(tools_atf_format_LDADD) $(LIBS)
|
||||
tools/atf-killpg.$(OBJEXT): tools/$(am__dirstamp) \
|
||||
tools/$(DEPDIR)/$(am__dirstamp)
|
||||
tools/atf-killpg$(EXEEXT): $(tools_atf_killpg_OBJECTS) $(tools_atf_killpg_DEPENDENCIES) tools/$(am__dirstamp)
|
||||
@rm -f tools/atf-killpg$(EXEEXT)
|
||||
$(tools_atf_killpg_LINK) $(tools_atf_killpg_OBJECTS) $(tools_atf_killpg_LDADD) $(LIBS)
|
||||
tools/atf-report.$(OBJEXT): tools/$(am__dirstamp) \
|
||||
tools/$(DEPDIR)/$(am__dirstamp)
|
||||
tools/atf-report$(EXEEXT): $(tools_atf_report_OBJECTS) $(tools_atf_report_DEPENDENCIES) tools/$(am__dirstamp)
|
||||
|
@ -1623,6 +1719,25 @@ tools/atf-version.$(OBJEXT): tools/$(am__dirstamp) \
|
|||
tools/atf-version$(EXEEXT): $(tools_atf_version_OBJECTS) $(tools_atf_version_DEPENDENCIES) tools/$(am__dirstamp)
|
||||
@rm -f tools/atf-version$(EXEEXT)
|
||||
$(tools_atf_version_LINK) $(tools_atf_version_OBJECTS) $(tools_atf_version_LDADD) $(LIBS)
|
||||
install-atf_dataSCRIPTS: $(atf_data_SCRIPTS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(atf_datadir)" || $(MKDIR_P) "$(DESTDIR)$(atf_datadir)"
|
||||
@list='$(atf_data_SCRIPTS)'; for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
if test -f $$d$$p; then \
|
||||
f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
|
||||
echo " $(atf_dataSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(atf_datadir)/$$f'"; \
|
||||
$(atf_dataSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(atf_datadir)/$$f"; \
|
||||
else :; fi; \
|
||||
done
|
||||
|
||||
uninstall-atf_dataSCRIPTS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(atf_data_SCRIPTS)'; for p in $$list; do \
|
||||
f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
|
||||
echo " rm -f '$(DESTDIR)$(atf_datadir)/$$f'"; \
|
||||
rm -f "$(DESTDIR)$(atf_datadir)/$$f"; \
|
||||
done
|
||||
install-atf_formatsSCRIPTS: $(atf_formats_SCRIPTS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(atf_formatsdir)" || $(MKDIR_P) "$(DESTDIR)$(atf_formatsdir)"
|
||||
|
@ -1724,6 +1839,8 @@ mostlyclean-compile:
|
|||
-rm -f atf/parser.lo
|
||||
-rm -f atf/sanity.$(OBJEXT)
|
||||
-rm -f atf/sanity.lo
|
||||
-rm -f atf/signals.$(OBJEXT)
|
||||
-rm -f atf/signals.lo
|
||||
-rm -f atf/tests.$(OBJEXT)
|
||||
-rm -f atf/tests.lo
|
||||
-rm -f atf/text.$(OBJEXT)
|
||||
|
@ -1746,6 +1863,7 @@ mostlyclean-compile:
|
|||
-rm -f tests/atf/units/t_io.$(OBJEXT)
|
||||
-rm -f tests/atf/units/t_parser.$(OBJEXT)
|
||||
-rm -f tests/atf/units/t_sanity.$(OBJEXT)
|
||||
-rm -f tests/atf/units/t_signals.$(OBJEXT)
|
||||
-rm -f tests/atf/units/t_tests.$(OBJEXT)
|
||||
-rm -f tests/atf/units/t_text.$(OBJEXT)
|
||||
-rm -f tests/atf/units/t_user.$(OBJEXT)
|
||||
|
@ -1766,15 +1884,19 @@ mostlyclean-compile:
|
|||
-rm -f tests/build/t_include_macros_hpp.$(OBJEXT)
|
||||
-rm -f tests/build/t_include_parser_hpp.$(OBJEXT)
|
||||
-rm -f tests/build/t_include_sanity_hpp.$(OBJEXT)
|
||||
-rm -f tests/build/t_include_signals_hpp.$(OBJEXT)
|
||||
-rm -f tests/build/t_include_tests_hpp.$(OBJEXT)
|
||||
-rm -f tests/build/t_include_text_hpp.$(OBJEXT)
|
||||
-rm -f tests/build/t_include_ui_hpp.$(OBJEXT)
|
||||
-rm -f tests/build/t_include_user_hpp.$(OBJEXT)
|
||||
-rm -f tests/build/t_include_utils_hpp.$(OBJEXT)
|
||||
-rm -f tests/build/t_use_macros_hpp.$(OBJEXT)
|
||||
-rm -f tools/atf-cleanup.$(OBJEXT)
|
||||
-rm -f tools/atf-compile.$(OBJEXT)
|
||||
-rm -f tools/atf-config.$(OBJEXT)
|
||||
-rm -f tools/atf-exec.$(OBJEXT)
|
||||
-rm -f tools/atf-format.$(OBJEXT)
|
||||
-rm -f tools/atf-killpg.$(OBJEXT)
|
||||
-rm -f tools/atf-report.$(OBJEXT)
|
||||
-rm -f tools/atf-run.$(OBJEXT)
|
||||
-rm -f tools/atf-version.$(OBJEXT)
|
||||
|
@ -1793,6 +1915,7 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@atf/$(DEPDIR)/io.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@atf/$(DEPDIR)/parser.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@atf/$(DEPDIR)/sanity.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@atf/$(DEPDIR)/signals.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@atf/$(DEPDIR)/tests.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@atf/$(DEPDIR)/text.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@atf/$(DEPDIR)/ui.Plo@am__quote@
|
||||
|
@ -1811,6 +1934,7 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@tests/atf/units/$(DEPDIR)/t_io.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@tests/atf/units/$(DEPDIR)/t_parser.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@tests/atf/units/$(DEPDIR)/t_sanity.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@tests/atf/units/$(DEPDIR)/t_signals.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@tests/atf/units/$(DEPDIR)/t_tests.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@tests/atf/units/$(DEPDIR)/t_text.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@tests/atf/units/$(DEPDIR)/t_user.Po@am__quote@
|
||||
|
@ -1831,15 +1955,19 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@tests/build/$(DEPDIR)/t_include_macros_hpp.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@tests/build/$(DEPDIR)/t_include_parser_hpp.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@tests/build/$(DEPDIR)/t_include_sanity_hpp.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@tests/build/$(DEPDIR)/t_include_signals_hpp.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@tests/build/$(DEPDIR)/t_include_tests_hpp.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@tests/build/$(DEPDIR)/t_include_text_hpp.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@tests/build/$(DEPDIR)/t_include_ui_hpp.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@tests/build/$(DEPDIR)/t_include_user_hpp.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@tests/build/$(DEPDIR)/t_include_utils_hpp.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@tests/build/$(DEPDIR)/t_use_macros_hpp.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@tools/$(DEPDIR)/atf-cleanup.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@tools/$(DEPDIR)/atf-compile.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@tools/$(DEPDIR)/atf-config.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@tools/$(DEPDIR)/atf-exec.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@tools/$(DEPDIR)/atf-format.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@tools/$(DEPDIR)/atf-killpg.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@tools/$(DEPDIR)/atf-report.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@tools/$(DEPDIR)/atf-run.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@tools/$(DEPDIR)/atf-version.Po@am__quote@
|
||||
|
@ -1922,6 +2050,51 @@ uninstall-man1:
|
|||
echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
|
||||
rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
|
||||
done
|
||||
install-man3: $(man3_MANS) $(man_MANS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(man3dir)" || $(MKDIR_P) "$(DESTDIR)$(man3dir)"
|
||||
@list='$(man3_MANS) $(dist_man3_MANS) $(nodist_man3_MANS)'; \
|
||||
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
|
||||
for i in $$l2; do \
|
||||
case "$$i" in \
|
||||
*.3*) list="$$list $$i" ;; \
|
||||
esac; \
|
||||
done; \
|
||||
for i in $$list; do \
|
||||
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
|
||||
else file=$$i; fi; \
|
||||
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
|
||||
case "$$ext" in \
|
||||
3*) ;; \
|
||||
*) ext='3' ;; \
|
||||
esac; \
|
||||
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
|
||||
inst=`echo $$inst | sed -e 's/^.*\///'`; \
|
||||
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
|
||||
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man3dir)/$$inst'"; \
|
||||
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man3dir)/$$inst"; \
|
||||
done
|
||||
uninstall-man3:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(man3_MANS) $(dist_man3_MANS) $(nodist_man3_MANS)'; \
|
||||
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
|
||||
for i in $$l2; do \
|
||||
case "$$i" in \
|
||||
*.3*) list="$$list $$i" ;; \
|
||||
esac; \
|
||||
done; \
|
||||
for i in $$list; do \
|
||||
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
|
||||
case "$$ext" in \
|
||||
3*) ;; \
|
||||
*) ext='3' ;; \
|
||||
esac; \
|
||||
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
|
||||
inst=`echo $$inst | sed -e 's/^.*\///'`; \
|
||||
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
|
||||
echo " rm -f '$(DESTDIR)$(man3dir)/$$inst'"; \
|
||||
rm -f "$(DESTDIR)$(man3dir)/$$inst"; \
|
||||
done
|
||||
install-man4: $(man4_MANS) $(man_MANS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(man4dir)" || $(MKDIR_P) "$(DESTDIR)$(man4dir)"
|
||||
|
@ -2057,6 +2230,23 @@ uninstall-man7:
|
|||
echo " rm -f '$(DESTDIR)$(man7dir)/$$inst'"; \
|
||||
rm -f "$(DESTDIR)$(man7dir)/$$inst"; \
|
||||
done
|
||||
install-atf_dataDATA: $(atf_data_DATA)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(atf_datadir)" || $(MKDIR_P) "$(DESTDIR)$(atf_datadir)"
|
||||
@list='$(atf_data_DATA)'; for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
f=$(am__strip_dir) \
|
||||
echo " $(atf_dataDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(atf_datadir)/$$f'"; \
|
||||
$(atf_dataDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(atf_datadir)/$$f"; \
|
||||
done
|
||||
|
||||
uninstall-atf_dataDATA:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(atf_data_DATA)'; for p in $$list; do \
|
||||
f=$(am__strip_dir) \
|
||||
echo " rm -f '$(DESTDIR)$(atf_datadir)/$$f'"; \
|
||||
rm -f "$(DESTDIR)$(atf_datadir)/$$f"; \
|
||||
done
|
||||
install-atf_formatsDATA: $(atf_formats_DATA)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(atf_formatsdir)" || $(MKDIR_P) "$(DESTDIR)$(atf_formatsdir)"
|
||||
|
@ -2227,6 +2417,23 @@ uninstall-hooksDATA:
|
|||
echo " rm -f '$(DESTDIR)$(hooksdir)/$$f'"; \
|
||||
rm -f "$(DESTDIR)$(hooksdir)/$$f"; \
|
||||
done
|
||||
install-pkgconfigDATA: $(pkgconfig_DATA)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)"
|
||||
@list='$(pkgconfig_DATA)'; for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
f=$(am__strip_dir) \
|
||||
echo " $(pkgconfigDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgconfigdir)/$$f'"; \
|
||||
$(pkgconfigDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgconfigdir)/$$f"; \
|
||||
done
|
||||
|
||||
uninstall-pkgconfigDATA:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(pkgconfig_DATA)'; for p in $$list; do \
|
||||
f=$(am__strip_dir) \
|
||||
echo " rm -f '$(DESTDIR)$(pkgconfigdir)/$$f'"; \
|
||||
rm -f "$(DESTDIR)$(pkgconfigdir)/$$f"; \
|
||||
done
|
||||
install-pkgtestsDATA: $(pkgtests_DATA)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(pkgtestsdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgtestsdir)"
|
||||
|
@ -2579,7 +2786,7 @@ all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS) $(MANS) $(DATA) \
|
|||
install-binPROGRAMS: install-libLTLIBRARIES
|
||||
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(atf_formatsdir)" "$(DESTDIR)$(atf_test_programsdir)" "$(DESTDIR)$(atf_toolsdir)" "$(DESTDIR)$(atf_unitsdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(atf_formatsdir)" "$(DESTDIR)$(atf_sh_interfacedir)" "$(DESTDIR)$(atf_test_programsdir)" "$(DESTDIR)$(atf_toolsdir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man4dir)" "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man7dir)" "$(DESTDIR)$(atf_formatsdir)" "$(DESTDIR)$(atf_sh_interfacedir)" "$(DESTDIR)$(atf_test_programsdir)" "$(DESTDIR)$(atf_toolsdir)" "$(DESTDIR)$(atf_unitsdir)" "$(DESTDIR)$(cssdir)" "$(DESTDIR)$(docdir)" "$(DESTDIR)$(dtddir)" "$(DESTDIR)$(egdir)" "$(DESTDIR)$(hooksdir)" "$(DESTDIR)$(pkgtestsdir)" "$(DESTDIR)$(subrsdir)" "$(DESTDIR)$(xsldir)" "$(DESTDIR)$(atfdir)" "$(DESTDIR)$(includedir)"; do \
|
||||
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(atf_formatsdir)" "$(DESTDIR)$(atf_test_programsdir)" "$(DESTDIR)$(atf_toolsdir)" "$(DESTDIR)$(atf_unitsdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(atf_datadir)" "$(DESTDIR)$(atf_formatsdir)" "$(DESTDIR)$(atf_sh_interfacedir)" "$(DESTDIR)$(atf_test_programsdir)" "$(DESTDIR)$(atf_toolsdir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man3dir)" "$(DESTDIR)$(man4dir)" "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man7dir)" "$(DESTDIR)$(atf_datadir)" "$(DESTDIR)$(atf_formatsdir)" "$(DESTDIR)$(atf_sh_interfacedir)" "$(DESTDIR)$(atf_test_programsdir)" "$(DESTDIR)$(atf_toolsdir)" "$(DESTDIR)$(atf_unitsdir)" "$(DESTDIR)$(cssdir)" "$(DESTDIR)$(docdir)" "$(DESTDIR)$(dtddir)" "$(DESTDIR)$(egdir)" "$(DESTDIR)$(hooksdir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(pkgtestsdir)" "$(DESTDIR)$(subrsdir)" "$(DESTDIR)$(xsldir)" "$(DESTDIR)$(atfdir)" "$(DESTDIR)$(includedir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: $(BUILT_SOURCES)
|
||||
|
@ -2651,7 +2858,8 @@ info: info-am
|
|||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-atfHEADERS install-atf_formatsDATA \
|
||||
install-data-am: install-atfHEADERS install-atf_dataDATA \
|
||||
install-atf_dataSCRIPTS install-atf_formatsDATA \
|
||||
install-atf_formatsPROGRAMS install-atf_formatsSCRIPTS \
|
||||
install-atf_sh_interfaceDATA install-atf_sh_interfaceSCRIPTS \
|
||||
install-atf_test_programsDATA \
|
||||
|
@ -2661,7 +2869,8 @@ install-data-am: install-atfHEADERS install-atf_formatsDATA \
|
|||
install-atf_unitsDATA install-atf_unitsPROGRAMS \
|
||||
install-cssDATA install-docDATA install-dtdDATA install-egDATA \
|
||||
install-hooksDATA install-includeHEADERS install-man \
|
||||
install-pkgtestsDATA install-subrsDATA install-xslDATA
|
||||
install-pkgconfigDATA install-pkgtestsDATA install-subrsDATA \
|
||||
install-xslDATA
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
|
@ -2672,7 +2881,8 @@ install-html: install-html-am
|
|||
|
||||
install-info: install-info-am
|
||||
|
||||
install-man: install-man1 install-man4 install-man5 install-man7
|
||||
install-man: install-man1 install-man3 install-man4 install-man5 \
|
||||
install-man7
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
|
@ -2700,7 +2910,8 @@ ps: ps-am
|
|||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-atfHEADERS uninstall-atf_formatsDATA \
|
||||
uninstall-am: uninstall-atfHEADERS uninstall-atf_dataDATA \
|
||||
uninstall-atf_dataSCRIPTS uninstall-atf_formatsDATA \
|
||||
uninstall-atf_formatsPROGRAMS uninstall-atf_formatsSCRIPTS \
|
||||
uninstall-atf_sh_interfaceDATA \
|
||||
uninstall-atf_sh_interfaceSCRIPTS \
|
||||
|
@ -2712,11 +2923,12 @@ uninstall-am: uninstall-atfHEADERS uninstall-atf_formatsDATA \
|
|||
uninstall-binPROGRAMS uninstall-cssDATA uninstall-docDATA \
|
||||
uninstall-dtdDATA uninstall-egDATA uninstall-hooksDATA \
|
||||
uninstall-includeHEADERS uninstall-libLTLIBRARIES \
|
||||
uninstall-libexecPROGRAMS uninstall-man uninstall-pkgtestsDATA \
|
||||
uninstall-libexecPROGRAMS uninstall-man \
|
||||
uninstall-pkgconfigDATA uninstall-pkgtestsDATA \
|
||||
uninstall-subrsDATA uninstall-xslDATA
|
||||
|
||||
uninstall-man: uninstall-man1 uninstall-man4 uninstall-man5 \
|
||||
uninstall-man7
|
||||
uninstall-man: uninstall-man1 uninstall-man3 uninstall-man4 \
|
||||
uninstall-man5 uninstall-man7
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
|
@ -2731,6 +2943,7 @@ uninstall-man: uninstall-man1 uninstall-man4 uninstall-man5 \
|
|||
distclean-hdr distclean-libtool distclean-local distclean-tags \
|
||||
distcleancheck distdir distuninstallcheck dvi dvi-am html \
|
||||
html-am info info-am install install-am install-atfHEADERS \
|
||||
install-atf_dataDATA install-atf_dataSCRIPTS \
|
||||
install-atf_formatsDATA install-atf_formatsPROGRAMS \
|
||||
install-atf_formatsSCRIPTS install-atf_sh_interfaceDATA \
|
||||
install-atf_sh_interfaceSCRIPTS install-atf_test_programsDATA \
|
||||
|
@ -2744,16 +2957,17 @@ uninstall-man: uninstall-man1 uninstall-man4 uninstall-man5 \
|
|||
install-hooksDATA install-html install-html-am \
|
||||
install-includeHEADERS install-info install-info-am \
|
||||
install-libLTLIBRARIES install-libexecPROGRAMS install-man \
|
||||
install-man1 install-man4 install-man5 install-man7 \
|
||||
install-pdf install-pdf-am install-pkgtestsDATA install-ps \
|
||||
install-ps-am install-strip install-subrsDATA install-xslDATA \
|
||||
installcheck installcheck-am installcheck-local installdirs \
|
||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
|
||||
pdf pdf-am ps ps-am tags uninstall uninstall-am \
|
||||
uninstall-atfHEADERS uninstall-atf_formatsDATA \
|
||||
uninstall-atf_formatsPROGRAMS uninstall-atf_formatsSCRIPTS \
|
||||
uninstall-atf_sh_interfaceDATA \
|
||||
install-man1 install-man3 install-man4 install-man5 \
|
||||
install-man7 install-pdf install-pdf-am install-pkgconfigDATA \
|
||||
install-pkgtestsDATA install-ps install-ps-am install-strip \
|
||||
install-subrsDATA install-xslDATA installcheck installcheck-am \
|
||||
installcheck-local installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||
tags uninstall uninstall-am uninstall-atfHEADERS \
|
||||
uninstall-atf_dataDATA uninstall-atf_dataSCRIPTS \
|
||||
uninstall-atf_formatsDATA uninstall-atf_formatsPROGRAMS \
|
||||
uninstall-atf_formatsSCRIPTS uninstall-atf_sh_interfaceDATA \
|
||||
uninstall-atf_sh_interfaceSCRIPTS \
|
||||
uninstall-atf_test_programsDATA \
|
||||
uninstall-atf_test_programsPROGRAMS \
|
||||
|
@ -2764,19 +2978,20 @@ uninstall-man: uninstall-man1 uninstall-man4 uninstall-man5 \
|
|||
uninstall-dtdDATA uninstall-egDATA uninstall-hooksDATA \
|
||||
uninstall-includeHEADERS uninstall-libLTLIBRARIES \
|
||||
uninstall-libexecPROGRAMS uninstall-man uninstall-man1 \
|
||||
uninstall-man4 uninstall-man5 uninstall-man7 \
|
||||
uninstall-pkgtestsDATA uninstall-subrsDATA uninstall-xslDATA
|
||||
uninstall-man3 uninstall-man4 uninstall-man5 uninstall-man7 \
|
||||
uninstall-pkgconfigDATA uninstall-pkgtestsDATA \
|
||||
uninstall-subrsDATA uninstall-xslDATA
|
||||
|
||||
|
||||
dist-hook: admin/revision-dist.h check-readme check-style
|
||||
dist-hook: $(srcdir)/admin/revision-dist.h check-install check-style
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# `admin' directory.
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
.PHONY: check-readme
|
||||
check-readme:
|
||||
$(srcdir)/admin/check-readme.sh $(srcdir)/README
|
||||
.PHONY: check-install
|
||||
check-install:
|
||||
$(srcdir)/admin/check-install.sh $(srcdir)/INSTALL
|
||||
|
||||
.phony: check-style
|
||||
check-style:
|
||||
|
@ -2800,6 +3015,14 @@ $(srcdir)/admin/revision-dist.h: admin/revision.h
|
|||
else \
|
||||
[ -f $(srcdir)/admin/revision-dist.h ]; \
|
||||
fi
|
||||
data/atf.pc: $(srcdir)/data/atf.pc.in
|
||||
test -d data || mkdir -p data
|
||||
sed -e 's,__ATF_VERSION__,@PACKAGE_VERSION@,g' \
|
||||
-e 's,__CXX__,$(CXX),g' \
|
||||
-e 's,__INCLUDEDIR__,$(includedir),g' \
|
||||
-e 's,__LIBDIR__,$(libdir),g' \
|
||||
<$(srcdir)/data/atf.pc.in >data/atf.pc.tmp
|
||||
mv data/atf.pc.tmp data/atf.pc
|
||||
|
||||
doc/atf.7: $(srcdir)/doc/atf.7.in
|
||||
test -d doc || mkdir -p doc
|
||||
|
@ -2838,7 +3061,19 @@ $(srcdir)/tests/bootstrap/testsuite: $(srcdir)/tests/bootstrap/testsuite.at \
|
|||
mv $@.tmp $@
|
||||
|
||||
installcheck-local:
|
||||
cd $(pkgtestsdir) && $(TESTS_ENVIRONMENT) atf-run | atf-report
|
||||
logfile=$$(pwd)/installcheck.log; \
|
||||
cd $(pkgtestsdir); \
|
||||
$(TESTS_ENVIRONMENT) atf-run | tee $${logfile} | atf-report; \
|
||||
res=$${?}; \
|
||||
echo; \
|
||||
echo "The verbatim output of atf-run has been saved to" \
|
||||
"installcheck.log"; \
|
||||
exit $${res}
|
||||
tests/atf/data/t_pkg_config: \
|
||||
$(srcdir)/tests/atf/data/t_pkg_config.sh \
|
||||
$(ATF_COMPILE_DEPS)
|
||||
test -d tests/atf/data || mkdir -p tests/atf/data
|
||||
$(ATF_COMPILE_SH) -o $@ $(srcdir)/tests/atf/data/t_pkg_config.sh
|
||||
tests/atf/formats/t_parsers: \
|
||||
$(srcdir)/tests/atf/formats/t_parsers.sh \
|
||||
$(ATF_COMPILE_DEPS)
|
||||
|
@ -2933,6 +3168,14 @@ tests/atf/tools/t_atf_config: $(srcdir)/tests/atf/tools/t_atf_config.sh \
|
|||
$(ATF_COMPILE_DEPS)
|
||||
test -d tests/atf/tools || mkdir -p tests/atf/tools
|
||||
$(ATF_COMPILE_SH) -o $@ $(srcdir)/tests/atf/tools/t_atf_config.sh
|
||||
tests/atf/tools/t_atf_exec: $(srcdir)/tests/atf/tools/t_atf_exec.sh \
|
||||
$(ATF_COMPILE_DEPS)
|
||||
test -d tests/atf/tools || mkdir -p tests/atf/tools
|
||||
$(ATF_COMPILE_SH) -o $@ $(srcdir)/tests/atf/tools/t_atf_exec.sh
|
||||
tests/atf/tools/t_atf_killpg: $(srcdir)/tests/atf/tools/t_atf_killpg.sh \
|
||||
$(ATF_COMPILE_DEPS)
|
||||
test -d tests/atf/tools || mkdir -p tests/atf/tools
|
||||
$(ATF_COMPILE_SH) -o $@ $(srcdir)/tests/atf/tools/t_atf_killpg.sh
|
||||
tests/atf/tools/t_atf_report: $(srcdir)/tests/atf/tools/t_atf_report.sh \
|
||||
$(ATF_COMPILE_DEPS)
|
||||
test -d tests/atf/tools || mkdir -p tests/atf/tools
|
||||
|
@ -2949,7 +3192,7 @@ tools/atf-host-compile: $(srcdir)/tools/atf-host-compile.sh
|
|||
>tools/atf-host-compile.tmp
|
||||
chmod +x tools/atf-host-compile.tmp
|
||||
mv tools/atf-host-compile.tmp tools/atf-host-compile
|
||||
revision.h: admin/revision.h admin/revision-dist.h
|
||||
revision.h: admin/revision.h $(srcdir)/admin/revision-dist.h
|
||||
@if [ -f admin/revision.h ]; then \
|
||||
cmp -s admin/revision.h revision.h || \
|
||||
cp admin/revision.h revision.h; \
|
||||
|
|
|
@ -1,6 +1,42 @@
|
|||
Automated Testing Framework (atf)
|
||||
Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
All rights reserved.
|
||||
Automated Testing Framework (atf)
|
||||
The NetBSD Foundation, Inc.
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
|
||||
Version 0.4
|
||||
===========
|
||||
|
||||
Release date: February 4th, 2008
|
||||
Status: Experimental
|
||||
|
||||
Changes:
|
||||
|
||||
* Added two new manual pages, atf-c++-api and atf-sh-api, describing the
|
||||
C++ and POSIX shell interfaces used to write test programs.
|
||||
|
||||
* Added a pkg-config file, useful to get the flags to build against the
|
||||
C++ library or to easily detect the presence of ATF.
|
||||
|
||||
* Added a way for test cases to require a specific architecture and/or
|
||||
machine type through the new 'require.arch' and 'require.machine'
|
||||
meta-data properties, respectively.
|
||||
|
||||
* Added the 'timeout' property to test cases, useful to set an upper-bound
|
||||
limit for the test's run time and thus prevent global test program stalls
|
||||
due to the test case's misbehavior.
|
||||
|
||||
* Added the atf-exec(1) internal utility, used to execute a command after
|
||||
changing the process group it belongs to.
|
||||
|
||||
* Added the atf-killpg(1) internal utility, used to kill process groups.
|
||||
|
||||
* Multiple portability fixes. Of special interest, full support for SunOS
|
||||
(Solaris Express Developer Edition 2007/09) using the Sun Studio 12 C++
|
||||
compiler.
|
||||
|
||||
* Fixed a serious bug that prevented atf-run(1) from working at all under
|
||||
Fedora 8 x86_64. Due to the nature of the bug, other platforms were
|
||||
likely affected too.
|
||||
|
||||
|
||||
Version 0.3
|
||||
|
@ -87,4 +123,5 @@ Changes:
|
|||
Google Summer of Code 2007 program.
|
||||
|
||||
|
||||
-- EOF
|
||||
---------------------------------------------------------------------------
|
||||
End of document
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Automated Testing Framework (atf)
|
||||
Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
All rights reserved.
|
||||
Automated Testing Framework (atf)
|
||||
The NetBSD Foundation, Inc.
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
|
||||
Introduction
|
||||
|
@ -23,65 +23,24 @@ able to certify that a given piece of software works on their machine as
|
|||
advertised.
|
||||
|
||||
|
||||
Configuration flags
|
||||
===================
|
||||
Other documents
|
||||
===============
|
||||
|
||||
This section describes the non-standard flags added to the 'configure'
|
||||
script.
|
||||
* AUTHORS: List of authors and contributors for this project.
|
||||
|
||||
* Variable: ATF_CONFSUBDIR
|
||||
Possible values: empty, a relative path.
|
||||
Default: atf.
|
||||
* COPYING: License information.
|
||||
|
||||
Specifies the subdirectory of the configuration directory (given by the
|
||||
--sysconfdir argument) under which ATF will search for its configuration
|
||||
files.
|
||||
* ChangeLog: Pointers to the code repository. No actual history is
|
||||
provided here.
|
||||
|
||||
* Variable: ATF_WORKDIR
|
||||
Possible values: empty, an absolute path.
|
||||
Default: /tmp or /var/tmp, depending on availability.
|
||||
* INSTALL: Compilation and installation instructions. These is not the
|
||||
standard document shipped with many packages, so be sure to read it for
|
||||
things that are specific to ATF's build.
|
||||
|
||||
Specifies the directory that ATF will use to place its temporary files
|
||||
and work directories for test cases. This is just a default and can
|
||||
be overriden at run time.
|
||||
* NEWS: List of major changes between formal, published releases.
|
||||
|
||||
* Flag: --enable-developer
|
||||
Possible values: yes, no
|
||||
Default: Depends on the version number. Stable versions define this
|
||||
to 'no' while all others have it set to 'yes'.
|
||||
|
||||
Enables several features useful for development, such as the inclusion
|
||||
of debugging symbols in all objects or the enabling of warnings during
|
||||
compilation.
|
||||
|
||||
* Flag: --enable-unstable-shared
|
||||
Possible values: yes, no
|
||||
Default: no.
|
||||
|
||||
Forces the building of shared libraries in addition to static ones.
|
||||
The build of shared libraries is currently disabled because their ABIs
|
||||
and APIs are unstable and subject to change. This flag is provided for
|
||||
development purposes only and will be removed once the libraries are
|
||||
stable enough.
|
||||
* ROADMAP: List of changes planned for future releases.
|
||||
|
||||
|
||||
Post-installation steps
|
||||
=======================
|
||||
|
||||
After installing ATF, you have to register the DTDs it provides into the
|
||||
system-wide XML catalog. See the comments at the top of the files in
|
||||
${datadir}/share/xml/atf to see the correct public identifiers. This
|
||||
directory will typically be /usr/local/share/xml/atf or /usr/share/xml/atf.
|
||||
Failure to do so will lead to further errors when processing the XML
|
||||
files generated by atf-report.
|
||||
|
||||
|
||||
Tools used to generate this distfile
|
||||
====================================
|
||||
|
||||
* GNU autoconf 2.61
|
||||
* GNU automake 1.10
|
||||
* GNU libtool 1.5.22 (1.1220.2.365 2005/12/18 22:14:06)
|
||||
|
||||
|
||||
-- EOF
|
||||
---------------------------------------------------------------------------
|
||||
End of document
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Automated Testing Framework (atf)
|
||||
Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
All rights reserved.
|
||||
Automated Testing Framework (atf)
|
||||
The NetBSD Foundation, Inc.
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
|
||||
Introduction
|
||||
|
@ -13,17 +13,12 @@ of salt: the focus of a specific release may change completely depending
|
|||
on how things develop.
|
||||
|
||||
|
||||
Plans for 0.4
|
||||
Plans for 0.5
|
||||
=============
|
||||
|
||||
* Add a way to add an upper-bound limit for test run times. Otherwise a
|
||||
test that enters an infinite loop can stall the whole process.
|
||||
|
||||
* Add a class, similar in idea to boost::noncopyable, to easily mark some
|
||||
classes as not copyable. Or, failing to do that, any other way to do
|
||||
the same.
|
||||
|
||||
* Add a .pc file for libatf.
|
||||
* Add a tool to collect multiple outputs of atf-run (from different
|
||||
machines) and generate a single (XML-only?) log with everything.
|
||||
Must allow easy conversion to HTML for online publishing.
|
||||
|
||||
|
||||
Plans for pre-1.0
|
||||
|
@ -41,11 +36,6 @@ Plans for pre-1.0
|
|||
* Add an atf_check-like function to the C++ binding to allow easy testing
|
||||
of executables.
|
||||
|
||||
* The test suite should not use atf-compile to generate helper test cases.
|
||||
Reason: NetBSD will include atf-compile in the comp.tgz set. If it is
|
||||
not installed, a lot of tests will be skipped without a "real" reason.
|
||||
Use real helpers instead.
|
||||
|
||||
* Make the shell library work with 'set -e'?
|
||||
|
||||
* Shell test programs dynamically locate where the shell library is by
|
||||
|
@ -68,8 +58,6 @@ Plans for pre-1.0
|
|||
* Make sure that the tests in tests/atf have, at the very least, the same
|
||||
coverage as the ones in tests/bootstrap.
|
||||
|
||||
* Add manual pages for the library interfaces.
|
||||
|
||||
* Document the code.
|
||||
|
||||
* Possibly add a way to automatically gain or drop privileges when
|
||||
|
@ -95,8 +83,8 @@ Plans for post-1.0
|
|||
to a finer granularity (test cases) is harder and maybe not worth it.
|
||||
|
||||
|
||||
Things to we will not do
|
||||
========================
|
||||
Things that we will not do
|
||||
==========================
|
||||
|
||||
This is a list of things that will *not* be addressed anytime soon in the
|
||||
project. Of course most of them would be nice to have in the future, but
|
||||
|
@ -125,4 +113,5 @@ change our mind in the future and add move some of these to the above list.
|
|||
standards.
|
||||
|
||||
|
||||
-- EOF
|
||||
---------------------------------------------------------------------------
|
||||
End of document
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,99 @@
|
|||
#! /bin/sh
|
||||
#
|
||||
# Automated Testing Framework (atf)
|
||||
#
|
||||
# Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. All advertising materials mentioning features or use of this
|
||||
# software must display the following acknowledgement:
|
||||
# This product includes software developed by the NetBSD
|
||||
# Foundation, Inc. and its contributors.
|
||||
# 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
|
||||
# CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
#
|
||||
# A utility to ensure that INSTALL lists the correct versions of the
|
||||
# tools used to generate the distfile.
|
||||
#
|
||||
|
||||
Prog_Name=${0##*/}
|
||||
|
||||
#
|
||||
# err message
|
||||
#
|
||||
err() {
|
||||
echo "${Prog_Name}: ${@}" 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
#
|
||||
# warn message
|
||||
#
|
||||
warn() {
|
||||
echo "${Prog_Name}: ${@}" 1>&2
|
||||
}
|
||||
|
||||
#
|
||||
# check_tool readme_file prog_name verbose_name
|
||||
#
|
||||
# Executes 'prog_name' to determine its version and checks if the
|
||||
# given 'readme_file' contains 'verbose_name <version>' in it.
|
||||
#
|
||||
check_tool() {
|
||||
readme=${1}
|
||||
prog=${2}
|
||||
name=${3}
|
||||
|
||||
ver=$(${prog} --version | head -n 1 | cut -d ' ' -f 4-)
|
||||
|
||||
if grep "^\\* ${name} ${ver}$" ${readme} >/dev/null; then
|
||||
true
|
||||
else
|
||||
warn "Incorrect version of ${name}"
|
||||
false
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# main readme_file
|
||||
#
|
||||
# Entry point.
|
||||
#
|
||||
main() {
|
||||
readme=${1}
|
||||
ret=0
|
||||
|
||||
check_tool ${readme} autoconf "GNU autoconf" || ret=1
|
||||
check_tool ${readme} automake "GNU automake" || ret=1
|
||||
check_tool ${readme} libtool "GNU libtool" || ret=1
|
||||
|
||||
return ${ret}
|
||||
}
|
||||
|
||||
main "${@}"
|
||||
|
||||
# vim: syntax=sh:expandtab:shiftwidth=4:softtabstop=4
|
|
@ -78,7 +78,7 @@ BEGIN {
|
|||
warn("Variable should not start with an underline")
|
||||
}
|
||||
|
||||
/[^\\]\$[^0-9'"$?@#*{(|\/]+/ {
|
||||
/[^\\]\$[^0-9!'"$?@#*{}(|\/]+/ {
|
||||
warn("Missing braces around variable name")
|
||||
}
|
||||
|
||||
|
|
|
@ -98,10 +98,13 @@ find_sources() {
|
|||
-name "*.awk" -o \
|
||||
-name "*.cpp" -o \
|
||||
-name "*.hpp" -o \
|
||||
-name "*.m4" -o \
|
||||
-name "*.sh" \
|
||||
\) -a \( \
|
||||
\! -path "*autom4te*" -a \
|
||||
-type f \
|
||||
-type f -a \
|
||||
\! -name "aclocal.m4" \
|
||||
\! -name "*.so.*" \
|
||||
\)
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# ltmain.sh - Provide generalized library-building support services.
|
||||
# NOTE: Changing this file will not affect anything until you rerun configure.
|
||||
#
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
|
||||
# Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
|
||||
# 2007 Free Software Foundation, Inc.
|
||||
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
|
@ -43,14 +43,22 @@ EXIT_FAILURE=1
|
|||
|
||||
PROGRAM=ltmain.sh
|
||||
PACKAGE=libtool
|
||||
VERSION=1.5.22
|
||||
TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
|
||||
VERSION=1.5.24
|
||||
TIMESTAMP=" (1.1220.2.455 2007/06/24 02:13:29)"
|
||||
|
||||
# See if we are running on zsh, and set the options which allow our
|
||||
# commands through without removal of \ escapes.
|
||||
if test -n "${ZSH_VERSION+set}" ; then
|
||||
# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
|
||||
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
|
||||
emulate sh
|
||||
NULLCMD=:
|
||||
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
|
||||
# is contrary to our usage. Disable this feature.
|
||||
alias -g '${1+"$@"}'='"$@"'
|
||||
setopt NO_GLOB_SUBST
|
||||
else
|
||||
case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
|
||||
fi
|
||||
BIN_SH=xpg4; export BIN_SH # for Tru64
|
||||
DUALCASE=1; export DUALCASE # for MKS sh
|
||||
|
||||
# Check that we have a working $echo.
|
||||
if test "X$1" = X--no-reexec; then
|
||||
|
@ -105,12 +113,14 @@ esac
|
|||
# These must not be set unconditionally because not all systems understand
|
||||
# e.g. LANG=C (notably SCO).
|
||||
# We save the old values to restore during execute mode.
|
||||
if test "${LC_ALL+set}" = set; then
|
||||
save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
|
||||
fi
|
||||
if test "${LANG+set}" = set; then
|
||||
save_LANG="$LANG"; LANG=C; export LANG
|
||||
fi
|
||||
for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
|
||||
do
|
||||
eval "if test \"\${$lt_var+set}\" = set; then
|
||||
save_$lt_var=\$$lt_var
|
||||
$lt_var=C
|
||||
export $lt_var
|
||||
fi"
|
||||
done
|
||||
|
||||
# Make sure IFS has a sensible default
|
||||
lt_nl='
|
||||
|
@ -136,6 +146,8 @@ duplicate_deps=no
|
|||
preserve_args=
|
||||
lo2o="s/\\.lo\$/.${objext}/"
|
||||
o2lo="s/\\.${objext}\$/.lo/"
|
||||
extracted_archives=
|
||||
extracted_serial=0
|
||||
|
||||
#####################################
|
||||
# Shell function definitions:
|
||||
|
@ -196,7 +208,13 @@ func_win32_libid ()
|
|||
if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
|
||||
$EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
|
||||
win32_nmres=`eval $NM -f posix -A $1 | \
|
||||
$SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
|
||||
$SED -n -e '1,100{
|
||||
/ I /{
|
||||
s,.*,import,
|
||||
p
|
||||
q
|
||||
}
|
||||
}'`
|
||||
case $win32_nmres in
|
||||
import*) win32_libid_type="x86 archive import";;
|
||||
*) win32_libid_type="x86 archive static";;
|
||||
|
@ -373,7 +391,17 @@ func_extract_archives ()
|
|||
*) my_xabs=`pwd`"/$my_xlib" ;;
|
||||
esac
|
||||
my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
|
||||
my_xdir="$my_gentop/$my_xlib"
|
||||
my_xlib_u=$my_xlib
|
||||
while :; do
|
||||
case " $extracted_archives " in
|
||||
*" $my_xlib_u "*)
|
||||
extracted_serial=`expr $extracted_serial + 1`
|
||||
my_xlib_u=lt$extracted_serial-$my_xlib ;;
|
||||
*) break ;;
|
||||
esac
|
||||
done
|
||||
extracted_archives="$extracted_archives $my_xlib_u"
|
||||
my_xdir="$my_gentop/$my_xlib_u"
|
||||
|
||||
$show "${rm}r $my_xdir"
|
||||
$run ${rm}r "$my_xdir"
|
||||
|
@ -500,11 +528,12 @@ do
|
|||
;;
|
||||
|
||||
--version)
|
||||
$echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
|
||||
$echo
|
||||
$echo "Copyright (C) 2005 Free Software Foundation, Inc."
|
||||
$echo "This is free software; see the source for copying conditions. There is NO"
|
||||
$echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
echo "\
|
||||
$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
exit $?
|
||||
;;
|
||||
|
||||
|
@ -801,9 +830,10 @@ if test -z "$show_help"; then
|
|||
*.class) xform=class ;;
|
||||
*.cpp) xform=cpp ;;
|
||||
*.cxx) xform=cxx ;;
|
||||
*.f90) xform=f90 ;;
|
||||
*.[fF][09]?) xform=[fF][09]. ;;
|
||||
*.for) xform=for ;;
|
||||
*.java) xform=java ;;
|
||||
*.obj) xform=obj ;;
|
||||
esac
|
||||
|
||||
libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
|
||||
|
@ -1184,8 +1214,9 @@ EOF
|
|||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-all-static | -static)
|
||||
if test "X$arg" = "X-all-static"; then
|
||||
-all-static | -static | -static-libtool-libs)
|
||||
case $arg in
|
||||
-all-static)
|
||||
if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
|
||||
$echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
|
||||
fi
|
||||
|
@ -1193,12 +1224,20 @@ EOF
|
|||
dlopen_self=$dlopen_self_static
|
||||
fi
|
||||
prefer_static_libs=yes
|
||||
else
|
||||
;;
|
||||
-static)
|
||||
if test -z "$pic_flag" && test -n "$link_static_flag"; then
|
||||
dlopen_self=$dlopen_self_static
|
||||
fi
|
||||
prefer_static_libs=built
|
||||
fi
|
||||
;;
|
||||
-static-libtool-libs)
|
||||
if test -z "$pic_flag" && test -n "$link_static_flag"; then
|
||||
dlopen_self=$dlopen_self_static
|
||||
fi
|
||||
prefer_static_libs=yes
|
||||
;;
|
||||
esac
|
||||
build_libtool_libs=no
|
||||
build_old_libs=yes
|
||||
break
|
||||
|
@ -1653,7 +1692,7 @@ EOF
|
|||
continue
|
||||
;;
|
||||
|
||||
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
|
||||
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
|
||||
compiler_flags="$compiler_flags $arg"
|
||||
compile_command="$compile_command $arg"
|
||||
finalize_command="$finalize_command $arg"
|
||||
|
@ -1679,10 +1718,11 @@ EOF
|
|||
# -m* pass through architecture-specific compiler args for GCC
|
||||
# -m*, -t[45]*, -txscale* pass through architecture-specific
|
||||
# compiler args for GCC
|
||||
# -pg pass through profiling flag for GCC
|
||||
# -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
|
||||
# -F/path gives path to uninstalled frameworks, gcc on darwin
|
||||
# @file GCC response files
|
||||
-64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
|
||||
-t[45]*|-txscale*|@*)
|
||||
-64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
|
||||
-t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
|
||||
|
||||
# Unknown arguments in both finalize_command and compile_command need
|
||||
# to be aesthetically quoted because they are evaled later.
|
||||
|
@ -1710,9 +1750,9 @@ EOF
|
|||
|
||||
-no-install)
|
||||
case $host in
|
||||
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
|
||||
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
|
||||
# The PATH hackery in wrapper scripts is required on Windows
|
||||
# in order for the loader to find any dlls it needs.
|
||||
# and Darwin in order for the loader to find any dlls it needs.
|
||||
$echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
|
||||
$echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
|
||||
fast_install=no
|
||||
|
@ -1771,7 +1811,7 @@ EOF
|
|||
continue
|
||||
;;
|
||||
|
||||
-static)
|
||||
-static | -static-libtool-libs)
|
||||
# The effects of -static are defined in a previous loop.
|
||||
# We used to do the same as -all-static on platforms that
|
||||
# didn't have a PIC flag, but the assumption that the effects
|
||||
|
@ -2153,7 +2193,7 @@ EOF
|
|||
lib=
|
||||
found=no
|
||||
case $deplib in
|
||||
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
|
||||
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
|
||||
if test "$linkmode,$pass" = "prog,link"; then
|
||||
compile_deplibs="$deplib $compile_deplibs"
|
||||
finalize_deplibs="$deplib $finalize_deplibs"
|
||||
|
@ -2573,7 +2613,9 @@ EOF
|
|||
|
||||
if test "$linkmode,$pass" = "prog,link"; then
|
||||
if test -n "$library_names" &&
|
||||
{ test "$prefer_static_libs" = no || test -z "$old_library"; }; then
|
||||
{ { test "$prefer_static_libs" = no ||
|
||||
test "$prefer_static_libs,$installed" = "built,yes"; } ||
|
||||
test -z "$old_library"; }; then
|
||||
# We need to hardcode the library path
|
||||
if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
|
||||
# Make sure the rpath contains only unique directories.
|
||||
|
@ -3269,7 +3311,7 @@ EOF
|
|||
# which has an extra 1 added just for fun
|
||||
#
|
||||
case $version_type in
|
||||
darwin|linux|osf|windows)
|
||||
darwin|linux|osf|windows|none)
|
||||
current=`expr $number_major + $number_minor`
|
||||
age="$number_minor"
|
||||
revision="$number_revision"
|
||||
|
@ -3283,6 +3325,7 @@ EOF
|
|||
current=`expr $number_major + $number_minor`
|
||||
age="$number_minor"
|
||||
revision="$number_minor"
|
||||
lt_irix_increment=no
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
@ -3342,7 +3385,8 @@ EOF
|
|||
versuffix="$major.$age.$revision"
|
||||
# Darwin ld doesn't like 0 for these options...
|
||||
minor_current=`expr $current + 1`
|
||||
verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
|
||||
xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
|
||||
verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
|
||||
;;
|
||||
|
||||
freebsd-aout)
|
||||
|
@ -3356,8 +3400,11 @@ EOF
|
|||
;;
|
||||
|
||||
irix | nonstopux)
|
||||
major=`expr $current - $age + 1`
|
||||
|
||||
if test "X$lt_irix_increment" = "Xno"; then
|
||||
major=`expr $current - $age`
|
||||
else
|
||||
major=`expr $current - $age + 1`
|
||||
fi
|
||||
case $version_type in
|
||||
nonstopux) verstring_prefix=nonstopux ;;
|
||||
*) verstring_prefix=sgi ;;
|
||||
|
@ -3495,8 +3542,7 @@ EOF
|
|||
oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
|
||||
fi
|
||||
|
||||
### Commented out in pkgsrc, since it is completely broken.
|
||||
## Eliminate all temporary directories.
|
||||
# Eliminate all temporary directories.
|
||||
#for path in $notinst_path; do
|
||||
# lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
|
||||
# deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
|
||||
|
@ -3602,13 +3648,12 @@ EOF
|
|||
int main() { return 0; }
|
||||
EOF
|
||||
$rm conftest
|
||||
$LTCC $LTCFLAGS -o conftest conftest.c $deplibs
|
||||
if test "$?" -eq 0 ; then
|
||||
if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
|
||||
ldd_output=`ldd conftest`
|
||||
for i in $deplibs; do
|
||||
name=`expr $i : '-l\(.*\)'`
|
||||
# If $name is empty we are operating on a -L argument.
|
||||
if test "$name" != "" && test "$name" -ne "0"; then
|
||||
if test "$name" != "" && test "$name" != "0"; then
|
||||
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
|
||||
case " $predeps $postdeps " in
|
||||
*" $i "*)
|
||||
|
@ -3647,9 +3692,7 @@ EOF
|
|||
# If $name is empty we are operating on a -L argument.
|
||||
if test "$name" != "" && test "$name" != "0"; then
|
||||
$rm conftest
|
||||
$LTCC $LTCFLAGS -o conftest conftest.c $i
|
||||
# Did it work?
|
||||
if test "$?" -eq 0 ; then
|
||||
if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
|
||||
ldd_output=`ldd conftest`
|
||||
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
|
||||
case " $predeps $postdeps " in
|
||||
|
@ -3681,7 +3724,7 @@ EOF
|
|||
droppeddeps=yes
|
||||
$echo
|
||||
$echo "*** Warning! Library $i is needed by this library but I was not able to"
|
||||
$echo "*** make it link in! You will probably need to install it or some"
|
||||
$echo "*** make it link in! You will probably need to install it or some"
|
||||
$echo "*** library that it depends on before this library will be fully"
|
||||
$echo "*** functional. Installing it before continuing would be even better."
|
||||
fi
|
||||
|
@ -3967,7 +4010,10 @@ EOF
|
|||
test -n "$hardcode_libdirs"; then
|
||||
libdir="$hardcode_libdirs"
|
||||
if test -n "$hardcode_libdir_flag_spec_ld"; then
|
||||
eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
|
||||
case $archive_cmds in
|
||||
*\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
|
||||
*) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
|
||||
esac
|
||||
else
|
||||
eval dep_rpath=\"$hardcode_libdir_flag_spec\"
|
||||
fi
|
||||
|
@ -4326,12 +4372,14 @@ EOF
|
|||
reload_conv_objs=
|
||||
gentop=
|
||||
# reload_cmds runs $LD directly, so let us get rid of
|
||||
# -Wl from whole_archive_flag_spec
|
||||
# -Wl from whole_archive_flag_spec and hope we can get by with
|
||||
# turning comma into space..
|
||||
wl=
|
||||
|
||||
if test -n "$convenience"; then
|
||||
if test -n "$whole_archive_flag_spec"; then
|
||||
eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
|
||||
eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
|
||||
reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
|
||||
else
|
||||
gentop="$output_objdir/${obj}x"
|
||||
generated="$generated $gentop"
|
||||
|
@ -4779,16 +4827,16 @@ static const void *lt_preloaded_setup() {
|
|||
case $host in
|
||||
*cygwin* | *mingw* )
|
||||
if test -f "$output_objdir/${outputname}.def" ; then
|
||||
compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
|
||||
finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
|
||||
compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
|
||||
finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
|
||||
else
|
||||
compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
|
||||
finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
|
||||
compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
|
||||
finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
|
||||
fi
|
||||
;;
|
||||
* )
|
||||
compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
|
||||
finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
|
||||
compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
|
||||
finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
@ -4803,13 +4851,13 @@ static const void *lt_preloaded_setup() {
|
|||
# really was required.
|
||||
|
||||
# Nullify the symbol file.
|
||||
compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
|
||||
finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
|
||||
compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
|
||||
finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
|
||||
fi
|
||||
|
||||
if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
|
||||
# Replace the output file specification.
|
||||
compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
|
||||
compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
|
||||
link_command="$compile_command$compile_rpath"
|
||||
|
||||
# We have no uninstalled library dependencies, so finalize right now.
|
||||
|
@ -4896,7 +4944,7 @@ static const void *lt_preloaded_setup() {
|
|||
if test "$fast_install" != no; then
|
||||
link_command="$finalize_var$compile_command$finalize_rpath"
|
||||
if test "$fast_install" = yes; then
|
||||
relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
|
||||
relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
|
||||
else
|
||||
# fast_install is set to needless
|
||||
relink_command=
|
||||
|
@ -4933,7 +4981,7 @@ static const void *lt_preloaded_setup() {
|
|||
fi
|
||||
done
|
||||
relink_command="(cd `pwd`; $relink_command)"
|
||||
relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
|
||||
relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
|
||||
fi
|
||||
|
||||
# Quote $echo for shipping.
|
||||
|
@ -5340,6 +5388,20 @@ EOF
|
|||
Xsed='${SED} -e 1s/^X//'
|
||||
sed_quote_subst='$sed_quote_subst'
|
||||
|
||||
# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
|
||||
if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
|
||||
emulate sh
|
||||
NULLCMD=:
|
||||
# Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
|
||||
# is contrary to our usage. Disable this feature.
|
||||
alias -g '\${1+\"\$@\"}'='\"\$@\"'
|
||||
setopt NO_GLOB_SUBST
|
||||
else
|
||||
case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
|
||||
fi
|
||||
BIN_SH=xpg4; export BIN_SH # for Tru64
|
||||
DUALCASE=1; export DUALCASE # for MKS sh
|
||||
|
||||
# The HP-UX ksh and POSIX shell print the target directory to stdout
|
||||
# if CDPATH is set.
|
||||
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
|
||||
|
@ -5482,7 +5544,7 @@ else
|
|||
;;
|
||||
esac
|
||||
$echo >> $output "\
|
||||
\$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
|
||||
\$echo \"\$0: cannot exec \$program \$*\"
|
||||
exit $EXIT_FAILURE
|
||||
fi
|
||||
else
|
||||
|
@ -5668,7 +5730,7 @@ fi\
|
|||
done
|
||||
# Quote the link command for shipping.
|
||||
relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
|
||||
relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
|
||||
relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
|
||||
if test "$hardcode_automatic" = yes ; then
|
||||
relink_command=
|
||||
fi
|
||||
|
@ -6021,9 +6083,9 @@ relink_command=\"$relink_command\""
|
|||
|
||||
if test -n "$inst_prefix_dir"; then
|
||||
# Stick the inst_prefix_dir data into the link command.
|
||||
relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
|
||||
relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
|
||||
else
|
||||
relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
|
||||
relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
|
||||
fi
|
||||
|
||||
$echo "$modename: warning: relinking \`$file'" 1>&2
|
||||
|
@ -6232,7 +6294,7 @@ relink_command=\"$relink_command\""
|
|||
file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
|
||||
outputname="$tmpdir/$file"
|
||||
# Replace the output file specification.
|
||||
relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
|
||||
relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
|
||||
|
||||
$show "$relink_command"
|
||||
if $run eval "$relink_command"; then :
|
||||
|
@ -6443,8 +6505,10 @@ relink_command=\"$relink_command\""
|
|||
if test -f "$dir/$objdir/$dlname"; then
|
||||
dir="$dir/$objdir"
|
||||
else
|
||||
$echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
|
||||
exit $EXIT_FAILURE
|
||||
if test ! -f "$dir/$dlname"; then
|
||||
$echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
|
||||
exit $EXIT_FAILURE
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
|
@ -6508,12 +6572,12 @@ relink_command=\"$relink_command\""
|
|||
fi
|
||||
|
||||
# Restore saved environment variables
|
||||
if test "${save_LC_ALL+set}" = set; then
|
||||
LC_ALL="$save_LC_ALL"; export LC_ALL
|
||||
fi
|
||||
if test "${save_LANG+set}" = set; then
|
||||
LANG="$save_LANG"; export LANG
|
||||
fi
|
||||
for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
|
||||
do
|
||||
eval "if test \"\${save_$lt_var+set}\" = set; then
|
||||
$lt_var=\$save_$lt_var; export $lt_var
|
||||
fi"
|
||||
done
|
||||
|
||||
# Now prepare to actually exec the command.
|
||||
exec_cmd="\$cmd$args"
|
||||
|
@ -6870,9 +6934,9 @@ The following components of LINK-COMMAND are treated specially:
|
|||
-dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
|
||||
-export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
|
||||
-export-symbols SYMFILE
|
||||
try to export only the symbols listed in SYMFILE
|
||||
try to export only the symbols listed in SYMFILE
|
||||
-export-symbols-regex REGEX
|
||||
try to export only the symbols matching REGEX
|
||||
try to export only the symbols matching REGEX
|
||||
-LLIBDIR search LIBDIR for required installed libraries
|
||||
-lNAME OUTPUT-FILE requires the installed library libNAME
|
||||
-module build a library that can dlopened
|
||||
|
@ -6886,9 +6950,11 @@ The following components of LINK-COMMAND are treated specially:
|
|||
-release RELEASE specify package release information
|
||||
-rpath LIBDIR the created library will eventually be installed in LIBDIR
|
||||
-R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
|
||||
-static do not do any dynamic linking of libtool libraries
|
||||
-static do not do any dynamic linking of uninstalled libtool libraries
|
||||
-static-libtool-libs
|
||||
do not do any dynamic linking of libtool libraries
|
||||
-version-info CURRENT[:REVISION[:AGE]]
|
||||
specify library version info [each variable defaults to 0]
|
||||
specify library version info [each variable defaults to 0]
|
||||
|
||||
All other options (arguments beginning with \`-') are ignored.
|
||||
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#define PACKAGE_REVISION_BASE "0f91638f340d2b407861ab90207167eb6a8be88c"
|
||||
#define PACKAGE_REVISION_BASE "dc8e3f9b3c86b34f877ff1bfde4a8b17a4ad1326"
|
||||
#define PACKAGE_REVISION_CACHED 1
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
|
@ -42,18 +42,58 @@ extern "C" {
|
|||
#include <unistd.h>
|
||||
}
|
||||
|
||||
#include <cstdarg>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
|
||||
#include "atf/application.hpp"
|
||||
#include "atf/exceptions.hpp"
|
||||
#include "atf/sanity.hpp"
|
||||
#include "atf/ui.hpp"
|
||||
|
||||
atf::application::option::option(char ch,
|
||||
const std::string& a,
|
||||
const std::string& desc) :
|
||||
#if !defined(HAVE_VSNPRINTF_IN_STD)
|
||||
namespace std {
|
||||
using ::vsnprintf;
|
||||
}
|
||||
#endif // !defined(HAVE_VSNPRINTF_IN_STD)
|
||||
|
||||
namespace impl = atf::application;
|
||||
#define IMPL_NAME "atf::application"
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// The "usage_error" class.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
impl::usage_error::usage_error(const char *fmt, ...)
|
||||
throw() :
|
||||
std::runtime_error("usage_error; message unformatted")
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
std::vsnprintf(m_text, sizeof(m_text), fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
impl::usage_error::~usage_error(void)
|
||||
throw()
|
||||
{
|
||||
}
|
||||
|
||||
const char*
|
||||
impl::usage_error::what(void)
|
||||
const throw()
|
||||
{
|
||||
return m_text;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// The "application" class.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
impl::option::option(char ch,
|
||||
const std::string& a,
|
||||
const std::string& desc) :
|
||||
m_character(ch),
|
||||
m_argument(a),
|
||||
m_description(desc)
|
||||
|
@ -61,34 +101,36 @@ atf::application::option::option(char ch,
|
|||
}
|
||||
|
||||
bool
|
||||
atf::application::option::operator<(const atf::application::option& o)
|
||||
impl::option::operator<(const impl::option& o)
|
||||
const
|
||||
{
|
||||
return m_character < o.m_character;
|
||||
}
|
||||
|
||||
atf::application::application(const std::string& description,
|
||||
const std::string& manpage) :
|
||||
impl::app::app(const std::string& description,
|
||||
const std::string& manpage,
|
||||
const std::string& global_manpage) :
|
||||
m_argc(-1),
|
||||
m_argv(NULL),
|
||||
m_prog_name(NULL),
|
||||
m_description(description),
|
||||
m_manpage(manpage)
|
||||
m_manpage(manpage),
|
||||
m_global_manpage(global_manpage)
|
||||
{
|
||||
}
|
||||
|
||||
atf::application::~application(void)
|
||||
impl::app::~app(void)
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
atf::application::inited(void)
|
||||
impl::app::inited(void)
|
||||
{
|
||||
return m_argc != -1;
|
||||
}
|
||||
|
||||
atf::application::options_set
|
||||
atf::application::options(void)
|
||||
impl::app::options_set
|
||||
impl::app::options(void)
|
||||
{
|
||||
options_set opts = specific_options();
|
||||
opts.insert(option('h', "", "Shows this help message"));
|
||||
|
@ -96,30 +138,34 @@ atf::application::options(void)
|
|||
}
|
||||
|
||||
std::string
|
||||
atf::application::specific_args(void)
|
||||
impl::app::specific_args(void)
|
||||
const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
atf::application::options_set
|
||||
atf::application::specific_options(void)
|
||||
impl::app::options_set
|
||||
impl::app::specific_options(void)
|
||||
const
|
||||
{
|
||||
return options_set();
|
||||
}
|
||||
|
||||
void
|
||||
atf::application::process_option(int ch, const char* arg)
|
||||
impl::app::process_option(int ch, const char* arg)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
atf::application::process_options(void)
|
||||
impl::app::process_options(void)
|
||||
{
|
||||
PRE(inited());
|
||||
|
||||
std::string optstr(":");
|
||||
std::string optstr;
|
||||
#if defined(HAVE_GNU_GETOPT)
|
||||
optstr += '+'; // Turn on POSIX behavior.
|
||||
#endif
|
||||
optstr += ':';
|
||||
{
|
||||
options_set opts = options();
|
||||
for (options_set::const_iterator iter = opts.begin();
|
||||
|
@ -156,7 +202,7 @@ atf::application::process_options(void)
|
|||
}
|
||||
|
||||
void
|
||||
atf::application::usage(std::ostream& os)
|
||||
impl::app::usage(std::ostream& os)
|
||||
{
|
||||
PRE(inited());
|
||||
|
||||
|
@ -195,13 +241,16 @@ atf::application::usage(std::ostream& os)
|
|||
}
|
||||
os << std::endl;
|
||||
|
||||
std::string gmp;
|
||||
if (!m_global_manpage.empty())
|
||||
gmp = " and " + m_global_manpage;
|
||||
os << ui::format_text("For more details please see " + m_manpage +
|
||||
" and atf(7).")
|
||||
gmp + ".")
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
int
|
||||
atf::application::run(int argc, char* const* argv)
|
||||
impl::app::run(int argc, char* const* argv)
|
||||
{
|
||||
PRE(argc > 0);
|
||||
PRE(argv != NULL);
|
||||
|
|
|
@ -39,31 +39,54 @@
|
|||
|
||||
#include <ostream>
|
||||
#include <set>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
#include <atf/exceptions.hpp>
|
||||
|
||||
namespace atf {
|
||||
namespace application {
|
||||
|
||||
class application {
|
||||
// ------------------------------------------------------------------------
|
||||
// The "usage_error" class.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
class usage_error : public std::runtime_error {
|
||||
char m_text[4096];
|
||||
|
||||
public:
|
||||
usage_error(const char*, ...) throw();
|
||||
~usage_error(void) throw();
|
||||
|
||||
const char* what(void) const throw();
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// The "option" class.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
class option {
|
||||
char m_character;
|
||||
std::string m_argument;
|
||||
std::string m_description;
|
||||
|
||||
friend class app;
|
||||
|
||||
public:
|
||||
option(char, const std::string&, const std::string&);
|
||||
|
||||
bool operator<(const option&) const;
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// The "app" class.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
class app {
|
||||
void process_options(void);
|
||||
void usage(std::ostream&);
|
||||
|
||||
bool inited(void);
|
||||
|
||||
protected:
|
||||
class option {
|
||||
char m_character;
|
||||
std::string m_argument;
|
||||
std::string m_description;
|
||||
|
||||
friend class application;
|
||||
|
||||
public:
|
||||
option(char, const std::string&, const std::string&);
|
||||
|
||||
bool operator<(const option&) const;
|
||||
};
|
||||
typedef std::set< option > options_set;
|
||||
|
||||
int m_argc;
|
||||
|
@ -71,7 +94,7 @@ protected:
|
|||
|
||||
const char* m_prog_name;
|
||||
std::string m_description;
|
||||
std::string m_manpage;
|
||||
std::string m_manpage, m_global_manpage;
|
||||
|
||||
options_set options(void);
|
||||
|
||||
|
@ -82,12 +105,13 @@ protected:
|
|||
virtual int main(void) = 0;
|
||||
|
||||
public:
|
||||
application(const std::string&, const std::string&);
|
||||
virtual ~application(void);
|
||||
app(const std::string&, const std::string&, const std::string&);
|
||||
virtual ~app(void);
|
||||
|
||||
int run(int, char* const* argv);
|
||||
};
|
||||
|
||||
} // namespace application
|
||||
} // namespace atf
|
||||
|
||||
#endif // !defined(_ATF_APPLICATION_HPP_)
|
||||
|
|
|
@ -0,0 +1,297 @@
|
|||
.\"
|
||||
.\" Automated Testing Framework (atf)
|
||||
.\"
|
||||
.\" Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. All advertising materials mentioning features or use of this
|
||||
.\" software must display the following acknowledgement:
|
||||
.\" This product includes software developed by the NetBSD
|
||||
.\" Foundation, Inc. and its contributors.
|
||||
.\" 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
.\" contributors may be used to endorse or promote products derived
|
||||
.\" from this software without specific prior written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
|
||||
.\" CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
.\" IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd January 5, 2008
|
||||
.Dt ATF-C++-API 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm ATF_ADD_TEST_CASE ,
|
||||
.Nm ATF_CHECK ,
|
||||
.Nm ATF_CHECK_EQUAL ,
|
||||
.Nm ATF_CHECK_THROW ,
|
||||
.Nm ATF_FAIL ,
|
||||
.Nm ATF_INIT_TEST_CASES ,
|
||||
.Nm ATF_PASS ,
|
||||
.Nm ATF_SKIP ,
|
||||
.Nm ATF_TEST_CASE ,
|
||||
.Nm ATF_TEST_CASE_BODY ,
|
||||
.Nm ATF_TEST_CASE_CLEANUP ,
|
||||
.Nm ATF_TEST_CASE_HEAD ,
|
||||
.Nm ATF_TEST_CASE_WITH_CLEANUP
|
||||
.Nd C++ API to write ATF-based test programs
|
||||
.Sh SYNOPSIS
|
||||
.In atf.hpp
|
||||
.Fn ATF_ADD_TEST_CASE "tcs" "name"
|
||||
.Fn ATF_CHECK "expression"
|
||||
.Fn ATF_CHECK_EQUAL "expression_1" "expression_2"
|
||||
.Fn ATF_CHECK_THROW "statement_1" "expected_exception"
|
||||
.Fn ATF_FAIL "reason"
|
||||
.Fn ATF_INIT_TEST_CASES "tcs"
|
||||
.Fn ATF_PASS
|
||||
.Fn ATF_SKIP "reason"
|
||||
.Fn ATF_TEST_CASE "name"
|
||||
.Fn ATF_TEST_CASE_BODY "name"
|
||||
.Fn ATF_TEST_CASE_CLEANUP "name"
|
||||
.Fn ATF_TEST_CASE_HEAD "name"
|
||||
.Fn ATF_TEST_CASE_WITH_CLEANUP "name"
|
||||
.Sh DESCRIPTION
|
||||
ATF provides a mostly-macro-based programming interface to implement test
|
||||
programs in C or C++.
|
||||
This interface is backed by a C++ implementation, but this fact is
|
||||
hidden from the developer as much as possible through the use of
|
||||
macros to simplify programming.
|
||||
However, the use of C++ is not hidden everywhere and while you can
|
||||
implement test cases without knowing anything at all about the object model
|
||||
underneath the provided calls, you might need some minimum notions of the
|
||||
language in very specific circumstances.
|
||||
.Pp
|
||||
C++-based test programs always follow this template:
|
||||
.Bd -literal -offset indent
|
||||
extern "C" {
|
||||
.Ns ... C-specific includes go here ...
|
||||
}
|
||||
|
||||
.Ns ... C++-specific includes go here ...
|
||||
|
||||
#include <atf.hpp>
|
||||
|
||||
ATF_TEST_CASE(tc1);
|
||||
ATF_TEST_CASE_HEAD(tc1)
|
||||
{
|
||||
... first test case's header ...
|
||||
}
|
||||
ATF_TEST_CASE_BODY(tc1)
|
||||
{
|
||||
... first test case's body ...
|
||||
}
|
||||
|
||||
ATF_TEST_CASE_WITH_CLEANUP(tc2);
|
||||
ATF_TEST_CASE_HEAD(tc2)
|
||||
{
|
||||
... second test case's header ...
|
||||
}
|
||||
ATF_TEST_CASE_BODY(tc2)
|
||||
{
|
||||
... second test case's body ...
|
||||
}
|
||||
ATF_TEST_CASE_CLEANUP(tc2)
|
||||
{
|
||||
... second test case's cleanup ...
|
||||
}
|
||||
|
||||
.Ns ... additional test cases ...
|
||||
|
||||
ATF_INIT_TEST_CASES(tcs)
|
||||
{
|
||||
ATF_ADD_TEST_CASE(tcs, tc1)
|
||||
ATF_ADD_TEST_CASE(tcs, tc2)
|
||||
... add additional test cases ...
|
||||
}
|
||||
.Ed
|
||||
.Ss Definition of test cases
|
||||
Test cases have an identifier and are composed of three different parts:
|
||||
the header, the body and an optional cleanup routine, all of which are
|
||||
described in
|
||||
.Xr atf-test-case 8 .
|
||||
To define test cases, one can use the
|
||||
.Fn ATF_TEST_CASE
|
||||
or the
|
||||
.Fn ATF_TEST_CASE_WITH_CLEANUP
|
||||
macros, which take a single parameter specifiying the test case's
|
||||
name.
|
||||
The former does not allow the specification of a cleanup routine for the
|
||||
test case while the latter does.
|
||||
It is important to note that these
|
||||
.Em do not
|
||||
set the test case up for execution when the program is run.
|
||||
In order to do so, a later registration is needed through the
|
||||
.Fn ATF_ADD_TEST_CASE
|
||||
macro detailed in
|
||||
.Sx Program initialization .
|
||||
.Pp
|
||||
Later on, one must define the three parts of the body by means of three
|
||||
functions.
|
||||
Their headers are given by the
|
||||
.Fn ATF_TEST_CASE_HEAD ,
|
||||
.Fn ATF_TEST_CASE_BODY
|
||||
and
|
||||
.Fn ATF_TEST_CASE_CLEANUP
|
||||
macros, all of which take the test case's name.
|
||||
Following each of these, a block of code is expected, surrounded by the
|
||||
opening and closing brackets.
|
||||
.Ss Program initialization
|
||||
The library provides a way to easily define the test program's
|
||||
.Fn main
|
||||
function.
|
||||
You should never define one on your own, but rely on the
|
||||
library to do it for you.
|
||||
This is done by using the
|
||||
.Fn ATF_INIT_TEST_CASES
|
||||
macro, which is passed the name of the list that will hold the test cases.
|
||||
This name can be whatever you want as long as it is a valid variable value.
|
||||
.Pp
|
||||
After the macro, you are supposed to provide the body of a function, which
|
||||
should only use the
|
||||
.Fn ATF_ADD_TEST_CASE
|
||||
macro to register the test cases the test program will execute.
|
||||
The first parameter of this macro matches the name you provided in the
|
||||
former call.
|
||||
.Ss Header definitions
|
||||
The test case's header can define the meta-data by using the
|
||||
.Fn set
|
||||
method, which takes two parameters: the first one specifies the
|
||||
meta-data variable to be set and the second one specifies its value.
|
||||
Both of them are strings.
|
||||
.Ss Configuration variables
|
||||
The test case has read-only access to the current configuration variables
|
||||
by means of the
|
||||
.Ft vars_map
|
||||
.Fn config
|
||||
method, which can be called in any of the three parts of a test case.
|
||||
.Pp
|
||||
The
|
||||
.Ft vars_map
|
||||
type extends a string-to-string standard C++ map and adds some convenience
|
||||
functions to it.
|
||||
The
|
||||
.Fn has
|
||||
method takes the name of a configuration variable and returns a boolean
|
||||
indicating whether the map contains it or not.
|
||||
If the variable is present, there are several getters to retrieve its
|
||||
value.
|
||||
.Pp
|
||||
The first version of the
|
||||
.Fn get
|
||||
method takes the name of a variable and returns its value as a textual
|
||||
string.
|
||||
It assumes that the variable is present in the map and will crash your
|
||||
program if it is not.
|
||||
The second is an overloaded version of
|
||||
.Fn get
|
||||
that takes two parameters: the name of a variable and the default value for
|
||||
it.
|
||||
It returns the variable's value if it is defined, or the default value
|
||||
if not.
|
||||
.Pp
|
||||
Similarly, there are a couple of
|
||||
.Fn get_bool
|
||||
methods that mimic the previous ones but interpret the variable's textual
|
||||
value and return a boolean instead.
|
||||
.Ss Access to the source directory
|
||||
It is possible to get the path to the test case's source directory from any
|
||||
of its three components by using the
|
||||
.Fn get_srcdir
|
||||
method.
|
||||
.Ss Requiring programs
|
||||
Aside from the
|
||||
.Va require.progs
|
||||
meta-data variable available in the header only, one can also check for
|
||||
additional programs in the test case's body by using the
|
||||
.Fn require_prog
|
||||
function, which takes the base name or full path of a single binary.
|
||||
Relative paths are forbidden.
|
||||
If it is not found, the test case will be automatically skipped.
|
||||
.Ss Test case finalization
|
||||
The test case finalizes either when the body reaches its end, at which
|
||||
point the test is assumed to have
|
||||
.Em passed ,
|
||||
or at any explicit call to
|
||||
.Fn ATF_PASS ,
|
||||
.Fn ATF_FAIL
|
||||
or
|
||||
.Fn ATF_SKIP .
|
||||
These three macros terminate the execution of the test case immediately.
|
||||
The cleanup routine will be processed afterwards in a completely automated
|
||||
way, regardless of the test case's termination reason.
|
||||
.Pp
|
||||
.Fn ATF_PASS
|
||||
does not take any parameters.
|
||||
.Fn ATF_FAIL
|
||||
and
|
||||
.Fn ATF_SKIP
|
||||
take a single string that describes why the test case failed or
|
||||
was skipped, respectively.
|
||||
It is very important to provide a clear error message in both cases so that
|
||||
the user can quickly know why the test did not pass.
|
||||
.Ss Helper macros for common checks
|
||||
The library provides several macros that are very handy in multiple
|
||||
situations.
|
||||
These basically check some condition after executing a given statement or
|
||||
processing a given expression and, if the condition is not met, they
|
||||
automatically call
|
||||
.Fn ATF_FAIL
|
||||
with an appropriate error message.
|
||||
.Pp
|
||||
.Fn ATF_CHECK
|
||||
takes an expression and raises a failure if it evaluates to false.
|
||||
.Pp
|
||||
.Fn ATF_CHECK_EQUAL
|
||||
takes two expressions and raises a failure if the two do not evaluate to
|
||||
the same exact value.
|
||||
.Pp
|
||||
.Fn ATF_CHECK_THROW
|
||||
takes a statement and the name of an exception and raises a failure if
|
||||
the statement did not throw the specified exception.
|
||||
.Sh EXAMPLES
|
||||
The following shows a complete test program with a single test case that
|
||||
validates the addition operator:
|
||||
.Bd -literal -offset indent
|
||||
#include <atf.hpp>
|
||||
|
||||
ATF_TEST_CASE(addition);
|
||||
ATF_TEST_CASE_HEAD(addition)
|
||||
{
|
||||
set("descr", "Sample tests for the addition operator");
|
||||
}
|
||||
ATF_TEST_CASE_BODY(addition)
|
||||
{
|
||||
ATF_CHECK_EQUAL(0 + 0, 0);
|
||||
ATF_CHECK_EQUAL(0 + 1, 1);
|
||||
ATF_CHECK_EQUAL(1 + 0, 1);
|
||||
|
||||
ATF_CHECK_EQUAL(1 + 1, 2);
|
||||
|
||||
ATF_CHECK_EQUAL(100 + 200, 300);
|
||||
}
|
||||
|
||||
ATF_INIT_TEST_CASES(tcs)
|
||||
{
|
||||
ATF_ADD_TEST_CASE(tcs, addition);
|
||||
}
|
||||
.Ed
|
||||
.Sh SEE ALSO
|
||||
.Xr atf-test-program 1 ,
|
||||
.Xr atf 7 ,
|
||||
.Xr atf-test-case 8
|
|
@ -56,7 +56,11 @@ class reader : public atf::formats::atf_atffile_reader {
|
|||
if (isglob) {
|
||||
std::set< std::string > ms =
|
||||
atf::expand::expand_glob(name, m_dir.names());
|
||||
m_tps.insert(m_tps.end(), ms.begin(), ms.end());
|
||||
// Cannot use m_tps.insert(iterator, begin, end) here because it
|
||||
// does not work under Solaris.
|
||||
for (std::set< std::string >::const_iterator iter = ms.begin();
|
||||
iter != ms.end(); iter++)
|
||||
m_tps.push_back(*iter);
|
||||
} else {
|
||||
if (m_dir.find(name) == m_dir.end())
|
||||
throw atf::not_found_error< atf::fs::path >
|
||||
|
@ -117,8 +121,8 @@ atf::atffile::atffile(const atf::fs::path& filename)
|
|||
// all possible test programs in it.
|
||||
fs::directory dir(filename.branch_path());
|
||||
dir.erase(filename.leaf_name());
|
||||
for (fs::directory::iterator iter = dir.begin(); iter != dir.end();
|
||||
iter++) {
|
||||
fs::directory::iterator iter = dir.begin();
|
||||
while (iter != dir.end()) {
|
||||
const std::string& name = (*iter).first;
|
||||
const fs::file_info& fi = (*iter).second;
|
||||
|
||||
|
@ -126,7 +130,9 @@ atf::atffile::atffile(const atf::fs::path& filename)
|
|||
// not candidates for glob matching.
|
||||
if (name[0] == '.' || (!fi.is_owner_executable() &&
|
||||
!fi.is_group_executable()))
|
||||
dir.erase(iter);
|
||||
dir.erase(iter++);
|
||||
else
|
||||
iter++;
|
||||
}
|
||||
|
||||
// Parse the atffile.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
|
@ -54,6 +54,15 @@ init_variables(void)
|
|||
{
|
||||
PRE(m_variables.empty());
|
||||
|
||||
if (atf::env::has("ATF_ARCH")) {
|
||||
const std::string& val = atf::env::get("ATF_ARCH");
|
||||
if (!val.empty())
|
||||
m_variables["atf_arch"] = val;
|
||||
else
|
||||
m_variables["atf_arch"] = ATF_ARCH;
|
||||
} else
|
||||
m_variables["atf_arch"] = ATF_ARCH;
|
||||
|
||||
if (atf::env::has("ATF_CONFDIR")) {
|
||||
const std::string& val = atf::env::get("ATF_CONFDIR");
|
||||
if (!val.empty())
|
||||
|
@ -72,6 +81,15 @@ init_variables(void)
|
|||
} else
|
||||
m_variables["atf_libexecdir"] = ATF_LIBEXECDIR;
|
||||
|
||||
if (atf::env::has("ATF_MACHINE")) {
|
||||
const std::string& val = atf::env::get("ATF_MACHINE");
|
||||
if (!val.empty())
|
||||
m_variables["atf_machine"] = val;
|
||||
else
|
||||
m_variables["atf_machine"] = ATF_MACHINE;
|
||||
} else
|
||||
m_variables["atf_machine"] = ATF_MACHINE;
|
||||
|
||||
if (atf::env::has("ATF_PKGDATADIR")) {
|
||||
const std::string& val = atf::env::get("ATF_PKGDATADIR");
|
||||
if (!val.empty())
|
||||
|
|
|
@ -42,12 +42,6 @@
|
|||
|
||||
#include "atf/exceptions.hpp"
|
||||
|
||||
#if !defined(HAVE_VSNPRINTF_IN_STD)
|
||||
namespace std {
|
||||
using ::vsnprintf;
|
||||
}
|
||||
#endif // !defined(HAVE_VSNPRINTF_IN_STD)
|
||||
|
||||
atf::system_error::system_error(const std::string& who,
|
||||
const std::string& message,
|
||||
int sys_err) :
|
||||
|
@ -85,26 +79,3 @@ atf::system_error::what(void)
|
|||
return "Unable to format system_error message";
|
||||
}
|
||||
}
|
||||
|
||||
atf::usage_error::usage_error(const char *fmt, ...)
|
||||
throw() :
|
||||
std::runtime_error("usage_error; message unformatted")
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
std::vsnprintf(m_text, sizeof(m_text), fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
atf::usage_error::~usage_error(void)
|
||||
throw()
|
||||
{
|
||||
}
|
||||
|
||||
const char*
|
||||
atf::usage_error::what(void)
|
||||
const throw()
|
||||
{
|
||||
return m_text;
|
||||
}
|
||||
|
|
|
@ -94,16 +94,6 @@ public:
|
|||
const char* what(void) const throw();
|
||||
};
|
||||
|
||||
class usage_error : public std::runtime_error {
|
||||
char m_text[4096];
|
||||
|
||||
public:
|
||||
usage_error(const char* fmt, ...) throw();
|
||||
~usage_error(void) throw();
|
||||
|
||||
const char* what(void) const throw();
|
||||
};
|
||||
|
||||
} // namespace atf
|
||||
|
||||
#endif // !defined(_ATF_EXCEPTIONS_HPP_)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
|
@ -55,6 +55,7 @@ extern "C" {
|
|||
#include "atf/fs.hpp"
|
||||
#include "atf/sanity.hpp"
|
||||
#include "atf/text.hpp"
|
||||
#include "atf/user.hpp"
|
||||
#include "atf/utils.hpp"
|
||||
|
||||
namespace impl = atf::fs;
|
||||
|
@ -64,6 +65,64 @@ namespace impl = atf::fs;
|
|||
// Auxiliary functions.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
//!
|
||||
//! \brief A version of access(2) using the effective user.
|
||||
//!
|
||||
//! An implementation of access(2) but using the effective user value
|
||||
//! instead of the real one. Also avoids false positives for root when
|
||||
//! asking for execute permissions, which appear in SunOS.
|
||||
//!
|
||||
static
|
||||
int
|
||||
effective_access(const impl::path& p, int mode)
|
||||
{
|
||||
struct stat st;
|
||||
|
||||
if (::lstat(p.c_str(), &st) == -1)
|
||||
return -1;
|
||||
|
||||
// Early return if we are only checking for existence and the file
|
||||
// exists (stat call returned).
|
||||
if (F_OK == 0 && mode == 0)
|
||||
return 0;
|
||||
else if (mode & F_OK)
|
||||
return 0;
|
||||
|
||||
bool ok = false;
|
||||
if (atf::user::is_root()) {
|
||||
if (!ok && !(mode & X_OK)) {
|
||||
// Allow root to read/write any file.
|
||||
ok = true;
|
||||
}
|
||||
|
||||
if (!ok && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) {
|
||||
// Allow root to execute the file if any of its execution bits
|
||||
// are set.
|
||||
ok = true;
|
||||
}
|
||||
} else {
|
||||
if (!ok && (atf::user::euid() == st.st_uid)) {
|
||||
ok = ((mode & R_OK) && (st.st_mode & S_IRUSR)) ||
|
||||
((mode & W_OK) && (st.st_mode & S_IWUSR)) ||
|
||||
((mode & X_OK) && (st.st_mode & S_IXUSR));
|
||||
}
|
||||
if (!ok && (atf::user::is_member_of_group(st.st_gid))) {
|
||||
ok = ((mode & R_OK) && (st.st_mode & S_IRGRP)) ||
|
||||
((mode & W_OK) && (st.st_mode & S_IWGRP)) ||
|
||||
((mode & X_OK) && (st.st_mode & S_IXGRP));
|
||||
}
|
||||
if (!ok) {
|
||||
ok = ((mode & R_OK) && (st.st_mode & S_IROTH)) ||
|
||||
((mode & W_OK) && (st.st_mode & S_IWOTH)) ||
|
||||
((mode & X_OK) && (st.st_mode & S_IXOTH));
|
||||
}
|
||||
}
|
||||
|
||||
if (!ok)
|
||||
errno = EACCES;
|
||||
return ok ? 0 : -1;
|
||||
}
|
||||
|
||||
//!
|
||||
//! \brief A controlled version of access(2).
|
||||
//!
|
||||
|
@ -77,13 +136,13 @@ safe_access(const impl::path& p, int mode, int experr)
|
|||
{
|
||||
bool ok;
|
||||
|
||||
int res = ::access(p.c_str(), mode);
|
||||
int res = effective_access(p, mode);
|
||||
if (res == 0)
|
||||
ok = true;
|
||||
else if (res == -1 && errno == experr)
|
||||
ok = false;
|
||||
else
|
||||
throw atf::system_error("safe_access(" + p.str() + ")",
|
||||
throw atf::system_error("effective_access(" + p.str() + ")",
|
||||
"access(2) failed", errno);
|
||||
|
||||
return ok;
|
||||
|
@ -502,6 +561,10 @@ impl::is_executable(const path& p)
|
|||
void
|
||||
impl::remove(const path& p)
|
||||
{
|
||||
if (file_info(p).get_type() == file_info::dir_type)
|
||||
throw atf::system_error(IMPL_NAME "::remove(" + p.str() + ")",
|
||||
"Is a directory",
|
||||
EPERM);
|
||||
if (::unlink(p.c_str()) == -1)
|
||||
throw atf::system_error(IMPL_NAME "::remove(" + p.str() + ")",
|
||||
"unlink(" + p.str() + ") failed",
|
||||
|
@ -592,7 +655,10 @@ impl::cleanup(const path& p)
|
|||
std::vector< path > mntpts = find_mount_points(p, file_info(p));
|
||||
for (std::vector< path >::const_iterator iter = mntpts.begin();
|
||||
iter != mntpts.end(); iter++) {
|
||||
const path& p2 = *iter;
|
||||
// At least, FreeBSD's unmount(2) requires the path to be absolute.
|
||||
// Let's make it absolute in all cases just to be safe that this does
|
||||
// not affect other systems.
|
||||
path p2 = (*iter).is_absolute() ? (*iter) : (*iter).to_absolute();
|
||||
#if defined(HAVE_UNMOUNT)
|
||||
if (::unmount(p2.c_str(), 0) == -1)
|
||||
throw system_error(IMPL_NAME "::cleanup(" + p.str() + ")",
|
||||
|
|
|
@ -41,6 +41,8 @@
|
|||
#include <ostream>
|
||||
#include <streambuf>
|
||||
|
||||
#include <atf/utils.hpp>
|
||||
|
||||
namespace atf {
|
||||
namespace io {
|
||||
|
||||
|
@ -257,7 +259,7 @@ private:
|
|||
//! the on-disk file and the in-memory buffers.
|
||||
//!
|
||||
class systembuf :
|
||||
public std::streambuf
|
||||
public std::streambuf, utils::noncopyable
|
||||
{
|
||||
public:
|
||||
typedef int handle_type;
|
||||
|
@ -279,9 +281,6 @@ public:
|
|||
explicit systembuf(handle_type h, std::size_t bufsize = 8192);
|
||||
~systembuf(void);
|
||||
|
||||
systembuf(const systembuf&);
|
||||
systembuf& operator=(const systembuf&);
|
||||
|
||||
private:
|
||||
//!
|
||||
//! \brief Native file handle used by the systembuf object.
|
||||
|
@ -456,7 +455,7 @@ public:
|
|||
//! until the writer generates some data.
|
||||
//!
|
||||
class pistream :
|
||||
public std::istream
|
||||
public std::istream, utils::noncopyable
|
||||
{
|
||||
//!
|
||||
//! \brief The file handle managed by this stream.
|
||||
|
@ -468,9 +467,6 @@ class pistream :
|
|||
//!
|
||||
systembuf m_systembuf;
|
||||
|
||||
pistream(const pistream&);
|
||||
pistream& operator=(const pistream&);
|
||||
|
||||
public:
|
||||
//!
|
||||
//! \brief Creates a new process' output stream.
|
||||
|
@ -531,7 +527,7 @@ public:
|
|||
//! until the reader consumes some data, leaving some new room.
|
||||
//!
|
||||
class postream :
|
||||
public std::ostream
|
||||
public std::ostream, utils::noncopyable
|
||||
{
|
||||
//!
|
||||
//! \brief The file handle managed by this stream.
|
||||
|
@ -543,9 +539,6 @@ class postream :
|
|||
//!
|
||||
systembuf m_systembuf;
|
||||
|
||||
postream(const postream&);
|
||||
postream& operator=(const postream&);
|
||||
|
||||
public:
|
||||
//!
|
||||
//! \brief Creates a new process' input stream.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
|
@ -86,19 +86,23 @@
|
|||
throw atf::tests::tcr::passed()
|
||||
|
||||
#define ATF_CHECK(x) \
|
||||
if (!(x)) { \
|
||||
std::ostringstream __atf_ss; \
|
||||
__atf_ss << "Line " << __LINE__ << ": " << #x << " not met"; \
|
||||
throw atf::tests::tcr::failed(__atf_ss.str()); \
|
||||
}
|
||||
do { \
|
||||
if (!(x)) { \
|
||||
std::ostringstream __atf_ss; \
|
||||
__atf_ss << "Line " << __LINE__ << ": " << #x << " not met"; \
|
||||
throw atf::tests::tcr::failed(__atf_ss.str()); \
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
#define ATF_CHECK_EQUAL(x, y) \
|
||||
if ((x) != (y)) { \
|
||||
std::ostringstream __atf_ss; \
|
||||
__atf_ss << "Line " << __LINE__ << ": " << #x << " != " << #y \
|
||||
<< " (" << (x) << " != " << (y) << ")"; \
|
||||
throw atf::tests::tcr::failed(__atf_ss.str()); \
|
||||
}
|
||||
do { \
|
||||
if ((x) != (y)) { \
|
||||
std::ostringstream __atf_ss; \
|
||||
__atf_ss << "Line " << __LINE__ << ": " << #x << " != " << #y \
|
||||
<< " (" << (x) << " != " << (y) << ")"; \
|
||||
throw atf::tests::tcr::failed(__atf_ss.str()); \
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
#define ATF_CHECK_THROW(x, e) \
|
||||
try { \
|
||||
|
@ -108,10 +112,12 @@
|
|||
#e " as expected"; \
|
||||
throw atf::tests::tcr::failed(__atf_ss.str()); \
|
||||
} catch (const e& __atf_eo) { \
|
||||
} catch (const std::runtime_error& __atf_re) { \
|
||||
} catch (const atf::tests::tcr&) { \
|
||||
throw; \
|
||||
} catch (const std::exception& __atf_e) { \
|
||||
std::ostringstream __atf_ss; \
|
||||
__atf_ss << "Line " << __LINE__ << ": " #x " threw an " \
|
||||
"unexpected error (not " #e "): " << __atf_re.what(); \
|
||||
"unexpected error (not " #e "): " << __atf_e.what(); \
|
||||
throw atf::tests::tcr::failed(__atf_ss.str()); \
|
||||
} catch (...) { \
|
||||
std::ostringstream __atf_ss; \
|
||||
|
|
|
@ -0,0 +1,132 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// 1. Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// 3. All advertising materials mentioning features or use of this
|
||||
// software must display the following acknowledgement:
|
||||
// This product includes software developed by the NetBSD
|
||||
// Foundation, Inc. and its contributors.
|
||||
// 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
|
||||
// CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
// IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
// IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
|
||||
extern "C" {
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/wait.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
}
|
||||
|
||||
#include <cerrno>
|
||||
|
||||
#include "atf/exceptions.hpp"
|
||||
#include "atf/sanity.hpp"
|
||||
#include "atf/signals.hpp"
|
||||
|
||||
namespace impl = atf::signals;
|
||||
#define IMPL_NAME "atf::signals"
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// The "signal_holder" class.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
std::map< int, impl::signal_holder* > impl::signal_holder::m_holders;
|
||||
|
||||
void
|
||||
impl::signal_holder::handler(int s)
|
||||
{
|
||||
m_holders[s]->m_happened = true;
|
||||
}
|
||||
|
||||
void
|
||||
impl::signal_holder::program(void)
|
||||
{
|
||||
if (::sigaction(m_signal, &m_sanew, &m_saold) == -1)
|
||||
throw atf::system_error(IMPL_NAME "::signal_holder::signal_holder",
|
||||
"sigaction(2) failed", errno);
|
||||
}
|
||||
|
||||
impl::signal_holder::signal_holder(int s) :
|
||||
m_signal(s),
|
||||
m_happened(false)
|
||||
{
|
||||
m_sanew.sa_handler = handler;
|
||||
sigemptyset(&m_sanew.sa_mask);
|
||||
m_sanew.sa_flags = 0;
|
||||
|
||||
program();
|
||||
PRE(m_holders.find(m_signal) == m_holders.end());
|
||||
m_holders[m_signal] = this;
|
||||
}
|
||||
|
||||
impl::signal_holder::~signal_holder(void)
|
||||
{
|
||||
int res = ::sigaction(m_signal, &m_saold, NULL);
|
||||
INV(res == 0);
|
||||
if (m_happened)
|
||||
::kill(::getpid(), m_signal);
|
||||
}
|
||||
|
||||
void
|
||||
impl::signal_holder::process(void)
|
||||
{
|
||||
if (m_happened) {
|
||||
int res = ::sigaction(m_signal, &m_saold, NULL);
|
||||
if (res == -1)
|
||||
throw atf::system_error(IMPL_NAME "::signal_holder::signal_holder",
|
||||
"sigaction(2) failed", errno);
|
||||
m_happened = false;
|
||||
::kill(::getpid(), m_signal);
|
||||
program();
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// The "signal_programmer" class.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
impl::signal_programmer::signal_programmer(int s, void (*handler)(int)) :
|
||||
m_signal(s)
|
||||
{
|
||||
struct sigaction sa;
|
||||
|
||||
sa.sa_handler = handler;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sa.sa_flags = 0;
|
||||
|
||||
if (::sigaction(m_signal, &sa, &m_saold) == -1)
|
||||
throw atf::system_error(IMPL_NAME
|
||||
"::signal_programmer::signal_programmer",
|
||||
"sigaction(2) failed", errno);
|
||||
}
|
||||
|
||||
impl::signal_programmer::~signal_programmer(void)
|
||||
{
|
||||
int res = ::sigaction(m_signal, &m_saold, NULL);
|
||||
INV(res == 0);
|
||||
}
|
|
@ -0,0 +1,119 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// 1. Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// 3. All advertising materials mentioning features or use of this
|
||||
// software must display the following acknowledgement:
|
||||
// This product includes software developed by the NetBSD
|
||||
// Foundation, Inc. and its contributors.
|
||||
// 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
|
||||
// CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
// IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
// IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
|
||||
#if !defined(_ATF_SIGNALS_HPP_)
|
||||
#define _ATF_SIGNALS_HPP_
|
||||
|
||||
extern "C" {
|
||||
#include <signal.h>
|
||||
}
|
||||
|
||||
#include <map>
|
||||
|
||||
namespace atf {
|
||||
namespace signals {
|
||||
|
||||
//
|
||||
// Define last_signo to the last signal number valid for the system.
|
||||
// This is tricky. For example, NetBSD defines SIGPWR as the last valid
|
||||
// number, whereas Mac OS X defines it as SIGTHR. Both share the same
|
||||
// signal number (32). If none of these are available, we assume that
|
||||
// the highest signal is SIGUSR2.
|
||||
//
|
||||
// TODO: Make this a configure check that uses ::kill and finds the first
|
||||
// number that returns EINVAL. The result is probably usable in the
|
||||
// shell interface too.
|
||||
//
|
||||
#if defined(SIGTHR) && defined(SIGPWR)
|
||||
# if SIGTHR > SIGPWR
|
||||
static const int last_signo = SIGTHR;
|
||||
# elif SIGPWR < SIGTHR
|
||||
static const int last_signo = SIGPWR;
|
||||
# else
|
||||
static const int last_signo = SIGPWR;
|
||||
# endif
|
||||
#elif defined(SIGTHR)
|
||||
static const int last_signo = SIGTHR;
|
||||
#elif defined(SIGPWR)
|
||||
static const int last_signo = SIGPWR;
|
||||
#else
|
||||
static const int last_signo = SIGUSR2;
|
||||
#endif
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// The "signal_holder" class.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
//
|
||||
// A RAII model to hold a signal while the object is alive.
|
||||
//
|
||||
class signal_holder {
|
||||
int m_signal;
|
||||
bool m_happened;
|
||||
struct sigaction m_sanew, m_saold;
|
||||
static std::map< int, signal_holder* > m_holders;
|
||||
|
||||
static void handler(int);
|
||||
|
||||
void program(void);
|
||||
|
||||
public:
|
||||
signal_holder(int);
|
||||
~signal_holder(void);
|
||||
|
||||
void process(void);
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// The "signal_programmer" class.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
//
|
||||
// A RAII model to program a signal while the object is alive.
|
||||
//
|
||||
class signal_programmer {
|
||||
int m_signal;
|
||||
struct sigaction m_saold;
|
||||
|
||||
public:
|
||||
signal_programmer(int s, void (*handler)(int));
|
||||
~signal_programmer(void);
|
||||
};
|
||||
|
||||
} // namespace signals
|
||||
} // namespace atf
|
||||
|
||||
#endif // !defined(_ATF_SIGNALS_HPP_)
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
|
@ -37,12 +37,14 @@
|
|||
extern "C" {
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/wait.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
}
|
||||
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
#include <cerrno>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
@ -63,6 +65,7 @@ extern "C" {
|
|||
#include "atf/fs.hpp"
|
||||
#include "atf/io.hpp"
|
||||
#include "atf/sanity.hpp"
|
||||
#include "atf/signals.hpp"
|
||||
#include "atf/tests.hpp"
|
||||
#include "atf/text.hpp"
|
||||
#include "atf/ui.hpp"
|
||||
|
@ -71,98 +74,25 @@ extern "C" {
|
|||
namespace impl = atf::tests;
|
||||
#define IMPL_NAME "atf::tests"
|
||||
|
||||
//
|
||||
// Define LAST_SIGNAL to the last signal number valid for the system.
|
||||
// This is tricky. For example, NetBSD defines SIGPWR as the last valid
|
||||
// number, whereas Mac OS X defines it as SIGTHR. Both share the same
|
||||
// signal number (32). If none of these are available, we assume that
|
||||
// the highest signal is SIGUSR2.
|
||||
//
|
||||
#if defined(SIGTHR) && defined(SIGPWR)
|
||||
# if SIGTHR > SIGPWR
|
||||
# define LAST_SIGNAL SIGTHR
|
||||
# elif SIGPWR < SIGTHR
|
||||
# define LAST_SIGNAL SIGPWR
|
||||
# else
|
||||
# define LAST_SIGNAL SIGPWR
|
||||
# endif
|
||||
#elif defined(SIGTHR)
|
||||
# define LAST_SIGNAL SIGTHR
|
||||
#elif defined(SIGPWR)
|
||||
# define LAST_SIGNAL SIGPWR
|
||||
#else
|
||||
# define LAST_SIGNAL SIGUSR2
|
||||
#endif
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// The auxiliary "signal_holder" class.
|
||||
// Auxiliary stuff for the timeout implementation.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
//
|
||||
// A RAII model to hold a signal while the object is alive.
|
||||
//
|
||||
class signal_holder {
|
||||
int m_signal;
|
||||
bool m_happened;
|
||||
struct sigaction m_sanew, m_saold;
|
||||
namespace timeout {
|
||||
static pid_t current_body = 0;
|
||||
static bool killed = false;
|
||||
|
||||
static std::map< int, signal_holder* > m_holders;
|
||||
static void handler(int s)
|
||||
void
|
||||
sigalrm_handler(int signo)
|
||||
{
|
||||
m_holders[s]->m_happened = true;
|
||||
}
|
||||
PRE(signo == SIGALRM);
|
||||
|
||||
void program(void)
|
||||
{
|
||||
if (::sigaction(m_signal, &m_sanew, &m_saold) == -1)
|
||||
throw atf::system_error("signal_holder::signal_holder",
|
||||
"sigaction(2) failed", errno);
|
||||
}
|
||||
|
||||
public:
|
||||
signal_holder(int s) :
|
||||
m_signal(s),
|
||||
m_happened(false)
|
||||
{
|
||||
m_sanew.sa_handler = handler;
|
||||
sigemptyset(&m_sanew.sa_mask);
|
||||
m_sanew.sa_flags = 0;
|
||||
|
||||
program();
|
||||
PRE(m_holders.find(m_signal) == m_holders.end());
|
||||
m_holders[m_signal] = this;
|
||||
}
|
||||
|
||||
~signal_holder(void)
|
||||
{
|
||||
int res = ::sigaction(m_signal, &m_saold, NULL);
|
||||
try {
|
||||
process();
|
||||
|
||||
if (res == -1)
|
||||
throw atf::system_error("signal_holder::signal_holder",
|
||||
"sigaction(2) failed", errno);
|
||||
} catch (...) {
|
||||
if (res == -1)
|
||||
throw atf::system_error("signal_holder::signal_holder",
|
||||
"sigaction(2) failed", errno);
|
||||
if (current_body != 0) {
|
||||
::killpg(current_body, SIGTERM);
|
||||
killed = true;
|
||||
}
|
||||
}
|
||||
|
||||
void process(void)
|
||||
{
|
||||
if (m_happened) {
|
||||
int res = ::sigaction(m_signal, &m_saold, NULL);
|
||||
::kill(0, m_signal);
|
||||
if (res == -1)
|
||||
throw atf::system_error("signal_holder::signal_holder",
|
||||
"sigaction(2) failed", errno);
|
||||
program();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
std::map< int, signal_holder* > signal_holder::m_holders;
|
||||
} // namespace timeout
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// The "vars_map" class.
|
||||
|
@ -343,6 +273,20 @@ impl::tc::ensure_boolean(const std::string& name)
|
|||
name + "'");
|
||||
}
|
||||
|
||||
void
|
||||
impl::tc::ensure_integral(const std::string& name)
|
||||
{
|
||||
ensure_not_empty(name);
|
||||
|
||||
const std::string& val = get(name);
|
||||
for (std::string::const_iterator iter = val.begin(); iter != val.end();
|
||||
iter++) {
|
||||
if (!std::isdigit(*iter))
|
||||
throw std::runtime_error("Invalid value for integral "
|
||||
"variable `" + name + "'");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
impl::tc::ensure_not_empty(const std::string& name)
|
||||
{
|
||||
|
@ -419,9 +363,11 @@ impl::tc::init(const vars_map& c, const std::string& srcdir)
|
|||
m_srcdir = srcdir;
|
||||
|
||||
m_meta_data["ident"] = m_ident;
|
||||
m_meta_data["timeout"] = "300";
|
||||
head();
|
||||
ensure_not_empty("descr");
|
||||
ensure_not_empty("ident");
|
||||
ensure_integral("timeout");
|
||||
INV(m_meta_data["ident"] == m_ident);
|
||||
}
|
||||
|
||||
|
@ -444,7 +390,7 @@ sanitize_process(const atf::fs::path& workdir)
|
|||
sadfl.sa_handler = SIG_DFL;
|
||||
sigemptyset(&sadfl.sa_mask);
|
||||
sadfl.sa_flags = 0;
|
||||
for (int i = 0; i < LAST_SIGNAL; i++)
|
||||
for (int i = 0; i < atf::signals::last_signo; i++)
|
||||
::sigaction(i, &sadfl, NULL);
|
||||
|
||||
// Reset critical environment variables to known values.
|
||||
|
@ -470,6 +416,34 @@ void
|
|||
impl::tc::check_requirements(void)
|
||||
const
|
||||
{
|
||||
if (has("require.arch")) {
|
||||
const std::string& a = get("require.arch");
|
||||
std::vector< std::string > arches = text::split(a, " ");
|
||||
bool found = false;
|
||||
for (std::vector< std::string >::const_iterator iter = arches.begin();
|
||||
iter != arches.end() && !found; iter++) {
|
||||
if ((*iter) == atf::config::get("atf_arch"))
|
||||
found = true;
|
||||
}
|
||||
if (!a.empty() && !found)
|
||||
throw tcr::skipped("Requires one of the '" + a +
|
||||
"' architectures");
|
||||
}
|
||||
|
||||
if (has("require.machine")) {
|
||||
const std::string& m = get("require.machine");
|
||||
std::vector< std::string > machines = text::split(m, " ");
|
||||
bool found = false;
|
||||
for (std::vector< std::string >::const_iterator iter =
|
||||
machines.begin(); iter != machines.end() && !found; iter++) {
|
||||
if ((*iter) == atf::config::get("atf_machine"))
|
||||
found = true;
|
||||
}
|
||||
if (!m.empty() && !found)
|
||||
throw tcr::skipped("Requires one of the '" + m +
|
||||
"' machine types");
|
||||
}
|
||||
|
||||
if (has("require.config")) {
|
||||
const std::string& c = get("require.config");
|
||||
std::vector< std::string > vars = text::split(c, " ");
|
||||
|
@ -503,6 +477,26 @@ impl::tc::check_requirements(void)
|
|||
}
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
program_timeout(pid_t pid, const std::string& tostr)
|
||||
{
|
||||
PRE(pid != 0);
|
||||
|
||||
INV(!tostr.empty());
|
||||
|
||||
int timeout = atf::text::to_type< int >(tostr);
|
||||
|
||||
if (timeout != 0) {
|
||||
struct itimerval itv;
|
||||
timerclear(&itv.it_interval);
|
||||
timerclear(&itv.it_value);
|
||||
itv.it_value.tv_sec = timeout;
|
||||
timeout::current_body = pid;
|
||||
::setitimer(ITIMER_REAL, &itv, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
impl::tcr
|
||||
impl::tc::fork_body(const std::string& workdir)
|
||||
const
|
||||
|
@ -517,6 +511,8 @@ impl::tc::fork_body(const std::string& workdir)
|
|||
} else if (pid == 0) {
|
||||
int errcode;
|
||||
|
||||
::setpgid(::getpid(), 0);
|
||||
|
||||
// Unexpected errors detected in the child process are mentioned
|
||||
// in stderr to give the user a chance to see what happened.
|
||||
// This is specially useful in those cases where these errors
|
||||
|
@ -552,11 +548,23 @@ impl::tc::fork_body(const std::string& workdir)
|
|||
}
|
||||
std::exit(errcode);
|
||||
} else {
|
||||
// Program the timeout handler.
|
||||
timeout::current_body = 0;
|
||||
timeout::killed = false;
|
||||
atf::signals::signal_programmer sigalrm(SIGALRM,
|
||||
timeout::sigalrm_handler);
|
||||
program_timeout(pid, get("timeout"));
|
||||
|
||||
// Wait for the child and deal with its termination status.
|
||||
int status;
|
||||
if (::waitpid(pid, &status, 0) == -1) {
|
||||
tcr = tcr::failed("Error while waiting for process " +
|
||||
atf::text::to_string(pid) + ": " +
|
||||
::strerror(errno));
|
||||
if (::waitpid(pid, &status, 0) != pid) {
|
||||
if (errno == EINTR && timeout::killed)
|
||||
tcr = tcr::failed("Test case timed out after " +
|
||||
get("timeout") + " seconds");
|
||||
else
|
||||
tcr = tcr::failed("Error while waiting for process " +
|
||||
atf::text::to_string(pid) + ": " +
|
||||
::strerror(errno));
|
||||
} else {
|
||||
if (WIFEXITED(status)) {
|
||||
if (WEXITSTATUS(status) == EXIT_SUCCESS) {
|
||||
|
@ -588,9 +596,6 @@ impl::tc::fork_body(const std::string& workdir)
|
|||
} else if (WIFSIGNALED(status)) {
|
||||
tcr = tcr::failed("Test case received signal " +
|
||||
atf::text::to_string(WTERMSIG(status)));
|
||||
} else if (WIFSTOPPED(status)) {
|
||||
tcr = tcr::failed("Test case received stop signal " +
|
||||
atf::text::to_string(WSTOPSIG(status)));
|
||||
} else
|
||||
UNREACHABLE;
|
||||
}
|
||||
|
@ -685,7 +690,7 @@ impl::tc::require_prog(const std::string& prog)
|
|||
// The "tp" class.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
class tp : public atf::application {
|
||||
class tp : public atf::application::app {
|
||||
public:
|
||||
typedef std::vector< impl::tc * > tc_vector;
|
||||
|
||||
|
@ -724,7 +729,7 @@ const char* tp::m_description =
|
|||
"This is an independent atf test program.";
|
||||
|
||||
tp::tp(const tc_vector& tcs) :
|
||||
application(m_description, "atf-test-program(1)"),
|
||||
app(m_description, "atf-test-program(1)", "atf(7)"),
|
||||
m_lflag(false),
|
||||
m_results_fd(STDOUT_FILENO),
|
||||
m_srcdir(atf::fs::get_current_dir()),
|
||||
|
@ -744,6 +749,7 @@ tp::options_set
|
|||
tp::specific_options(void)
|
||||
const
|
||||
{
|
||||
using atf::application::option;
|
||||
options_set opts;
|
||||
opts.insert(option('l', "", "List test cases and their purpose"));
|
||||
opts.insert(option('r', "fd", "The file descriptor to which the test "
|
||||
|
@ -919,9 +925,9 @@ tp::run_tcs(void)
|
|||
|
||||
int errcode = EXIT_SUCCESS;
|
||||
|
||||
signal_holder sighup(SIGHUP);
|
||||
signal_holder sigint(SIGINT);
|
||||
signal_holder sigterm(SIGTERM);
|
||||
atf::signals::signal_holder sighup(SIGHUP);
|
||||
atf::signals::signal_holder sigint(SIGINT);
|
||||
atf::signals::signal_holder sigterm(SIGTERM);
|
||||
|
||||
atf::formats::atf_tcs_writer w(results_stream(), std::cout, std::cerr,
|
||||
tcs.size());
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
|
@ -109,6 +109,7 @@ class tc {
|
|||
std::string m_srcdir;
|
||||
|
||||
void ensure_boolean(const std::string&);
|
||||
void ensure_integral(const std::string&);
|
||||
void ensure_not_empty(const std::string&);
|
||||
|
||||
tcr safe_run(void) const;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
|
@ -38,6 +38,7 @@
|
|||
#define _ATF_TEXT_HPP_
|
||||
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -108,6 +109,24 @@ to_string(const T& ob)
|
|||
return ss.str();
|
||||
}
|
||||
|
||||
//!
|
||||
//! \brief Converts the given string to another type.
|
||||
//!
|
||||
//! Attempts to convert the given string to the requested type. Throws
|
||||
//! an exception if the conversion failed.
|
||||
//!
|
||||
template< class T >
|
||||
T
|
||||
to_type(const std::string& str)
|
||||
{
|
||||
std::istringstream ss(str);
|
||||
T value;
|
||||
ss >> value;
|
||||
if (!ss.eof() || (!ss.eof() && !ss.good()))
|
||||
throw std::runtime_error("Cannot convert string to requested type");
|
||||
return value;
|
||||
}
|
||||
|
||||
} // namespace text
|
||||
} // namespace atf
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
|
@ -43,7 +43,7 @@ namespace atf {
|
|||
namespace ui {
|
||||
|
||||
//!
|
||||
//! \brief Formats an error message to fit on string.
|
||||
//! \brief Formats an error message to fit on screen.
|
||||
//!
|
||||
//! Given the program's name and an error message, properly formats it to
|
||||
//! fit on screen.
|
||||
|
@ -55,7 +55,7 @@ namespace ui {
|
|||
std::string format_error(const std::string&, const std::string&);
|
||||
|
||||
//!
|
||||
//! \brief Formats an informational message to fit on string.
|
||||
//! \brief Formats an informational message to fit on screen.
|
||||
//!
|
||||
//! Given the program's name and an informational message, properly formats
|
||||
//! it to fit on screen.
|
||||
|
@ -95,7 +95,7 @@ std::string format_text_with_tag(const std::string&, const std::string&,
|
|||
bool, size_t = 0);
|
||||
|
||||
//!
|
||||
//! \brief Formats a warning message to fit on string.
|
||||
//! \brief Formats a warning message to fit on screen.
|
||||
//!
|
||||
//! Given the program's name and a warning message, properly formats it to
|
||||
//! fit on screen.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
|
@ -37,15 +37,41 @@
|
|||
#include "config.h"
|
||||
|
||||
extern "C" {
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
}
|
||||
|
||||
#include "atf/sanity.hpp"
|
||||
#include "atf/user.hpp"
|
||||
|
||||
namespace impl = atf::user;
|
||||
#define IMPL_NAME "atf::user"
|
||||
|
||||
uid_t
|
||||
impl::euid(void)
|
||||
{
|
||||
return ::geteuid();
|
||||
}
|
||||
|
||||
bool
|
||||
impl::is_member_of_group(gid_t gid)
|
||||
{
|
||||
static gid_t groups[NGROUPS_MAX];
|
||||
static int ngroups = -1;
|
||||
|
||||
if (ngroups == -1) {
|
||||
ngroups = ::getgroups(NGROUPS_MAX, groups);
|
||||
INV(ngroups >= 0);
|
||||
}
|
||||
|
||||
bool found = false;
|
||||
for (int i = 0; !found && i < ngroups; i++)
|
||||
if (groups[i] == gid)
|
||||
found = true;
|
||||
return found;
|
||||
}
|
||||
|
||||
bool
|
||||
impl::is_root(void)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
|
@ -37,9 +37,15 @@
|
|||
#if !defined(_ATF_USER_HPP_)
|
||||
#define _ATF_USER_HPP_
|
||||
|
||||
extern "C" {
|
||||
#include <sys/types.h>
|
||||
}
|
||||
|
||||
namespace atf {
|
||||
namespace user {
|
||||
|
||||
uid_t euid(void);
|
||||
bool is_member_of_group(gid_t);
|
||||
bool is_root(void);
|
||||
bool is_unprivileged(void);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
|
@ -60,6 +60,7 @@ public:
|
|||
void reset(T* = NULL) throw();
|
||||
|
||||
auto_array< T >& operator=(auto_array< T >&) throw();
|
||||
T& operator[](int) throw();
|
||||
};
|
||||
|
||||
template< class T >
|
||||
|
@ -121,6 +122,33 @@ auto_array< T >::operator=(auto_array< T >& ptr)
|
|||
return *this;
|
||||
}
|
||||
|
||||
template< class T >
|
||||
T&
|
||||
auto_array< T >::operator[](int pos)
|
||||
throw()
|
||||
{
|
||||
return m_ptr[pos];
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// The "noncopyable" class.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
class noncopyable {
|
||||
// The class cannot be empty; otherwise we get ABI-stability warnings
|
||||
// during the build, which will break it due to strict checking.
|
||||
int m_noncopyable_dummy;
|
||||
|
||||
noncopyable(const noncopyable& nc);
|
||||
noncopyable& operator=(const noncopyable& nc);
|
||||
|
||||
protected:
|
||||
// Explicitly needed to provide some non-private functions. Otherwise
|
||||
// we also get some warnings during the build.
|
||||
noncopyable(void) {}
|
||||
~noncopyable(void) {}
|
||||
};
|
||||
|
||||
} // namespace utils
|
||||
} // namespace atf
|
||||
|
||||
|
|
|
@ -9,6 +9,9 @@
|
|||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define to 1 if getopt allows a + sign for POSIX behavior */
|
||||
#undef HAVE_GNU_GETOPT
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
|
@ -60,7 +63,7 @@
|
|||
/* Define to 1 if unsetenv is in std */
|
||||
#undef HAVE_UNSETENV_IN_STD
|
||||
|
||||
/* Define to 1 if vnsprintf is in std */
|
||||
/* Define to 1 if vsnprintf is in std */
|
||||
#undef HAVE_VSNPRINTF_IN_STD
|
||||
|
||||
/* Name of package */
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +1,7 @@
|
|||
dnl
|
||||
dnl Automated Testing Framework (atf)
|
||||
dnl
|
||||
dnl Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
dnl Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
dnl All rights reserved.
|
||||
dnl
|
||||
dnl Redistribution and use in source and binary forms, with or without
|
||||
|
@ -38,11 +38,11 @@ dnl -----------------------------------------------------------------------
|
|||
dnl Initialize the GNU build system.
|
||||
dnl -----------------------------------------------------------------------
|
||||
|
||||
AC_INIT([Automated Testing Framework], [0.3], [atf-devel@NetBSD.org], [atf])
|
||||
AC_INIT([Automated Testing Framework], [0.4], [atf-devel@NetBSD.org], [atf])
|
||||
AC_PREREQ([2.60])
|
||||
AC_COPYRIGHT([Copyright (c) 2007 The NetBSD Foundation, Inc.])
|
||||
AC_COPYRIGHT([Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.])
|
||||
AC_DEFINE(PACKAGE_COPYRIGHT,
|
||||
["Copyright (c) 2007 The NetBSD Foundation, Inc."],
|
||||
["Copyright (c) 2007, 2008 The NetBSD Foundation, Inc."],
|
||||
[Define to the copyright string applicable to this package.])
|
||||
AC_CONFIG_AUX_DIR([admin])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
|
@ -50,6 +50,8 @@ AC_CONFIG_MACRO_DIR([admin])
|
|||
AC_CONFIG_SRCDIR([atf.hpp])
|
||||
AC_CONFIG_TESTDIR([tests/bootstrap])
|
||||
|
||||
AC_CANONICAL_TARGET
|
||||
|
||||
AM_INIT_AUTOMAKE([1.9 check-news subdir-objects -Wall])
|
||||
|
||||
dnl This is just a hack to reverse the meaning of the --enable-shared
|
||||
|
@ -74,97 +76,31 @@ dnl -----------------------------------------------------------------------
|
|||
AC_LANG(C++)
|
||||
AC_PROG_CXX
|
||||
|
||||
AC_MSG_CHECKING(whether basename takes a constant pointer)
|
||||
AC_COMPILE_IFELSE(
|
||||
[#include <libgen.h>
|
||||
int main(void) {
|
||||
const char* s = "/foo/bar/";
|
||||
(void)::basename(s);
|
||||
}],
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE([HAVE_CONST_BASENAME], [1],
|
||||
[Define to 1 if basename takes a constant pointer]),
|
||||
AC_MSG_RESULT(no))
|
||||
ATF_DEVELOPER_MODE
|
||||
|
||||
AC_MSG_CHECKING(whether dirname takes a constant pointer)
|
||||
AC_COMPILE_IFELSE(
|
||||
[#include <libgen.h>
|
||||
int main(void) {
|
||||
const char* s = "/foo/bar/";
|
||||
(void)::dirname(s);
|
||||
}],
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE([HAVE_CONST_DIRNAME], [1],
|
||||
[Define to 1 if dirname takes a constant pointer]),
|
||||
AC_MSG_RESULT(no))
|
||||
ATF_MODULE_APPLICATION
|
||||
ATF_MODULE_ENV
|
||||
ATF_MODULE_FS
|
||||
ATF_MODULE_SANITY
|
||||
|
||||
AC_CHECK_FUNCS([putenv setenv unsetenv])
|
||||
dnl -----------------------------------------------------------------------
|
||||
dnl Architecture and machine checks.
|
||||
dnl -----------------------------------------------------------------------
|
||||
|
||||
AC_MSG_CHECKING(whether putenv is in std)
|
||||
AC_COMPILE_IFELSE(
|
||||
[#include <cstdlib>
|
||||
int main(void) {
|
||||
std::putenv("a=b");
|
||||
return 0;
|
||||
}],
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE([HAVE_PUTENV_IN_STD], [1],
|
||||
[Define to 1 if putenv is in std]),
|
||||
AC_MSG_RESULT(no))
|
||||
machine=${target_cpu}
|
||||
|
||||
AC_MSG_CHECKING(whether setenv is in std)
|
||||
AC_COMPILE_IFELSE(
|
||||
[#include <cstdlib>
|
||||
int main(void) {
|
||||
std::setenv("a", "b");
|
||||
return 0;
|
||||
}],
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE([HAVE_SETENV_IN_STD], [1],
|
||||
[Define to 1 if setenv is in std]),
|
||||
AC_MSG_RESULT(no))
|
||||
case ${machine} in
|
||||
i@<:@3-9@:>@86)
|
||||
arch=i386
|
||||
;;
|
||||
*)
|
||||
arch=${machine}
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_MSG_CHECKING(whether snprintf is in std)
|
||||
AC_COMPILE_IFELSE(
|
||||
[#include <cstdio>
|
||||
int main(void) {
|
||||
char buf;
|
||||
std::snprintf(&buf, 1, "");
|
||||
return 0;
|
||||
}],
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE([HAVE_SNPRINTF_IN_STD], [1],
|
||||
[Define to 1 if snprintf is in std]),
|
||||
AC_MSG_RESULT(no))
|
||||
|
||||
AC_MSG_CHECKING(whether unsetenv is in std)
|
||||
AC_COMPILE_IFELSE(
|
||||
[#include <cstdlib>
|
||||
int main(void) {
|
||||
std::unsetenv("a");
|
||||
return 0;
|
||||
}],
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE([HAVE_UNSETENV_IN_STD], [1],
|
||||
[Define to 1 if unsetenv is in std]),
|
||||
AC_MSG_RESULT(no))
|
||||
|
||||
AC_MSG_CHECKING(whether vsnprintf is in std)
|
||||
AC_COMPILE_IFELSE(
|
||||
[#include <cstdarg>
|
||||
#include <cstdio>
|
||||
int main(void) {
|
||||
va_list ap;
|
||||
char* buf = NULL;
|
||||
const char* fmt = NULL;
|
||||
std::vsnprintf(buf, 0, fmt, ap);
|
||||
}],
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE([HAVE_VSNPRINTF_IN_STD], [1],
|
||||
[Define to 1 if vnsprintf is in std]),
|
||||
AC_MSG_RESULT(no))
|
||||
|
||||
AC_CHECK_FUNCS([unmount])
|
||||
AC_MSG_NOTICE([Machine type: ${machine}, architecture: ${arch}])
|
||||
AC_SUBST(atf_arch, ${arch})
|
||||
AC_SUBST(atf_machine, ${machine})
|
||||
|
||||
dnl -----------------------------------------------------------------------
|
||||
dnl User-customizable variables.
|
||||
|
@ -214,6 +150,7 @@ fi
|
|||
AC_SUBST(atf_cssdir, \${datadir}/examples/atf)
|
||||
AC_SUBST(atf_dtddir, \${datadir}/xml/atf)
|
||||
AC_SUBST(atf_egdir, \${datadir}/examples/atf)
|
||||
AC_SUBST(atf_pkgconfigdir, \${libdir}/pkgconfig)
|
||||
AC_SUBST(atf_xsldir, \${datadir}/xsl/atf)
|
||||
|
||||
dnl -----------------------------------------------------------------------
|
||||
|
@ -236,92 +173,17 @@ if test x"${ATF_SHELL}" = x""; then
|
|||
AC_MSG_ERROR([No POSIX shell interpreter found; maybe set ATF_SHELL?])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([whether ${ATF_SHELL} supports trap -])
|
||||
output=`${ATF_SHELL} -c 'trap -- -' 2>&1`
|
||||
if test x"${output}" != x""; then
|
||||
AC_SUBST([SH_TRAP_DASH], [no])
|
||||
AC_MSG_RESULT([no])
|
||||
else
|
||||
AC_SUBST([SH_TRAP_DASH], [yes])
|
||||
AC_MSG_RESULT([yes])
|
||||
fi
|
||||
|
||||
dnl -----------------------------------------------------------------------
|
||||
dnl Check for required tools.
|
||||
dnl -----------------------------------------------------------------------
|
||||
|
||||
AC_PATH_PROG([MTN], [mtn])
|
||||
|
||||
dnl -----------------------------------------------------------------------
|
||||
dnl Set up the developer mode
|
||||
dnl -----------------------------------------------------------------------
|
||||
|
||||
AC_ARG_ENABLE(developer,
|
||||
AS_HELP_STRING(--enable-developer,
|
||||
[enable developer features]),,
|
||||
[case ${PACKAGE_VERSION} in
|
||||
0.*|*99*|*alpha*|*beta*)
|
||||
enable_developer=yes
|
||||
;;
|
||||
*)
|
||||
enable_developer=no
|
||||
;;
|
||||
esac])
|
||||
|
||||
if test ${enable_developer} = yes; then
|
||||
try_flags="-g \
|
||||
-Wabi \
|
||||
-Wall \
|
||||
-Wcast-qual \
|
||||
-Wctor-dtor-privacy \
|
||||
-Werror \
|
||||
-Wextra \
|
||||
-Wno-deprecated \
|
||||
-Wno-non-template-friend \
|
||||
-Wno-pmf-conversions \
|
||||
-Wno-sign-compare \
|
||||
-Wno-unused-parameter \
|
||||
-Wnon-virtual-dtor \
|
||||
-Woverloaded-virtual \
|
||||
-Wpointer-arith \
|
||||
-Wredundant-decls \
|
||||
-Wreorder \
|
||||
-Wreturn-type \
|
||||
-Wshadow \
|
||||
-Wsign-promo \
|
||||
-Wswitch \
|
||||
-Wsynth \
|
||||
-Wwrite-strings"
|
||||
#
|
||||
# The following flags should also be enabled but cannot be. Reasons
|
||||
# given below.
|
||||
#
|
||||
# -Wold-style-cast: Raises errors when using TIOCGWINSZ, at least under
|
||||
# Mac OS X. This is due to the way _IOR is defined.
|
||||
#
|
||||
else
|
||||
try_flags="-DNDEBUG"
|
||||
fi
|
||||
|
||||
valid=""
|
||||
for f in ${try_flags}
|
||||
do
|
||||
AC_MSG_CHECKING(whether ${CXX} supports ${f})
|
||||
saved_cxxflags="${CXXFLAGS}"
|
||||
CXXFLAGS="${CXXFLAGS} ${f}"
|
||||
AC_COMPILE_IFELSE([int main(void) { return 0; }],
|
||||
AC_MSG_RESULT(yes)
|
||||
valid="${valid} ${f}",
|
||||
AC_MSG_RESULT(no))
|
||||
CXXFLAGS="${saved_cxxflags}"
|
||||
done
|
||||
CXXFLAGS="${CXXFLAGS} ${valid}"
|
||||
|
||||
dnl -----------------------------------------------------------------------
|
||||
dnl Finally, generate output.
|
||||
dnl -----------------------------------------------------------------------
|
||||
|
||||
AC_OUTPUT([Makefile subrs/atf.config.subr])
|
||||
AC_OUTPUT([Makefile])
|
||||
|
||||
if test ${enable_shared} = yes; then
|
||||
AC_MSG_WARN([Shared libraries with unstable ABIs/APIs have been enabled.])
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
# ATF pkg-config file
|
||||
|
||||
cxx=__CXX__
|
||||
includedir=__INCLUDEDIR__
|
||||
libdir=__LIBDIR__
|
||||
|
||||
Name: atf
|
||||
Description: Automated Testing Framework
|
||||
Version: __ATF_VERSION__
|
||||
Cflags: -I${includedir}
|
||||
Libs: -L${libdir} -latf
|
|
@ -1,7 +1,7 @@
|
|||
.\"
|
||||
.\" Automated Testing Framework (atf)
|
||||
.\"
|
||||
.\" Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
.\" Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
|
@ -33,7 +33,7 @@
|
|||
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd September 30, 2007
|
||||
.Dd January 15, 2008
|
||||
.Dt ATF-TEST-CASE 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -49,23 +49,32 @@ warrant its independent testing.
|
|||
Given this, test cases are very fine-grained, but they attempt to group
|
||||
similar smaller tests which are semantically related.
|
||||
.Pp
|
||||
A test case is defined by two components regardless of the language it is
|
||||
implemented in: a
|
||||
A test case is defined by three components regardless of the language it is
|
||||
implemented in: a header, a body and a cleanup routine.
|
||||
The
|
||||
.Em header
|
||||
and a
|
||||
.Em body .
|
||||
The header is, basically, a declarative piece of code that defines several
|
||||
is, basically, a declarative piece of code that defines several
|
||||
properties to describe what the test case does and how it behaves.
|
||||
In other words: it defines the test case's
|
||||
.Em meta-data ,
|
||||
further described in the
|
||||
.Sx Meta-data
|
||||
section.
|
||||
The body is the test case itself.
|
||||
The
|
||||
.Em body
|
||||
is the test case itself.
|
||||
It executes all actions needed to reproduce the test, and checks for
|
||||
failures.
|
||||
This body is only executed if the abstract conditions specified by the
|
||||
header are met.
|
||||
The
|
||||
.Em cleanup routine
|
||||
routine is a piece of code always executed after the body, regardless of
|
||||
the exit status of the test case.
|
||||
It can be used to undo side-effects of the test case.
|
||||
Note that almost all side-effects of a test case are automatically cleaned
|
||||
up by the library; this is explained in more detail in the rest of this
|
||||
document.
|
||||
.Pp
|
||||
It is extremely important to keep the separation between a test case's
|
||||
header and body well-defined, because the header is
|
||||
|
@ -114,7 +123,7 @@ The following list describes all meta-data properties interpreted
|
|||
internally by ATF.
|
||||
You are free to define new properties in your test cases and use them as
|
||||
you wish.
|
||||
.Bl -tag -width requireXconfigXX
|
||||
.Bl -tag -width requireXmachineXX
|
||||
.It descr
|
||||
Type: textual.
|
||||
Required.
|
||||
|
@ -128,6 +137,12 @@ Required.
|
|||
.Pp
|
||||
The test case's identifier.
|
||||
Must be unique inside the test program and should be short but descriptive.
|
||||
.It require.arch
|
||||
Type textual.
|
||||
Optional.
|
||||
Pp.
|
||||
A whitespace separated list of architectures that the test case can be run
|
||||
under without causing errors due to an architecture mismatch.
|
||||
.It require.config
|
||||
Type: textual.
|
||||
Optional.
|
||||
|
@ -136,6 +151,12 @@ A whitespace separated list of configuration variables that must be defined
|
|||
to execute the test case.
|
||||
If any of the required variables is not defined, the test case is
|
||||
.Em skipped .
|
||||
.It require.machine
|
||||
Type textual.
|
||||
Optional.
|
||||
Pp.
|
||||
A whitespace separated list of machine types that the test case can be run
|
||||
under without causing errors due to a machine type mismatch.
|
||||
.It require.progs
|
||||
Type: textual.
|
||||
Optional.
|
||||
|
@ -165,6 +186,20 @@ In the future, it is expected that the test case will attempt to gain the
|
|||
necessary privileges on its own before failing.
|
||||
At the very least, lowering the privileges from the super-user to an
|
||||
unprivileged user will be supported.
|
||||
.It timeout
|
||||
Type: integral.
|
||||
Required; defaults to
|
||||
.Sq 300 .
|
||||
Specifies the maximum amount of time the test case can run.
|
||||
This is particularly useful because some tests can stall either because they
|
||||
are incorrectly coded or because they trigger an anomalous behavior of the
|
||||
program.
|
||||
It is not acceptable for these tests to stall the whole execution of the
|
||||
test program.
|
||||
.Pp
|
||||
Can optionally be set to zero, in which case the test case has no run-time
|
||||
limit.
|
||||
This is discouraged.
|
||||
.El
|
||||
.Ss Environment
|
||||
Every time a test case is executed, several environment variables are
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\"
|
||||
.\" Automated Testing Framework (atf)
|
||||
.\"
|
||||
.\" Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
.\" Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
|
@ -33,7 +33,7 @@
|
|||
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd August 19, 2007
|
||||
.Dd January 25, 2008
|
||||
.Dt ATF 7
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -46,7 +46,9 @@ is a collection of libraries and utilities designed to ease unattended
|
|||
application testing in the hands of developers and end users of a specific
|
||||
piece of software.
|
||||
.Pp
|
||||
As regards developers, ATF provides the necessary means to easily create
|
||||
As regards developers,
|
||||
.Nm
|
||||
provides the necessary means to easily create
|
||||
test suites composed of multiple test programs, which in turn are a
|
||||
collection of test cases.
|
||||
It also attempts to simplify the debugging of problems when these test
|
||||
|
@ -96,8 +98,20 @@ Internal utilities:
|
|||
.Bl -tag -width atfXtestXprogramXXXXX
|
||||
.It Xr atf-cleanup 1
|
||||
Safely cleans up a work directory after a test case terminates.
|
||||
.It Xr atf-exec 1
|
||||
Executes a command after modifying its containing process.
|
||||
.It Xr atf-format 1
|
||||
Reformats a text string to not overflow terminal boundaries.
|
||||
.It Xr atf-killpg 1
|
||||
Sends a signal to a process group.
|
||||
.El
|
||||
.Pp
|
||||
Programming interfaces:
|
||||
.Bl -tag -width atfXtestXprogramXXXXX
|
||||
.It Xr atf-c++-api 3
|
||||
C/C++ programming interface for test programs.
|
||||
.It Xr atf-sh-api 3
|
||||
POSIX shell programming interface for test programs.
|
||||
.El
|
||||
.Pp
|
||||
Other:
|
||||
|
@ -112,6 +126,52 @@ Common interface provided by the test programs written using the
|
|||
.Nm
|
||||
libraries.
|
||||
.El
|
||||
.Ss Recommended reading order
|
||||
For end users wishing to run tests:
|
||||
.Bl -enum -compact
|
||||
.It
|
||||
.Xr atf-test-program 1
|
||||
.It
|
||||
.Xr atf-run 1
|
||||
.It
|
||||
.Xr atf-report 1
|
||||
.It
|
||||
.Xr atf-config 1
|
||||
.El
|
||||
.Pp
|
||||
For developers wanting to write their own tests:
|
||||
.Bl -enum -compact
|
||||
.It
|
||||
Everything recommeded to users.
|
||||
.It
|
||||
.Xr atf-test-case 4
|
||||
.It
|
||||
.Xr atf-c++-api 3
|
||||
.It
|
||||
.Xr atf-sh-api 3
|
||||
.It
|
||||
.Xr atf-compile 1
|
||||
.El
|
||||
.Pp
|
||||
For those interested in
|
||||
.Nm
|
||||
internals:
|
||||
.Bl -enum -compact
|
||||
.It
|
||||
Everything recommeded to users.
|
||||
.It
|
||||
Everything recommeded to developers.
|
||||
.It
|
||||
.Xr atf-formats 5
|
||||
.It
|
||||
.Xr atf-cleanup 1
|
||||
.It
|
||||
.Xr atf-format 1
|
||||
.It
|
||||
.Xr atf-exec 1
|
||||
.It
|
||||
.Xr atf-killpg 1
|
||||
.El
|
||||
.Sh HISTORY
|
||||
.Nm
|
||||
started as a Google Summer of Code 2007 project mentored by The NetBSD
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
dnl
|
||||
dnl Automated Testing Framework (atf)
|
||||
dnl
|
||||
dnl Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
dnl All rights reserved.
|
||||
dnl
|
||||
dnl Redistribution and use in source and binary forms, with or without
|
||||
dnl modification, are permitted provided that the following conditions
|
||||
dnl are met:
|
||||
dnl 1. Redistributions of source code must retain the above copyright
|
||||
dnl notice, this list of conditions and the following disclaimer.
|
||||
dnl 2. Redistributions in binary form must reproduce the above copyright
|
||||
dnl notice, this list of conditions and the following disclaimer in the
|
||||
dnl documentation and/or other materials provided with the distribution.
|
||||
dnl 3. All advertising materials mentioning features or use of this
|
||||
dnl software must display the following acknowledgement:
|
||||
dnl This product includes software developed by the NetBSD
|
||||
dnl Foundation, Inc. and its contributors.
|
||||
dnl 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
dnl contributors may be used to endorse or promote products derived
|
||||
dnl from this software without specific prior written permission.
|
||||
dnl
|
||||
dnl THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
|
||||
dnl CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
dnl INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
dnl MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
dnl IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
dnl DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
dnl DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
dnl GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
dnl INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
dnl IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
dnl OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
dnl IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
dnl
|
||||
|
||||
AC_DEFUN([ATF_CHECK_IN_STD], [
|
||||
AC_MSG_CHECKING(whether $1 is in std)
|
||||
AC_COMPILE_IFELSE(
|
||||
[$2
|
||||
int main(void) {
|
||||
$3
|
||||
return 0;
|
||||
}],
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z])[_IN_STD], [1],
|
||||
[Define to 1 if $1 is in std]),
|
||||
AC_MSG_RESULT(no)
|
||||
)
|
||||
])
|
||||
|
||||
AC_DEFUN([ATF_CHECK_STD_PUTENV], [
|
||||
ATF_CHECK_IN_STD([putenv],
|
||||
[#include <cstdio>],
|
||||
[std::putenv("a=b");]
|
||||
)
|
||||
])
|
||||
|
||||
AC_DEFUN([ATF_CHECK_STD_SETENV], [
|
||||
ATF_CHECK_IN_STD([setenv],
|
||||
[#include <cstdio>],
|
||||
[std::setenv("a", "b");]
|
||||
)
|
||||
])
|
||||
|
||||
AC_DEFUN([ATF_CHECK_STD_SNPRINTF], [
|
||||
ATF_CHECK_IN_STD([snprintf],
|
||||
[#include <cstdio>],
|
||||
[char buf;
|
||||
std::snprintf(&buf, 1, "");]
|
||||
)
|
||||
])
|
||||
|
||||
AC_DEFUN([ATF_CHECK_STD_UNSETENV], [
|
||||
ATF_CHECK_IN_STD([unsetenv],
|
||||
[#include <cstdio>],
|
||||
[std::unsetenv("a");]
|
||||
)
|
||||
])
|
||||
|
||||
AC_DEFUN([ATF_CHECK_STD_VSNPRINTF], [
|
||||
ATF_CHECK_IN_STD([vsnprintf],
|
||||
[#include <cstdarg>
|
||||
#include <cstdio>],
|
||||
[va_list ap;
|
||||
char* buf = NULL;
|
||||
const char* fmt = NULL;
|
||||
std::vsnprintf(buf, 0, fmt, ap);]
|
||||
)
|
||||
])
|
|
@ -0,0 +1,102 @@
|
|||
dnl
|
||||
dnl Automated Testing Framework (atf)
|
||||
dnl
|
||||
dnl Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
dnl All rights reserved.
|
||||
dnl
|
||||
dnl Redistribution and use in source and binary forms, with or without
|
||||
dnl modification, are permitted provided that the following conditions
|
||||
dnl are met:
|
||||
dnl 1. Redistributions of source code must retain the above copyright
|
||||
dnl notice, this list of conditions and the following disclaimer.
|
||||
dnl 2. Redistributions in binary form must reproduce the above copyright
|
||||
dnl notice, this list of conditions and the following disclaimer in the
|
||||
dnl documentation and/or other materials provided with the distribution.
|
||||
dnl 3. All advertising materials mentioning features or use of this
|
||||
dnl software must display the following acknowledgement:
|
||||
dnl This product includes software developed by the NetBSD
|
||||
dnl Foundation, Inc. and its contributors.
|
||||
dnl 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
dnl contributors may be used to endorse or promote products derived
|
||||
dnl from this software without specific prior written permission.
|
||||
dnl
|
||||
dnl THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
|
||||
dnl CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
dnl INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
dnl MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
dnl IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
dnl DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
dnl DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
dnl GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
dnl INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
dnl IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
dnl OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
dnl IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
dnl
|
||||
|
||||
dnl -----------------------------------------------------------------------
|
||||
dnl Set up the developer mode
|
||||
dnl -----------------------------------------------------------------------
|
||||
|
||||
AC_DEFUN([ATF_DEVELOPER_MODE], [
|
||||
AC_ARG_ENABLE(developer,
|
||||
AS_HELP_STRING(--enable-developer,
|
||||
[enable developer features]),,
|
||||
[case ${PACKAGE_VERSION} in
|
||||
0.*|*99*|*alpha*|*beta*)
|
||||
enable_developer=yes
|
||||
;;
|
||||
*)
|
||||
enable_developer=no
|
||||
;;
|
||||
esac])
|
||||
|
||||
if test ${enable_developer} = yes; then
|
||||
try_flags="-g \
|
||||
-Wabi \
|
||||
-Wall \
|
||||
-Wcast-qual \
|
||||
-Wctor-dtor-privacy \
|
||||
-Werror \
|
||||
-Wextra \
|
||||
-Wno-deprecated \
|
||||
-Wno-non-template-friend \
|
||||
-Wno-pmf-conversions \
|
||||
-Wno-sign-compare \
|
||||
-Wno-unused-parameter \
|
||||
-Wnon-virtual-dtor \
|
||||
-Woverloaded-virtual \
|
||||
-Wpointer-arith \
|
||||
-Wredundant-decls \
|
||||
-Wreorder \
|
||||
-Wreturn-type \
|
||||
-Wshadow \
|
||||
-Wsign-promo \
|
||||
-Wswitch \
|
||||
-Wsynth \
|
||||
-Wwrite-strings"
|
||||
#
|
||||
# The following flags should also be enabled but cannot be. Reasons
|
||||
# given below.
|
||||
#
|
||||
# -Wold-style-cast: Raises errors when using TIOCGWINSZ, at least under
|
||||
# Mac OS X. This is due to the way _IOR is defined.
|
||||
#
|
||||
else
|
||||
try_flags="-DNDEBUG"
|
||||
fi
|
||||
|
||||
valid=""
|
||||
for f in ${try_flags}
|
||||
do
|
||||
AC_MSG_CHECKING(whether ${CXX} supports ${f})
|
||||
saved_cxxflags="${CXXFLAGS}"
|
||||
CXXFLAGS="${CXXFLAGS} ${f}"
|
||||
AC_LINK_IFELSE([int main(void) { return 0; }],
|
||||
AC_MSG_RESULT(yes)
|
||||
valid="${valid} ${f}",
|
||||
AC_MSG_RESULT(no))
|
||||
CXXFLAGS="${saved_cxxflags}"
|
||||
done
|
||||
CXXFLAGS="${CXXFLAGS} ${valid}"
|
||||
])
|
|
@ -0,0 +1,84 @@
|
|||
dnl
|
||||
dnl Automated Testing Framework (atf)
|
||||
dnl
|
||||
dnl Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
dnl All rights reserved.
|
||||
dnl
|
||||
dnl Redistribution and use in source and binary forms, with or without
|
||||
dnl modification, are permitted provided that the following conditions
|
||||
dnl are met:
|
||||
dnl 1. Redistributions of source code must retain the above copyright
|
||||
dnl notice, this list of conditions and the following disclaimer.
|
||||
dnl 2. Redistributions in binary form must reproduce the above copyright
|
||||
dnl notice, this list of conditions and the following disclaimer in the
|
||||
dnl documentation and/or other materials provided with the distribution.
|
||||
dnl 3. All advertising materials mentioning features or use of this
|
||||
dnl software must display the following acknowledgement:
|
||||
dnl This product includes software developed by the NetBSD
|
||||
dnl Foundation, Inc. and its contributors.
|
||||
dnl 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
dnl contributors may be used to endorse or promote products derived
|
||||
dnl from this software without specific prior written permission.
|
||||
dnl
|
||||
dnl THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
|
||||
dnl CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
dnl INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
dnl MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
dnl IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
dnl DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
dnl DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
dnl GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
dnl INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
dnl IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
dnl OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
dnl IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
dnl
|
||||
|
||||
AC_DEFUN([ATF_MODULE_APPLICATION], [
|
||||
ATF_CHECK_STD_VSNPRINTF
|
||||
|
||||
AC_MSG_CHECKING(whether getopt allows a + sign for POSIX behavior)
|
||||
AC_TRY_RUN([
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
int argc = 4;
|
||||
char* argv@<:@5@:>@ = {
|
||||
strdup("conftest"),
|
||||
strdup("-+"),
|
||||
strdup("-a"),
|
||||
strdup("bar"),
|
||||
NULL
|
||||
};
|
||||
int ch;
|
||||
int seen_a = 0, seen_plus = 0;
|
||||
|
||||
while ((ch = getopt(argc, argv, "+a:")) != -1) {
|
||||
switch (ch) {
|
||||
case 'a':
|
||||
seen_a = 1;
|
||||
break;
|
||||
|
||||
case '+':
|
||||
seen_plus = 1;
|
||||
break;
|
||||
|
||||
case '?':
|
||||
default:
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
return (seen_a && !seen_plus) ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
||||
],
|
||||
[getopt_allows_plus=yes
|
||||
AC_DEFINE([HAVE_GNU_GETOPT], [1],
|
||||
[Define to 1 if getopt allows a + sign for POSIX behavior])],
|
||||
[getopt_allows_plus=no])
|
||||
AC_MSG_RESULT(${getopt_allows_plus})
|
||||
])
|
|
@ -0,0 +1,43 @@
|
|||
dnl
|
||||
dnl Automated Testing Framework (atf)
|
||||
dnl
|
||||
dnl Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
dnl All rights reserved.
|
||||
dnl
|
||||
dnl Redistribution and use in source and binary forms, with or without
|
||||
dnl modification, are permitted provided that the following conditions
|
||||
dnl are met:
|
||||
dnl 1. Redistributions of source code must retain the above copyright
|
||||
dnl notice, this list of conditions and the following disclaimer.
|
||||
dnl 2. Redistributions in binary form must reproduce the above copyright
|
||||
dnl notice, this list of conditions and the following disclaimer in the
|
||||
dnl documentation and/or other materials provided with the distribution.
|
||||
dnl 3. All advertising materials mentioning features or use of this
|
||||
dnl software must display the following acknowledgement:
|
||||
dnl This product includes software developed by the NetBSD
|
||||
dnl Foundation, Inc. and its contributors.
|
||||
dnl 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
dnl contributors may be used to endorse or promote products derived
|
||||
dnl from this software without specific prior written permission.
|
||||
dnl
|
||||
dnl THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
|
||||
dnl CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
dnl INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
dnl MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
dnl IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
dnl DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
dnl DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
dnl GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
dnl INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
dnl IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
dnl OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
dnl IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
dnl
|
||||
|
||||
AC_DEFUN([ATF_MODULE_ENV], [
|
||||
AC_CHECK_FUNCS([putenv setenv unsetenv])
|
||||
|
||||
ATF_CHECK_STD_PUTENV
|
||||
ATF_CHECK_STD_SETENV
|
||||
ATF_CHECK_STD_UNSETENV
|
||||
])
|
|
@ -0,0 +1,63 @@
|
|||
dnl
|
||||
dnl Automated Testing Framework (atf)
|
||||
dnl
|
||||
dnl Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
dnl All rights reserved.
|
||||
dnl
|
||||
dnl Redistribution and use in source and binary forms, with or without
|
||||
dnl modification, are permitted provided that the following conditions
|
||||
dnl are met:
|
||||
dnl 1. Redistributions of source code must retain the above copyright
|
||||
dnl notice, this list of conditions and the following disclaimer.
|
||||
dnl 2. Redistributions in binary form must reproduce the above copyright
|
||||
dnl notice, this list of conditions and the following disclaimer in the
|
||||
dnl documentation and/or other materials provided with the distribution.
|
||||
dnl 3. All advertising materials mentioning features or use of this
|
||||
dnl software must display the following acknowledgement:
|
||||
dnl This product includes software developed by the NetBSD
|
||||
dnl Foundation, Inc. and its contributors.
|
||||
dnl 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
dnl contributors may be used to endorse or promote products derived
|
||||
dnl from this software without specific prior written permission.
|
||||
dnl
|
||||
dnl THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
|
||||
dnl CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
dnl INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
dnl MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
dnl IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
dnl DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
dnl DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
dnl GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
dnl INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
dnl IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
dnl OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
dnl IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
dnl
|
||||
|
||||
AC_DEFUN([ATF_MODULE_FS], [
|
||||
AC_MSG_CHECKING(whether basename takes a constant pointer)
|
||||
AC_COMPILE_IFELSE(
|
||||
[#include <libgen.h>
|
||||
int main(void) {
|
||||
const char* s = "/foo/bar/";
|
||||
(void)::basename(s);
|
||||
}],
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE([HAVE_CONST_BASENAME], [1],
|
||||
[Define to 1 if basename takes a constant pointer]),
|
||||
AC_MSG_RESULT(no))
|
||||
|
||||
AC_MSG_CHECKING(whether dirname takes a constant pointer)
|
||||
AC_COMPILE_IFELSE(
|
||||
[#include <libgen.h>
|
||||
int main(void) {
|
||||
const char* s = "/foo/bar/";
|
||||
(void)::dirname(s);
|
||||
}],
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE([HAVE_CONST_DIRNAME], [1],
|
||||
[Define to 1 if dirname takes a constant pointer]),
|
||||
AC_MSG_RESULT(no))
|
||||
|
||||
AC_CHECK_FUNCS([unmount])
|
||||
])
|
|
@ -0,0 +1,39 @@
|
|||
dnl
|
||||
dnl Automated Testing Framework (atf)
|
||||
dnl
|
||||
dnl Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
dnl All rights reserved.
|
||||
dnl
|
||||
dnl Redistribution and use in source and binary forms, with or without
|
||||
dnl modification, are permitted provided that the following conditions
|
||||
dnl are met:
|
||||
dnl 1. Redistributions of source code must retain the above copyright
|
||||
dnl notice, this list of conditions and the following disclaimer.
|
||||
dnl 2. Redistributions in binary form must reproduce the above copyright
|
||||
dnl notice, this list of conditions and the following disclaimer in the
|
||||
dnl documentation and/or other materials provided with the distribution.
|
||||
dnl 3. All advertising materials mentioning features or use of this
|
||||
dnl software must display the following acknowledgement:
|
||||
dnl This product includes software developed by the NetBSD
|
||||
dnl Foundation, Inc. and its contributors.
|
||||
dnl 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
dnl contributors may be used to endorse or promote products derived
|
||||
dnl from this software without specific prior written permission.
|
||||
dnl
|
||||
dnl THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
|
||||
dnl CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
dnl INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
dnl MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
dnl IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
dnl DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
dnl DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
dnl GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
dnl INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
dnl IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
dnl OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
dnl IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
dnl
|
||||
|
||||
AC_DEFUN([ATF_MODULE_SANITY], [
|
||||
ATF_CHECK_STD_SNPRINTF
|
||||
])
|
|
@ -1 +1 @@
|
|||
#define PACKAGE_REVISION_BASE "0f91638f340d2b407861ab90207167eb6a8be88c"
|
||||
#define PACKAGE_REVISION_BASE "dc8e3f9b3c86b34f877ff1bfde4a8b17a4ad1326"
|
||||
|
|
|
@ -0,0 +1,298 @@
|
|||
.\"
|
||||
.\" Automated Testing Framework (atf)
|
||||
.\"
|
||||
.\" Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. All advertising materials mentioning features or use of this
|
||||
.\" software must display the following acknowledgement:
|
||||
.\" This product includes software developed by the NetBSD
|
||||
.\" Foundation, Inc. and its contributors.
|
||||
.\" 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
.\" contributors may be used to endorse or promote products derived
|
||||
.\" from this software without specific prior written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
|
||||
.\" CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
.\" IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd January 5, 2008
|
||||
.Dt ATF-SH-API 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm atf_add_test_case ,
|
||||
.Nm atf_check ,
|
||||
.Nm atf_check_equal ,
|
||||
.Nm atf_config_get ,
|
||||
.Nm atf_config_has ,
|
||||
.Nm atf_fail ,
|
||||
.Nm atf_get ,
|
||||
.Nm atf_get_srcdir ,
|
||||
.Nm atf_pass ,
|
||||
.Nm atf_require_prog ,
|
||||
.Nm atf_set ,
|
||||
.Nm atf_skip
|
||||
.Nd POSIX shell API to write ATF-based test programs
|
||||
.Sh SYNOPSIS
|
||||
.Fn atf_add_test_case "name"
|
||||
.Fn atf_check "command"
|
||||
.Fn atf_check_equal "expr1" "expr2"
|
||||
.Fn atf_config_get "var_name"
|
||||
.Fn atf_config_has "var_name"
|
||||
.Fn atf_fail "reason"
|
||||
.Fn atf_get "var_name"
|
||||
.Fn atf_get_srcdir
|
||||
.Fn atf_pass
|
||||
.Fn atf_require_prog "prog_name"
|
||||
.Fn atf_set "var_name" "value"
|
||||
.Fn atf_skip "reason"
|
||||
.Sh DESCRIPTION
|
||||
ATF
|
||||
provides a simple but powerful interface to easily write test programs in
|
||||
the POSIX shell language.
|
||||
These are extremely helpful given that they are trivial to write due to the
|
||||
language simplicity and the great deal of available external tools, so they
|
||||
are often ideal to test other applications at the user level.
|
||||
.Pp
|
||||
Test programs written using this library must be preprocessed by the
|
||||
.Xr atf-compile 1
|
||||
tool, which includes some boilerplate code and generates the final
|
||||
(installable) test program.
|
||||
.Pp
|
||||
Shell-based test programs always follow this template:
|
||||
.Bd -literal -offset indent
|
||||
atf_test_case tc1
|
||||
tc1_head() {
|
||||
... first test case's header ...
|
||||
}
|
||||
tc1_body() {
|
||||
... first test case's body ...
|
||||
}
|
||||
|
||||
atf_test_case tc2
|
||||
tc2_head() {
|
||||
... second test case's header ...
|
||||
}
|
||||
tc2_body() {
|
||||
... second test case's body ...
|
||||
}
|
||||
tc2_cleanup() {
|
||||
... second test case's cleanup ...
|
||||
}
|
||||
|
||||
.Ns ... additional test cases ...
|
||||
|
||||
atf_init_test_cases() {
|
||||
atf_add_test_case tc1
|
||||
atf_add_test_case tc2
|
||||
... add additional test cases ...
|
||||
}
|
||||
.Ed
|
||||
.Ss Definition of test cases
|
||||
Test cases have an identifier and are composed of three different parts:
|
||||
the header, the body and an optional cleanup routine, all of which are
|
||||
described in
|
||||
.Xr atf-test-case 8 .
|
||||
To define test cases, one can use the
|
||||
.Fn atf_test_case
|
||||
function, which takes a single parameter specifiying the test case's
|
||||
name and instructs the library to set things up to accept it as a valid
|
||||
test case.
|
||||
It is important to note that it
|
||||
.Em does not
|
||||
set the test case up for execution when the program is run.
|
||||
In order to do so, a later registration is needed through the
|
||||
.Fn atf_add_test_case
|
||||
function detailed in
|
||||
.Sx Program initialization .
|
||||
.Pp
|
||||
Later on, one must define the three parts of the body by providing two
|
||||
or three functions (remember that the cleanup routine is optional).
|
||||
These functions are named after the test case's identifier, and are
|
||||
.Fn <id>_head ,
|
||||
.Fn <id>_body
|
||||
and
|
||||
.Fn <id>_cleanup.
|
||||
None of these take parameters when executed.
|
||||
.Ss Program initialization
|
||||
The test program must define an
|
||||
.Fn atf_init_test_cases
|
||||
function, which is in charge of registering the test cases that will be
|
||||
executed at run time by using the
|
||||
.Fn atf_add_test_case
|
||||
function, which takes the name of a test case as its single parameter.
|
||||
This main function should not do anything else, except maybe sourcing
|
||||
auxiliary source files that define extra variables and functions.
|
||||
.Ss Configuration variables
|
||||
The test case has read-only access to the current configuration variables
|
||||
through the
|
||||
.Fn atf_config_has
|
||||
and
|
||||
.Fn atf_config_get
|
||||
methods.
|
||||
The former takes a single parameter specifying a variable name and returns
|
||||
a boolean indicating whether the variable is defined or not.
|
||||
The latter can take one or two parameters.
|
||||
If it takes only one, it specifies the variable from which to get the
|
||||
value, and this variable must be defined.
|
||||
If it takes two, the second one specifies a default value to be returned
|
||||
if the variable is not available.
|
||||
.Ss Access to the source directory
|
||||
It is possible to get the path to the test case's source directory from
|
||||
anywhere in the test program by using the
|
||||
.Fn atf_get_srcdir
|
||||
function.
|
||||
It is interesting to note that this can be used inside
|
||||
.Fn atf_init_test_cases
|
||||
to silently include additional helper files from the source directory.
|
||||
.Ss Requiring programs
|
||||
Aside from the
|
||||
.Va require.progs
|
||||
meta-data variable available in the header only, one can also check for
|
||||
additional programs in the test case's body by using the
|
||||
.Fn atf_require_prog
|
||||
function, which takes the base name or full path of a single binary.
|
||||
Relative paths are forbidden.
|
||||
If it is not found, the test case will be automatically skipped.
|
||||
.Ss Test case finalization
|
||||
The test case finalizes either when the body reaches its end, at which
|
||||
point the test is assumed to have
|
||||
.Em passed ,
|
||||
or at any explicit call to
|
||||
.Fn atf_pass ,
|
||||
.Fn atf_fail
|
||||
or
|
||||
.Fn atf_skip .
|
||||
These three functions terminate the execution of the test case immediately.
|
||||
The cleanup routine will be processed afterwards in a completely automated
|
||||
way, regardless of the test case's termination reason.
|
||||
.Pp
|
||||
.Fn atf_pass
|
||||
does not take any parameters.
|
||||
.Fn atf_fail
|
||||
and
|
||||
.Fn atf_skip
|
||||
take a single string parameter that describes why the test case failed or
|
||||
was skipped, respectively.
|
||||
It is very important to provide a clear error message in both cases so that
|
||||
the user can quickly know why the test did not pass.
|
||||
.Ss Helper functions for common checks
|
||||
.Fn atf_check cmd expcode expout experr
|
||||
.Pp
|
||||
This function takes four parameters: the command to execute, the expected
|
||||
numerical exit code, the expected behavior of stdout and the expected
|
||||
behavior of stderr.
|
||||
.Sq expout
|
||||
can be one of the following:
|
||||
.Bl -tag .width expoutXXXX
|
||||
.It expout
|
||||
What the command writes to the stdout channel must match exactly what is
|
||||
found in the
|
||||
.Pa expout
|
||||
file.
|
||||
.It ignore
|
||||
The test does not check what the command writes to the stdout channel.
|
||||
.It null
|
||||
The command must not write anything to the stdout channel.
|
||||
.It stdout
|
||||
What the command writes to the stdout channel is written to a
|
||||
.Pa stdout
|
||||
file, available for further inspection.
|
||||
.El
|
||||
.Pp
|
||||
Similarly,
|
||||
.Sq experr
|
||||
can be one of
|
||||
.Sq experr ,
|
||||
.Sq ignore ,
|
||||
.Sq null or
|
||||
.Sq stderr ,
|
||||
all of which follow the same semantics of their corresponding counterparts
|
||||
for the stdout case.
|
||||
.Pp
|
||||
It is important to note that when a failure is detected, this function will
|
||||
print as much information as possible to be able to identify the cause of
|
||||
the failure.
|
||||
For example, if the stdout does not match with the expected contents, a
|
||||
diff will be printed.
|
||||
.Pp
|
||||
.Fn atf_check_equal expr1 expr2
|
||||
.Pp
|
||||
This function takes two expressions, evaluates them and, if their
|
||||
results differ, aborts the test case with an appropriate failure message.
|
||||
.Sh EXAMPLES
|
||||
The following shows a complete test program with a single test case that
|
||||
validates the addition operator:
|
||||
.Bd -literal -offset indent
|
||||
atf_test_case addition
|
||||
addition_head() {
|
||||
atf_set "descr" "Sample tests for the addition operator"
|
||||
}
|
||||
addition_body() {
|
||||
atf_check_equal $((0 + 0)) 0
|
||||
atf_check_equal $((0 + 1)) 1
|
||||
atf_check_equal $((1 + 0)) 0
|
||||
|
||||
atf_check_equal $((1 + 1)) 2
|
||||
|
||||
atf_check_equal $((100 + 200)) 300
|
||||
}
|
||||
|
||||
atf_init_test_cases() {
|
||||
atf_add_test_case addition
|
||||
}
|
||||
.Ed
|
||||
.Pp
|
||||
This other example shows how to include a file with extra helper functions
|
||||
in the test program:
|
||||
.Bd -literal -offset indent
|
||||
.Ns ... definition of test cases ...
|
||||
|
||||
atf_init_test_cases() {
|
||||
. $(atf_get_srcdir)/helper_functions.sh
|
||||
|
||||
atf_add_test_case foo1
|
||||
atf_add_test_case foo2
|
||||
}
|
||||
.Ed
|
||||
.Pp
|
||||
This example demonstrates the use of the very useful
|
||||
.Fn atf_check
|
||||
function:
|
||||
.Bd -literal -offset indent
|
||||
# Check for silent output
|
||||
atf_check 'true' 0 null null
|
||||
|
||||
# Check for silent output and failure
|
||||
atf_check 'false' 1 null null
|
||||
|
||||
# Check for known stdout and silent stderr
|
||||
echo foo >expout
|
||||
atf_check 'echo foo' 0 expout null
|
||||
|
||||
# Generate a file for later inspection
|
||||
atf_check 'ls' 0 stdout null
|
||||
grep foo ls || atf_fail "foo file not found in listing"
|
||||
.Ed
|
||||
.Sh SEE ALSO
|
||||
.Xr atf-compile 1 ,
|
||||
.Xr atf-test-program 1 ,
|
||||
.Xr atf 7 ,
|
||||
.Xr atf-test-case 8
|
|
@ -1,7 +1,7 @@
|
|||
#
|
||||
# Automated Testing Framework (atf)
|
||||
#
|
||||
# Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
# Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
|
@ -46,8 +46,16 @@
|
|||
# ------------------------------------------------------------------------
|
||||
|
||||
# Values of configuration variables obtained from atf-config.
|
||||
Atf_Arch=$(atf-config -t atf_arch)
|
||||
Atf_Cleanup=$(atf-config -t atf_libexecdir)/atf-cleanup
|
||||
Atf_Exec=$(atf-config -t atf_libexecdir)/atf-exec
|
||||
Atf_Format=$(atf-config -t atf_libexecdir)/atf-format
|
||||
Atf_Killpg=$(atf-config -t atf_libexecdir)/atf-killpg
|
||||
Atf_Machine=$(atf-config -t atf_machine)
|
||||
|
||||
# List of configuration variables set through the command line. Needed
|
||||
# during shortcut execution.
|
||||
Config_Vars=
|
||||
|
||||
# List of blocked signals, to be processed when unblocked.
|
||||
Held_Signals=
|
||||
|
@ -421,6 +429,7 @@ _atf_config_set()
|
|||
{
|
||||
_var=$(_atf_normalize ${1}); shift
|
||||
eval __tc_config_var_${_var}=\"\${*}\"
|
||||
Config_Vars="${Config_Vars} __tc_config_var_${_var}"
|
||||
}
|
||||
|
||||
#
|
||||
|
@ -475,6 +484,25 @@ _atf_ensure_boolean()
|
|||
esac
|
||||
}
|
||||
|
||||
#
|
||||
# _atf_ensure_integral var
|
||||
#
|
||||
# Ensures that the test case defined the variable 'var' to an integral
|
||||
# value.
|
||||
#
|
||||
_atf_ensure_integral()
|
||||
{
|
||||
_atf_ensure_not_empty ${1}
|
||||
|
||||
case $(atf_get ${1}) in
|
||||
[0-9]*)
|
||||
;;
|
||||
*)
|
||||
_atf_error 128 "Invalid value for integral variable \`${1}'"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
#
|
||||
# _atf_ensure_not_empty var
|
||||
#
|
||||
|
@ -633,9 +661,11 @@ _atf_parse_head()
|
|||
Test_Case="${1}"
|
||||
|
||||
atf_set ident "${1}"
|
||||
atf_set timeout 300
|
||||
${1}_head
|
||||
_atf_ensure_not_empty descr
|
||||
_atf_ensure_not_empty ident
|
||||
_atf_ensure_integral timeout
|
||||
test $(atf_get ident) = "${1}" || \
|
||||
_atf_error 128 "Test case redefined ident"
|
||||
|
||||
|
@ -666,6 +696,32 @@ _atf_run_body()
|
|||
|
||||
umask 0022
|
||||
|
||||
_arches=$(atf_get require.arch)
|
||||
if [ -n "${_arches}" ]; then
|
||||
found=no
|
||||
for _a in ${_arches}; do
|
||||
if [ ${_a} = ${Atf_Arch} ]; then
|
||||
found=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
[ ${found} = yes ] || \
|
||||
atf_skip "Requires one of the '${_arches}' architectures"
|
||||
fi
|
||||
|
||||
_machines=$(atf_get require.machine)
|
||||
if [ -n "${_machines}" ]; then
|
||||
found=no
|
||||
for _m in ${_machines}; do
|
||||
if [ ${_m} = ${Atf_Machine} ]; then
|
||||
found=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
[ ${found} = yes ] || \
|
||||
atf_skip "Requires one of the '${_machines}' machine types"
|
||||
fi
|
||||
|
||||
_vars="$(atf_get require.config)"
|
||||
if [ -n "${_vars}" ]; then
|
||||
for _v in ${_vars}; do
|
||||
|
@ -698,18 +754,31 @@ _atf_run_body()
|
|||
;;
|
||||
esac
|
||||
|
||||
# Restore all signals to their default behavior for the child process.
|
||||
if [ ${SH_TRAP_DASH} = yes ]; then
|
||||
trap -- -
|
||||
else
|
||||
# We don't have an easy way to reset all signals to their default
|
||||
# behavior, so simply revert those that we modified.
|
||||
trap SIGHUP SIGINT SIGTERM
|
||||
fi
|
||||
# Previous versions of this code reverted all signal handlers to their
|
||||
# default behavior at this point. We do not need to do this any more
|
||||
# because this piece of code is run in a clean sub-shell (through the
|
||||
# _atf_shortcut_exec call), i.e. a completely re-executed shell, and
|
||||
# we have not messed with signal handlers at all until this point.
|
||||
|
||||
${1}_body
|
||||
}
|
||||
|
||||
_atf_program_timeout()
|
||||
{
|
||||
cat >${Work_Dir}/timeout.sh <<EOF
|
||||
#! /bin/sh
|
||||
_timeout=$(atf_get timeout)
|
||||
if [ \${_timeout} -gt 0 ]; then
|
||||
sleep \${_timeout}
|
||||
touch ${Work_Dir}/atf.timed.out
|
||||
${Atf_Killpg} $1 >/dev/null 2>&1
|
||||
fi
|
||||
EOF
|
||||
chmod +x ${Work_Dir}/timeout.sh
|
||||
${Atf_Exec} -g ${Work_Dir}/timeout.sh >/dev/null 2>&1 &
|
||||
echo $!
|
||||
}
|
||||
|
||||
#
|
||||
# _atf_run_tc tc nrest
|
||||
#
|
||||
|
@ -737,8 +806,16 @@ _atf_run_tc()
|
|||
|
||||
Work_Dir=$(mktemp -d $(atf_config_get workdir)/atf.XXXXXX)
|
||||
if [ ${?} -eq 0 ]; then
|
||||
( cd ${Work_Dir} ; _atf_run_body ${1} ; atf_pass )
|
||||
_atf_shortcut_exec ${1}; _body_pid=$!
|
||||
_timeout_pid=$(_atf_program_timeout ${_body_pid})
|
||||
wait ${_body_pid}
|
||||
_ret=$?
|
||||
if [ -f ${Work_Dir}/atf.timed.out ]; then
|
||||
( atf_fail "Test case timed out after $(atf_get timeout) seconds" )
|
||||
_ret=${?}
|
||||
else
|
||||
${Atf_Killpg} ${_timeout_pid}
|
||||
fi
|
||||
( cd ${Work_Dir} ; ${1}_cleanup )
|
||||
if [ ${2} -gt 1 ]; then
|
||||
echo __atf_tc_separator__
|
||||
|
@ -801,6 +878,83 @@ _atf_run_tcs()
|
|||
${_ok}
|
||||
}
|
||||
|
||||
#
|
||||
# _atf_shortcut_entry
|
||||
#
|
||||
# Secondary entry point for the program. This is only called internally
|
||||
# to process a test case's body. We must do a full re-exec of the script
|
||||
# in order to change its process group by means of an external tool.
|
||||
# Yes, this is ugly, but there is no other way to do it -- unless we
|
||||
# modified the shell interpreter to provide a built-in for changing the
|
||||
# process group of the current process...
|
||||
#
|
||||
# Keep in sync with _atf_shortcut_exec.
|
||||
#
|
||||
_atf_shortcut_entry()
|
||||
{
|
||||
# Set global program status.
|
||||
_config_file=${_ATF_CONFIG_FILE}; unset _ATF_CONFIG_FILE
|
||||
Results_Fd=${_ATF_RESULTS_FD}; unset _ATF_RESULTS_FD
|
||||
Results_File=${_ATF_RESULTS_FILE}; unset _ATF_RESULTS_FILE
|
||||
Source_Dir=${_ATF_SOURCE_DIR}; unset _ATF_SOURCE_DIR
|
||||
Work_Dir=${_ATF_WORK_DIR}; unset _ATF_WORK_DIR
|
||||
|
||||
# Gather specific details of this re-exec.
|
||||
_shortcut_tc=${_ATF_SHORTCUT}; unset _ATF_SHORTCUT
|
||||
|
||||
# Global initialization, as found in main.
|
||||
if [ -f ${_config_file} ]; then
|
||||
. ${_config_file}
|
||||
rm ${_config_file}
|
||||
fi
|
||||
_atf_internal_set srcdir "${Source_Dir}"
|
||||
atf_init_test_cases
|
||||
|
||||
# Test-case specific initialization, as found in _atf_run_tc.
|
||||
_atf_parse_head ${_shortcut_tc}
|
||||
_atf_internal_set srcdir "${Source_Dir}"
|
||||
|
||||
# Really run the test case's body. This is the only part that
|
||||
# should remain if we were really able to change the process group
|
||||
# of a sub-shell.
|
||||
cd ${Work_Dir}
|
||||
_atf_run_body ${_shortcut_tc}
|
||||
atf_pass
|
||||
}
|
||||
|
||||
#
|
||||
# _atf_shortcut_exec tc
|
||||
#
|
||||
# Re-executes the current script in a different process group in order
|
||||
# to process the given test case's body. $! is set to the child process
|
||||
# on return.
|
||||
#
|
||||
# Keep in sync with _atf_shortcut_entry.
|
||||
#
|
||||
_atf_shortcut_exec()
|
||||
{
|
||||
# Save the value of the configuration variables set through -v.
|
||||
# We must do this through a files as there is no other easy way to
|
||||
# preserve spaces in them. But this can bring raise problems...
|
||||
if [ -n "${Config_Vars}" ]; then
|
||||
_config_file=${Work_Dir}/atf.config.vars
|
||||
for _var in ${Config_Vars}; do
|
||||
_val=$(eval echo \${${_var}})
|
||||
echo ${_var}=\'${_val}\' >>${_config_file}
|
||||
done
|
||||
fi
|
||||
|
||||
# Now do the real re-execution.
|
||||
${Atf_Exec} -g env \
|
||||
_ATF_CONFIG_FILE=${_config_file} \
|
||||
_ATF_RESULTS_FD=${Results_Fd} \
|
||||
_ATF_RESULTS_FILE=${Results_File} \
|
||||
_ATF_SHORTCUT=${1} \
|
||||
_ATF_SOURCE_DIR=${Source_Dir} \
|
||||
_ATF_WORK_DIR=${Work_Dir} \
|
||||
${Source_Dir}/${Prog_Name} &
|
||||
}
|
||||
|
||||
#
|
||||
# _atf_sighup_handler
|
||||
#
|
||||
|
@ -910,6 +1064,12 @@ _atf_warning()
|
|||
#
|
||||
main()
|
||||
{
|
||||
# Handle shortcut execution path as early as possible.
|
||||
if [ ${_ATF_SHORTCUT-__unset__} != __unset__ ]; then
|
||||
_atf_shortcut_entry
|
||||
# NOTREACHED
|
||||
fi
|
||||
|
||||
# The test program's base directory where it will put temporary files.
|
||||
_atf_config_set workdir $(atf-config -t atf_workdir)
|
||||
|
||||
|
|
|
@ -7,3 +7,4 @@ tp: sh_interface
|
|||
tp: test_programs
|
||||
tp: tools
|
||||
tp: formats
|
||||
tp: data
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
Content-Type: application/X-atf-atffile; version="1"
|
||||
|
||||
prop: test-suite = atf
|
||||
|
||||
tp: t_pkg_config
|
|
@ -0,0 +1,148 @@
|
|||
#
|
||||
# Automated Testing Framework (atf)
|
||||
#
|
||||
# Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. All advertising materials mentioning features or use of this
|
||||
# software must display the following acknowledgement:
|
||||
# This product includes software developed by the NetBSD
|
||||
# Foundation, Inc. and its contributors.
|
||||
# 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
|
||||
# CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
# The following tests assume that the atf.pc file is installed in a
|
||||
# directory that is known by pkg-config. Otherwise they will fail,
|
||||
# and you will be required to adjust PKG_CONFIG_PATH accordingly.
|
||||
#
|
||||
# It would be possible to bypass this requirement by setting the path
|
||||
# explicitly during the tests, but then this would not do a real check
|
||||
# to ensure that the installation is working.
|
||||
|
||||
require_atf_pc()
|
||||
{
|
||||
pkg-config atf || atf_fail "pkg-config could not locate atf.pc;" \
|
||||
"maybe need to set PKG_CONFIG_PATH?"
|
||||
}
|
||||
|
||||
atf_test_case version
|
||||
version_head()
|
||||
{
|
||||
atf_set "descr" "Checks that the version is correct"
|
||||
atf_set "require.progs" "pkg-config"
|
||||
}
|
||||
version_body()
|
||||
{
|
||||
require_atf_pc
|
||||
|
||||
atf_check "atf-version | head -n 1 | cut -d ' ' -f 4" 0 stdout null
|
||||
ver1=$(cat stdout)
|
||||
echo "Version reported by atf-version: ${ver1}"
|
||||
|
||||
atf_check "pkg-config --modversion atf" 0 stdout null
|
||||
ver2=$(cat stdout)
|
||||
echo "Version reported by pkg-config: ${ver2}"
|
||||
|
||||
atf_check_equal ${ver1} ${ver2}
|
||||
}
|
||||
|
||||
atf_test_case build
|
||||
build_head()
|
||||
{
|
||||
atf_set "descr" "Checks that a test program can be built against" \
|
||||
"the C++ library based on the pkg-config information"
|
||||
atf_set "require.progs" "pkg-config"
|
||||
}
|
||||
build_body()
|
||||
{
|
||||
require_atf_pc
|
||||
|
||||
atf_check "pkg-config --variable=cxx atf" 0 stdout null
|
||||
cxx=$(cat stdout)
|
||||
echo "Compiler is: ${cxx}"
|
||||
atf_require_prog ${cxx}
|
||||
|
||||
cat >tp.cpp <<EOF
|
||||
#include <iostream>
|
||||
|
||||
#include <atf.hpp>
|
||||
|
||||
ATF_TEST_CASE(tp);
|
||||
ATF_TEST_CASE_HEAD(tp) {
|
||||
set("descr", "A test case");
|
||||
}
|
||||
ATF_TEST_CASE_BODY(tp) {
|
||||
std::cout << "Running" << std::endl;
|
||||
}
|
||||
|
||||
ATF_INIT_TEST_CASES(tcs) {
|
||||
ATF_ADD_TEST_CASE(tcs, tp);
|
||||
}
|
||||
EOF
|
||||
|
||||
atf_check "pkg-config --cflags atf" 0 stdout null
|
||||
cxxflags=$(cat stdout)
|
||||
echo "CXXFLAGS are: ${cxxflags}"
|
||||
|
||||
atf_check "pkg-config --libs-only-L --libs-only-other atf" 0 stdout null
|
||||
ldflags=$(cat stdout)
|
||||
atf_check "pkg-config --libs-only-l atf" 0 stdout null
|
||||
libs=$(cat stdout)
|
||||
echo "LDFLAGS are: ${ldflags}"
|
||||
echo "LIBS are: ${libs}"
|
||||
|
||||
atf_check "${cxx} ${cxxflags} -o tp.o -c tp.cpp" 0 null null
|
||||
atf_check "${cxx} ${ldflags} -o tp tp.o ${libs}" 0 null null
|
||||
|
||||
libpath=
|
||||
for f in ${ldflags}; do
|
||||
case ${f} in
|
||||
-L*)
|
||||
dir=$(echo ${f} | sed -e 's,^-L,,')
|
||||
if [ -z "${libpath}" ]; then
|
||||
libpath="${dir}"
|
||||
else
|
||||
libpath="${libpath}:${dir}"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
atf_check "test -x tp" 0 null null
|
||||
atf_check "LD_LIBRARY_PATH=${libpath} ./tp" 0 stdout null
|
||||
atf_check "grep 'application/X-atf-tcs' stdout" 0 ignore null
|
||||
atf_check "grep 'Running' stdout" 0 ignore null
|
||||
}
|
||||
|
||||
atf_init_test_cases()
|
||||
{
|
||||
atf_add_test_case version
|
||||
atf_add_test_case build
|
||||
}
|
||||
|
||||
# vim: syntax=sh:expandtab:shiftwidth=4:softtabstop=4
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
|
@ -51,6 +51,7 @@ extern "C" {
|
|||
#include "atf/env.hpp"
|
||||
#include "atf/fs.hpp"
|
||||
#include "atf/macros.hpp"
|
||||
#include "atf/text.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Auxiliary functions.
|
||||
|
@ -281,6 +282,23 @@ ATF_TEST_CASE_BODY(fork_mangle_fds)
|
|||
#endif
|
||||
}
|
||||
|
||||
ATF_TEST_CASE(fork_stop);
|
||||
ATF_TEST_CASE_HEAD(fork_stop)
|
||||
{
|
||||
set("descr", "Helper test case for the t_fork test program");
|
||||
}
|
||||
ATF_TEST_CASE_BODY(fork_stop)
|
||||
{
|
||||
std::ofstream os(config().get("pidfile").c_str());
|
||||
os << ::getpid() << std::endl;
|
||||
os.close();
|
||||
std::cout << "Wrote pid file" << std::endl;
|
||||
std::cout << "Waiting for done file" << std::endl;
|
||||
while (::access(config().get("donefile").c_str(), F_OK) != 0)
|
||||
::usleep(10000);
|
||||
std::cout << "Exiting" << std::endl;
|
||||
}
|
||||
|
||||
ATF_TEST_CASE(fork_umask);
|
||||
ATF_TEST_CASE_HEAD(fork_umask)
|
||||
{
|
||||
|
@ -318,6 +336,16 @@ ATF_TEST_CASE_BODY(ident_2)
|
|||
ATF_CHECK_EQUAL(get("ident"), "ident_2");
|
||||
}
|
||||
|
||||
ATF_TEST_CASE(require_arch);
|
||||
ATF_TEST_CASE_HEAD(require_arch)
|
||||
{
|
||||
set("descr", "Helper test case for the t_meta_data test program");
|
||||
set("require.arch", config().get("arch", "not-set"));
|
||||
}
|
||||
ATF_TEST_CASE_BODY(require_arch)
|
||||
{
|
||||
}
|
||||
|
||||
ATF_TEST_CASE(require_config);
|
||||
ATF_TEST_CASE_HEAD(require_config)
|
||||
{
|
||||
|
@ -330,6 +358,16 @@ ATF_TEST_CASE_BODY(require_config)
|
|||
std::cout << "var2: " << config().get("var2") << std::endl;
|
||||
}
|
||||
|
||||
ATF_TEST_CASE(require_machine);
|
||||
ATF_TEST_CASE_HEAD(require_machine)
|
||||
{
|
||||
set("descr", "Helper test case for the t_meta_data test program");
|
||||
set("require.machine", config().get("machine", "not-set"));
|
||||
}
|
||||
ATF_TEST_CASE_BODY(require_machine)
|
||||
{
|
||||
}
|
||||
|
||||
ATF_TEST_CASE(require_progs_body);
|
||||
ATF_TEST_CASE_HEAD(require_progs_body)
|
||||
{
|
||||
|
@ -390,6 +428,28 @@ ATF_TEST_CASE_BODY(require_user_unprivileged2)
|
|||
{
|
||||
}
|
||||
|
||||
ATF_TEST_CASE(timeout);
|
||||
ATF_TEST_CASE_HEAD(timeout)
|
||||
{
|
||||
set("descr", "Helper test case for the t_meta_data test program");
|
||||
set("timeout", config().get("timeout", "0"));
|
||||
}
|
||||
ATF_TEST_CASE_BODY(timeout)
|
||||
{
|
||||
sleep(atf::text::to_type< int >(config().get("sleep")));
|
||||
}
|
||||
|
||||
ATF_TEST_CASE(timeout2);
|
||||
ATF_TEST_CASE_HEAD(timeout2)
|
||||
{
|
||||
set("descr", "Helper test case for the t_meta_data test program");
|
||||
set("timeout", config().get("timeout2", "0"));
|
||||
}
|
||||
ATF_TEST_CASE_BODY(timeout2)
|
||||
{
|
||||
sleep(atf::text::to_type< int >(config().get("sleep2")));
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Helper tests for "t_srcdir".
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -507,18 +567,23 @@ ATF_INIT_TEST_CASES(tcs)
|
|||
|
||||
// Add helper tests for t_fork.
|
||||
ATF_ADD_TEST_CASE(tcs, fork_mangle_fds);
|
||||
ATF_ADD_TEST_CASE(tcs, fork_stop);
|
||||
ATF_ADD_TEST_CASE(tcs, fork_umask);
|
||||
|
||||
// Add helper tests for t_meta_data.
|
||||
ATF_ADD_TEST_CASE(tcs, ident_1);
|
||||
ATF_ADD_TEST_CASE(tcs, ident_2);
|
||||
ATF_ADD_TEST_CASE(tcs, require_arch);
|
||||
ATF_ADD_TEST_CASE(tcs, require_config);
|
||||
ATF_ADD_TEST_CASE(tcs, require_machine);
|
||||
ATF_ADD_TEST_CASE(tcs, require_progs_body);
|
||||
ATF_ADD_TEST_CASE(tcs, require_progs_head);
|
||||
ATF_ADD_TEST_CASE(tcs, require_user_root);
|
||||
ATF_ADD_TEST_CASE(tcs, require_user_root2);
|
||||
ATF_ADD_TEST_CASE(tcs, require_user_unprivileged);
|
||||
ATF_ADD_TEST_CASE(tcs, require_user_unprivileged2);
|
||||
ATF_ADD_TEST_CASE(tcs, timeout);
|
||||
ATF_ADD_TEST_CASE(tcs, timeout2);
|
||||
|
||||
// Add helper tests for t_srcdir.
|
||||
ATF_ADD_TEST_CASE(tcs, srcdir_exists);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#
|
||||
# Automated Testing Framework (atf)
|
||||
#
|
||||
# Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
# Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
|
@ -224,6 +224,20 @@ fork_mangle_fds_body()
|
|||
eval "exec ${resfd}>res"
|
||||
}
|
||||
|
||||
atf_test_case fork_stop
|
||||
fork_stop_head()
|
||||
{
|
||||
atf_set "descr" "Helper test case for the t_fork test program"
|
||||
}
|
||||
fork_stop_body()
|
||||
{
|
||||
echo ${$} >$(atf_config_get pidfile)
|
||||
echo "Wrote pid file"
|
||||
echo "Waiting for done file"
|
||||
while ! test -f $(atf_config_get donefile); do sleep 1; done
|
||||
echo "Exiting"
|
||||
}
|
||||
|
||||
atf_test_case fork_umask
|
||||
fork_umask_head()
|
||||
{
|
||||
|
@ -258,6 +272,17 @@ ident_2_body()
|
|||
atf_check_equal '$(atf_get ident)' ident_2
|
||||
}
|
||||
|
||||
atf_test_case require_arch
|
||||
require_arch_head()
|
||||
{
|
||||
atf_set "descr" "Helper test case for the t_meta_data test program"
|
||||
atf_set "require.arch" "$(atf_config_get arch)"
|
||||
}
|
||||
require_arch_body()
|
||||
{
|
||||
:
|
||||
}
|
||||
|
||||
atf_test_case require_config
|
||||
require_config_head()
|
||||
{
|
||||
|
@ -270,6 +295,17 @@ require_config_body()
|
|||
echo "var2: $(atf_config_get var2)"
|
||||
}
|
||||
|
||||
atf_test_case require_machine
|
||||
require_machine_head()
|
||||
{
|
||||
atf_set "descr" "Helper test case for the t_meta_data test program"
|
||||
atf_set "require.machine" "$(atf_config_get machine)"
|
||||
}
|
||||
require_machine_body()
|
||||
{
|
||||
:
|
||||
}
|
||||
|
||||
atf_test_case require_progs_body
|
||||
require_progs_body_head()
|
||||
{
|
||||
|
@ -337,6 +373,28 @@ require_user_unprivileged2_body()
|
|||
:
|
||||
}
|
||||
|
||||
atf_test_case timeout
|
||||
timeout_head()
|
||||
{
|
||||
atf_set "descr" "Helper test case for the t_meta_data test program"
|
||||
atf_set "timeout" $(atf_config_get timeout 0)
|
||||
}
|
||||
timeout_body()
|
||||
{
|
||||
sleep $(atf_config_get sleep)
|
||||
}
|
||||
|
||||
atf_test_case timeout2
|
||||
timeout2_head()
|
||||
{
|
||||
atf_set "descr" "Helper test case for the t_meta_data test program"
|
||||
atf_set "timeout2" $(atf_config_get timeout2 0)
|
||||
}
|
||||
timeout2_body()
|
||||
{
|
||||
sleep $(atf_config_get sleep2)
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Helper tests for "t_srcdir".
|
||||
# -------------------------------------------------------------------------
|
||||
|
@ -413,18 +471,23 @@ atf_init_test_cases()
|
|||
|
||||
# Add helper tests for t_fork.
|
||||
atf_add_test_case fork_mangle_fds
|
||||
atf_add_test_case fork_stop
|
||||
atf_add_test_case fork_umask
|
||||
|
||||
# Add helper tests for t_meta_data.
|
||||
atf_add_test_case ident_1
|
||||
atf_add_test_case ident_2
|
||||
atf_add_test_case require_arch
|
||||
atf_add_test_case require_config
|
||||
atf_add_test_case require_machine
|
||||
atf_add_test_case require_progs_body
|
||||
atf_add_test_case require_progs_head
|
||||
atf_add_test_case require_user_root
|
||||
atf_add_test_case require_user_root2
|
||||
atf_add_test_case require_user_unprivileged
|
||||
atf_add_test_case require_user_unprivileged2
|
||||
atf_add_test_case timeout
|
||||
atf_add_test_case timeout2
|
||||
|
||||
# Add helper tests for t_srcdir.
|
||||
atf_add_test_case srcdir_exists
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#
|
||||
# Automated Testing Framework (atf)
|
||||
#
|
||||
# Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
# Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
|
@ -56,6 +56,36 @@ mangle_fds_body()
|
|||
done
|
||||
}
|
||||
|
||||
atf_test_case stop
|
||||
stop_head()
|
||||
{
|
||||
atf_set "descr" "Tests that sending a stop signal to a test case does" \
|
||||
"not report it as failed"
|
||||
}
|
||||
stop_body()
|
||||
{
|
||||
srcdir=$(atf_get_srcdir)
|
||||
h_cpp=${srcdir}/h_cpp
|
||||
h_sh=${srcdir}/h_sh
|
||||
|
||||
for h in ${h_cpp} ${h_sh}; do
|
||||
${h} -s ${srcdir} -v pidfile=$(pwd)/pid -v donefile=$(pwd)/done \
|
||||
-r3 fork_stop 3>resout &
|
||||
ppid=${!}
|
||||
echo "Waiting for pid file for test program ${ppid}"
|
||||
while test ! -f pid; do sleep 1; done
|
||||
pid=$(cat pid)
|
||||
echo "Test case's pid is ${pid}"
|
||||
kill -STOP ${pid}
|
||||
touch done
|
||||
echo "Wrote done file"
|
||||
kill -CONT ${pid}
|
||||
wait ${ppid}
|
||||
atf_check "grep 'fork_stop, passed' resout" 0 ignore null
|
||||
rm -f pid done
|
||||
done
|
||||
}
|
||||
|
||||
atf_test_case umask
|
||||
umask_head()
|
||||
{
|
||||
|
@ -84,6 +114,7 @@ umask_body()
|
|||
atf_init_test_cases()
|
||||
{
|
||||
atf_add_test_case mangle_fds
|
||||
atf_add_test_case stop
|
||||
atf_add_test_case umask
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#
|
||||
# Automated Testing Framework (atf)
|
||||
#
|
||||
# Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
# Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
|
@ -57,6 +57,60 @@ ident_body()
|
|||
done
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Tests for the "require_arch" meta-data property.
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
atf_test_case require_arch
|
||||
require_arch_head()
|
||||
{
|
||||
atf_set "descr" "Tests that the require.arch property works"
|
||||
}
|
||||
require_arch_body()
|
||||
{
|
||||
srcdir=$(atf_get_srcdir)
|
||||
h_cpp=${srcdir}/h_cpp
|
||||
h_sh=${srcdir}/h_sh
|
||||
|
||||
for h in ${h_cpp} ${h_sh}; do
|
||||
echo "Check for the real architecture"
|
||||
arch=$(atf-config -t atf_arch)
|
||||
atf_check "${h} -s ${srcdir} -r3 -v arch='${arch}' \
|
||||
require_arch 3>resout" 0 ignore ignore
|
||||
atf_check 'grep "passed" resout' 0 ignore null
|
||||
atf_check "${h} -s ${srcdir} -r3 -v arch='foo ${arch}' \
|
||||
require_arch 3>resout" 0 ignore ignore
|
||||
atf_check 'grep "passed" resout' 0 ignore null
|
||||
atf_check "${h} -s ${srcdir} -r3 -v arch='${arch} foo' \
|
||||
require_arch 3>resout" 0 ignore ignore
|
||||
atf_check 'grep "passed" resout' 0 ignore null
|
||||
|
||||
echo "Some fictitious checks"
|
||||
atf_check "ATF_ARCH=foo ${h} -s ${srcdir} -r3 \
|
||||
-v arch='foo' \
|
||||
require_arch 3>resout" 0 ignore ignore
|
||||
atf_check 'grep "passed" resout' 0 ignore null
|
||||
atf_check "ATF_ARCH=foo ${h} -s ${srcdir} -r3 \
|
||||
-v arch='foo bar' \
|
||||
require_arch 3>resout" 0 ignore ignore
|
||||
atf_check 'grep "passed" resout' 0 ignore null
|
||||
atf_check "ATF_ARCH=foo ${h} -s ${srcdir} -r3 \
|
||||
-v arch='bar foo' \
|
||||
require_arch 3>resout" 0 ignore ignore
|
||||
atf_check 'grep "passed" resout' 0 ignore null
|
||||
|
||||
echo "Now some failures"
|
||||
atf_check "ATF_ARCH=foo ${h} -s ${srcdir} -r3 \
|
||||
-v arch='bar' \
|
||||
require_arch 3>resout" 0 ignore ignore
|
||||
atf_check 'grep "skipped" resout' 0 ignore null
|
||||
atf_check "ATF_ARCH=foo ${h} -s ${srcdir} -r3 \
|
||||
-v arch='bar baz' \
|
||||
require_arch 3>resout" 0 ignore ignore
|
||||
atf_check 'grep "skipped" resout' 0 ignore null
|
||||
done
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Tests for the "require_config" meta-data property.
|
||||
# -------------------------------------------------------------------------
|
||||
|
@ -91,6 +145,60 @@ require_config_body()
|
|||
done
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Tests for the "require_machine" meta-data property.
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
atf_test_case require_machine
|
||||
require_machine_head()
|
||||
{
|
||||
atf_set "descr" "Tests that the require.machine property works"
|
||||
}
|
||||
require_machine_body()
|
||||
{
|
||||
srcdir=$(atf_get_srcdir)
|
||||
h_cpp=${srcdir}/h_cpp
|
||||
h_sh=${srcdir}/h_sh
|
||||
|
||||
for h in ${h_cpp} ${h_sh}; do
|
||||
echo "Check for the real machine type"
|
||||
machine=$(atf-config -t atf_machine)
|
||||
atf_check "${h} -s ${srcdir} -r3 -v machine='${machine}' \
|
||||
require_machine 3>resout" 0 ignore ignore
|
||||
atf_check 'grep "passed" resout' 0 ignore null
|
||||
atf_check "${h} -s ${srcdir} -r3 -v machine='foo ${machine}' \
|
||||
require_machine 3>resout" 0 ignore ignore
|
||||
atf_check 'grep "passed" resout' 0 ignore null
|
||||
atf_check "${h} -s ${srcdir} -r3 -v machine='${machine} foo' \
|
||||
require_machine 3>resout" 0 ignore ignore
|
||||
atf_check 'grep "passed" resout' 0 ignore null
|
||||
|
||||
echo "Some fictitious checks"
|
||||
atf_check "ATF_MACHINE=foo ${h} -s ${srcdir} -r3 \
|
||||
-v machine='foo' \
|
||||
require_machine 3>resout" 0 ignore ignore
|
||||
atf_check 'grep "passed" resout' 0 ignore null
|
||||
atf_check "ATF_MACHINE=foo ${h} -s ${srcdir} -r3 \
|
||||
-v machine='foo bar' \
|
||||
require_machine 3>resout" 0 ignore ignore
|
||||
atf_check 'grep "passed" resout' 0 ignore null
|
||||
atf_check "ATF_MACHINE=foo ${h} -s ${srcdir} -r3 \
|
||||
-v machine='bar foo' \
|
||||
require_machine 3>resout" 0 ignore ignore
|
||||
atf_check 'grep "passed" resout' 0 ignore null
|
||||
|
||||
echo "Now some failures"
|
||||
atf_check "ATF_MACHINE=foo ${h} -s ${srcdir} -r3 \
|
||||
-v machine='bar' \
|
||||
require_machine 3>resout" 0 ignore ignore
|
||||
atf_check 'grep "skipped" resout' 0 ignore null
|
||||
atf_check "ATF_MACHINE=foo ${h} -s ${srcdir} -r3 \
|
||||
-v machine='bar baz' \
|
||||
require_machine 3>resout" 0 ignore ignore
|
||||
atf_check 'grep "skipped" resout' 0 ignore null
|
||||
done
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Tests for the "require_progs" meta-data property.
|
||||
# -------------------------------------------------------------------------
|
||||
|
@ -262,6 +370,45 @@ require_user_multiple_body()
|
|||
done
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Tests for the "timeout" meta-data property.
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
atf_test_case timeout
|
||||
timeout_head()
|
||||
{
|
||||
atf_set "descr" "Tests that 'timeout' works"
|
||||
}
|
||||
timeout_body()
|
||||
{
|
||||
srcdir=$(atf_get_srcdir)
|
||||
h_cpp=${srcdir}/h_cpp
|
||||
h_sh=${srcdir}/h_sh
|
||||
|
||||
for h in ${h_cpp} ${h_sh}; do
|
||||
atf_check "${h} -s ${srcdir} \
|
||||
-v timeout=0 -v sleep=1 \
|
||||
-r3 timeout 3>resout" 0 ignore ignore
|
||||
atf_check 'grep "timeout, passed" resout' 0 ignore null
|
||||
|
||||
atf_check "${h} -s ${srcdir} \
|
||||
-v timeout=10 -v sleep=1 \
|
||||
-r3 timeout 3>resout" 0 ignore ignore
|
||||
atf_check 'grep "timeout, passed" resout' 0 ignore null
|
||||
|
||||
atf_check "${h} -s ${srcdir} \
|
||||
-v timeout=1 -v sleep=10 \
|
||||
-r3 timeout 3>resout" 1 ignore ignore
|
||||
atf_check 'grep "timeout, failed,.*timed out" resout' 0 ignore null
|
||||
|
||||
atf_check "${h} -s ${srcdir} \
|
||||
-v timeout=1 -v sleep=10 -v timeout2=10 -v sleep2=1 \
|
||||
-r3 timeout timeout2 3>resout" 1 ignore ignore
|
||||
atf_check 'grep "timeout, failed,.*timed out" resout' 0 ignore null
|
||||
atf_check 'grep "timeout2, passed" resout' 0 ignore null
|
||||
done
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Main.
|
||||
# -------------------------------------------------------------------------
|
||||
|
@ -269,12 +416,15 @@ require_user_multiple_body()
|
|||
atf_init_test_cases()
|
||||
{
|
||||
atf_add_test_case ident
|
||||
atf_add_test_case require_arch
|
||||
atf_add_test_case require_config
|
||||
atf_add_test_case require_machine
|
||||
atf_add_test_case require_progs_func
|
||||
atf_add_test_case require_progs_header
|
||||
atf_add_test_case require_user_root
|
||||
atf_add_test_case require_user_unprivileged
|
||||
atf_add_test_case require_user_multiple
|
||||
atf_add_test_case timeout
|
||||
}
|
||||
|
||||
# vim: syntax=sh:expandtab:shiftwidth=4:softtabstop=4
|
||||
|
|
|
@ -7,3 +7,5 @@ tp: t_atf_compile
|
|||
tp: t_atf_cleanup
|
||||
tp: t_atf_run
|
||||
tp: t_atf_report
|
||||
tp: t_atf_exec
|
||||
tp: t_atf_killpg
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#
|
||||
# Automated Testing Framework (atf)
|
||||
#
|
||||
# Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
# Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
|
@ -78,6 +78,25 @@ dir_full_body()
|
|||
atf_check 'test -e foo' 1 null null
|
||||
}
|
||||
|
||||
mount_tmpfs_portable()
|
||||
{
|
||||
platform=$(uname)
|
||||
case ${platform} in
|
||||
Linux|NetBSD)
|
||||
mount -t tmpfs tmpfs ${1}
|
||||
;;
|
||||
FreeBSD)
|
||||
mdmfs -s 16m md ${1}
|
||||
;;
|
||||
SunOS)
|
||||
mount -F tmpfs tmpfs $(pwd)/${1}
|
||||
;;
|
||||
*)
|
||||
atf_fail "Internal error in test program"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
atf_test_case mount
|
||||
mount_head()
|
||||
{
|
||||
|
@ -89,16 +108,16 @@ mount_body()
|
|||
{
|
||||
platform=$(uname)
|
||||
case ${platform} in
|
||||
Linux|NetBSD)
|
||||
Linux|FreeBSD|NetBSD|SunOS)
|
||||
mkdir foo
|
||||
mkdir foo/bar
|
||||
mkdir foo/bar/mnt
|
||||
atf_check 'mount -t tmpfs tmpfs foo/bar/mnt' 0 null null
|
||||
atf_check 'mount_tmpfs_portable foo/bar/mnt' 0 null null
|
||||
mkdir foo/baz
|
||||
atf_check 'mount -t tmpfs tmpfs foo/baz' 0 null null
|
||||
atf_check 'mount_tmpfs_portable foo/baz' 0 null null
|
||||
mkdir foo/baz/foo
|
||||
mkdir foo/baz/foo/bar
|
||||
atf_check 'mount -t tmpfs tmpfs foo/baz/foo/bar' 0 null null
|
||||
atf_check 'mount_tmpfs_portable foo/baz/foo/bar' 0 null null
|
||||
;;
|
||||
*)
|
||||
# XXX Possibly specify in meta-data too.
|
||||
|
@ -124,10 +143,10 @@ symlink_body()
|
|||
{
|
||||
platform=$(uname)
|
||||
case ${platform} in
|
||||
Linux|NetBSD)
|
||||
Linux|FreeBSD|NetBSD|SunOS)
|
||||
atf_check 'mkdir foo' 0 null null
|
||||
atf_check 'mkdir foo/bar' 0 null null
|
||||
atf_check 'mount -t tmpfs tmpfs foo/bar' 0 null null
|
||||
atf_check 'mount_tmpfs_portable foo/bar' 0 null null
|
||||
atf_check 'touch a' 0 null null
|
||||
atf_check 'ln -s $(pwd)/a foo/bar' 0 null null
|
||||
;;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#
|
||||
# Automated Testing Framework (atf)
|
||||
#
|
||||
# Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
# Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
|
@ -34,8 +34,9 @@
|
|||
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
all_vars="atf_confdir atf_libexecdir atf_pkgdatadir atf_shell atf_workdir"
|
||||
all_vars_no=5
|
||||
all_vars="atf_arch atf_confdir atf_libexecdir atf_machine atf_pkgdatadir \
|
||||
atf_shell atf_workdir"
|
||||
all_vars_no=7
|
||||
|
||||
count_lines()
|
||||
{
|
||||
|
@ -156,6 +157,33 @@ override_env_body()
|
|||
done
|
||||
}
|
||||
|
||||
# XXX: This does not seem to belong here...
|
||||
atf_test_case arch
|
||||
arch_head()
|
||||
{
|
||||
atf_set "descr" "Tests that the current value of atf_arch is correct" \
|
||||
"for the corresponding atf_machine"
|
||||
}
|
||||
arch_body()
|
||||
{
|
||||
atf_check "atf-config -t atf_arch" 0 stdout null
|
||||
arch=$(cat stdout)
|
||||
atf_check "atf-config -t atf_machine" 0 stdout null
|
||||
machine=$(cat stdout)
|
||||
echo "Machine type ${machine}, architecture ${arch}"
|
||||
|
||||
case ${machine} in
|
||||
i386|i486|i586|i686)
|
||||
exp_arch=i386
|
||||
;;
|
||||
*)
|
||||
exp_arch=${machine}
|
||||
esac
|
||||
echo "Expected architecture ${exp_arch}"
|
||||
|
||||
atf_check_equal ${arch} ${exp_arch}
|
||||
}
|
||||
|
||||
atf_init_test_cases()
|
||||
{
|
||||
atf_add_test_case list_all
|
||||
|
@ -167,6 +195,8 @@ atf_init_test_cases()
|
|||
atf_add_test_case query_mixture
|
||||
|
||||
atf_add_test_case override_env
|
||||
|
||||
atf_add_test_case arch
|
||||
}
|
||||
|
||||
# vim: syntax=sh:expandtab:shiftwidth=4:softtabstop=4
|
||||
|
|
|
@ -0,0 +1,121 @@
|
|||
#
|
||||
# Automated Testing Framework (atf)
|
||||
#
|
||||
# Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. All advertising materials mentioning features or use of this
|
||||
# software must display the following acknowledgement:
|
||||
# This product includes software developed by the NetBSD
|
||||
# Foundation, Inc. and its contributors.
|
||||
# 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
|
||||
# CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
atf_exec=$(atf-config -t atf_libexecdir)/atf-exec
|
||||
|
||||
atf_test_case passthrough
|
||||
passthrough_head()
|
||||
{
|
||||
atf_set "descr" "Ensures that this executes the given command if" \
|
||||
"no options are provided"
|
||||
}
|
||||
passthrough_body()
|
||||
{
|
||||
cat >helper.sh <<EOF
|
||||
#! $(atf-config -t atf_shell)
|
||||
echo "\${@}"
|
||||
EOF
|
||||
chmod +x helper.sh
|
||||
|
||||
echo '' >expout
|
||||
atf_check "${atf_exec} ./helper.sh" 0 expout null
|
||||
atf_check "${atf_exec} -- ./helper.sh" 0 expout null
|
||||
|
||||
echo 'arg1' >expout
|
||||
atf_check "${atf_exec} ./helper.sh arg1" 0 expout null
|
||||
atf_check "${atf_exec} -- ./helper.sh arg1" 0 expout null
|
||||
|
||||
echo 'arg1 arg2' >expout
|
||||
atf_check "${atf_exec} ./helper.sh arg1 arg2" 0 expout null
|
||||
atf_check "${atf_exec} -- ./helper.sh arg1 arg2" 0 expout null
|
||||
}
|
||||
|
||||
pgid_of()
|
||||
{
|
||||
ps -o pgid -p ${1} | tail -n 1
|
||||
}
|
||||
|
||||
atf_test_case process_group
|
||||
process_group_head()
|
||||
{
|
||||
atf_set "descr" "Checks that giving -g creates a new process group"
|
||||
}
|
||||
process_group_body()
|
||||
{
|
||||
cat >helper.sh <<EOF
|
||||
#! $(atf-config -t atf_shell)
|
||||
|
||||
touch ready
|
||||
while [ ! -f done ]; do sleep 1; done
|
||||
EOF
|
||||
chmod +x helper.sh
|
||||
|
||||
this_pgid=$(pgid_of ${$})
|
||||
|
||||
echo "Checking that the lack of -g does not change the process group"
|
||||
rm -f ready done
|
||||
${atf_exec} ./helper.sh &
|
||||
while [ ! -f ready ]; do sleep 1; done
|
||||
child_pgid=$(pgid_of ${!})
|
||||
touch done
|
||||
wait ${!}
|
||||
|
||||
echo "My PGID is ${this_pgid}"
|
||||
echo "atf-exec's PGID is ${child_pgid}"
|
||||
[ ${this_pgid} -eq ${child_pgid} ] || \
|
||||
atf_fail "Process group was changed"
|
||||
|
||||
echo "Checking that giving -g changes the process group"
|
||||
rm -f ready done
|
||||
${atf_exec} -g ./helper.sh &
|
||||
while [ ! -f ready ]; do sleep 1; done
|
||||
child_pgid=$(pgid_of ${!})
|
||||
touch done
|
||||
wait ${!}
|
||||
|
||||
echo "My PGID is ${this_pgid}"
|
||||
echo "atf-exec's PGID is ${child_pgid}"
|
||||
[ ${this_pgid} -ne ${child_pgid} ] || \
|
||||
atf_fail "Process group was not changed"
|
||||
}
|
||||
|
||||
atf_init_test_cases()
|
||||
{
|
||||
atf_add_test_case passthrough
|
||||
atf_add_test_case process_group
|
||||
}
|
||||
|
||||
# vim: syntax=sh:expandtab:shiftwidth=4:softtabstop=4
|
|
@ -0,0 +1,146 @@
|
|||
#
|
||||
# Automated Testing Framework (atf)
|
||||
#
|
||||
# Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. All advertising materials mentioning features or use of this
|
||||
# software must display the following acknowledgement:
|
||||
# This product includes software developed by the NetBSD
|
||||
# Foundation, Inc. and its contributors.
|
||||
# 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
|
||||
# CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
atf_exec=$(atf-config -t atf_libexecdir)/atf-exec
|
||||
atf_killpg=$(atf-config -t atf_libexecdir)/atf-killpg
|
||||
|
||||
atf_test_case default
|
||||
default_head()
|
||||
{
|
||||
atf_set "descr" "Verifies that the signal sent by default is correct"
|
||||
}
|
||||
default_body()
|
||||
{
|
||||
cat >helper.sh <<EOF
|
||||
#! $(atf-config -t atf_shell)
|
||||
trap 'touch sigterm; exit 0' TERM
|
||||
touch waiting
|
||||
while test ! -f done; do sleep 1; done
|
||||
EOF
|
||||
chmod +x helper.sh
|
||||
|
||||
${atf_exec} -g ./helper.sh >stdout &
|
||||
while test ! -f waiting; do sleep 1; done
|
||||
${atf_killpg} ${!}
|
||||
while test ! -f sigterm; do sleep 1; done
|
||||
touch done
|
||||
wait ${!}
|
||||
|
||||
atf_check 'test -f sigterm' 0 null null
|
||||
}
|
||||
|
||||
atf_test_case sflag
|
||||
sflag_head()
|
||||
{
|
||||
atf_set "descr" "Verifies that the -s flag correctly changes the" \
|
||||
"signal sent to processes"
|
||||
}
|
||||
sflag_body()
|
||||
{
|
||||
cat >helper.sh <<EOF
|
||||
#! $(atf-config -t atf_shell)
|
||||
trap 'touch sighup; exit 0' HUP
|
||||
trap 'touch sigterm; exit 0' TERM
|
||||
touch waiting
|
||||
while test ! -f done; do sleep 1; done
|
||||
EOF
|
||||
chmod +x helper.sh
|
||||
|
||||
${atf_exec} -g ./helper.sh >stdout &
|
||||
while test ! -f waiting; do sleep 1; done
|
||||
${atf_killpg} -s 1 ${!}
|
||||
while test ! -f sighup -a ! -f sigterm; do sleep 1; done
|
||||
touch done
|
||||
wait ${!}
|
||||
|
||||
atf_check 'test -f sighup' 0 null null
|
||||
atf_check 'test -f sigterm' 1 null null
|
||||
}
|
||||
|
||||
atf_test_case group
|
||||
group_head()
|
||||
{
|
||||
atf_set "descr" "Verifies that the signal is sent to the whole group"
|
||||
}
|
||||
group_body()
|
||||
{
|
||||
cat >helper.sh <<EOF
|
||||
#! $(atf-config -t atf_shell)
|
||||
if [ \${#} -eq 1 ]; then
|
||||
./helper.sh &
|
||||
trap 'touch sig1' HUP
|
||||
touch waiting1
|
||||
echo "Process 1 waiting for termination"
|
||||
while [ ! -f done ]; do sleep 1; done
|
||||
echo "Process 1 waiting for process 2"
|
||||
wait \${!}
|
||||
echo "Process 1 terminating"
|
||||
touch done1
|
||||
else
|
||||
trap 'touch sig2' HUP
|
||||
touch waiting2
|
||||
echo "Process 2 waiting for termination"
|
||||
while [ ! -f done ]; do sleep 1; done
|
||||
echo "Process 2 terminating"
|
||||
touch done2
|
||||
fi
|
||||
EOF
|
||||
chmod +x helper.sh
|
||||
|
||||
${atf_exec} -g ./helper.sh initial &
|
||||
echo "Waiting for process 1 to be alive"
|
||||
while test ! -f waiting1; do sleep 1; done
|
||||
echo "Waiting for process 2 to be alive"
|
||||
while test ! -f waiting2; do sleep 1; done
|
||||
echo "Sending signal"
|
||||
${atf_killpg} -s 1 ${!}
|
||||
echo "Waiting for termination"
|
||||
touch done
|
||||
while test ! -f done1 -a ! -f done2; do sleep 1; done
|
||||
wait
|
||||
|
||||
atf_check 'test -f sig1' 0 null null
|
||||
atf_check 'test -f sig2' 0 null null
|
||||
}
|
||||
|
||||
atf_init_test_cases()
|
||||
{
|
||||
atf_add_test_case default
|
||||
atf_add_test_case sflag
|
||||
atf_add_test_case group
|
||||
}
|
||||
|
||||
# vim: syntax=sh:expandtab:shiftwidth=4:softtabstop=4
|
|
@ -43,7 +43,7 @@ create_helpers()
|
|||
cp $(atf_get_srcdir)/h_fail tp4
|
||||
|
||||
cat >tp5 <<EOF
|
||||
#! /bin/sh
|
||||
#! $(atf-config -t atf_shell)
|
||||
echo foo
|
||||
EOF
|
||||
chmod +x tp5
|
||||
|
@ -73,7 +73,7 @@ run_helpers()
|
|||
{
|
||||
mkdir etc
|
||||
cat >etc/atf-run.hooks <<EOF
|
||||
#! /bin/sh
|
||||
#! $(atf-config -t atf_shell)
|
||||
|
||||
info_start_hook()
|
||||
{
|
||||
|
|
|
@ -11,5 +11,6 @@ tp: t_io
|
|||
tp: t_expand
|
||||
tp: t_user
|
||||
tp: t_parser
|
||||
tp: t_signals
|
||||
tp: t_tests
|
||||
tp: t_utils
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
|
@ -77,92 +77,153 @@ ATF_TEST_CASE_BODY(get)
|
|||
{
|
||||
// Unset all known environment variables and make sure the built-in
|
||||
// values do not match the bogus value we will use for testing.
|
||||
unset_env_var("ATF_ARCH");
|
||||
unset_env_var("ATF_CONFDIR");
|
||||
unset_env_var("ATF_LIBEXECDIR");
|
||||
unset_env_var("ATF_MACHINE");
|
||||
unset_env_var("ATF_PKGDATADIR");
|
||||
unset_env_var("ATF_SHELL");
|
||||
unset_env_var("ATF_WORKDIR");
|
||||
atf::config::__reinit();
|
||||
ATF_CHECK(atf::config::get("atf_arch") != "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_confdir") != "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_libexecdir") != "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_machine") != "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_pkgdatadir") != "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_shell") != "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_workdir") != "env-value");
|
||||
|
||||
// Make sure empty values in the environment are not considered.
|
||||
set_env_var("ATF_ARCH", "");
|
||||
set_env_var("ATF_CONFDIR", "");
|
||||
set_env_var("ATF_LIBEXECDIR", "");
|
||||
set_env_var("ATF_MACHINE", "");
|
||||
set_env_var("ATF_PKGDATADIR", "");
|
||||
set_env_var("ATF_SHELL", "");
|
||||
set_env_var("ATF_WORKDIR", "");
|
||||
atf::config::__reinit();
|
||||
ATF_CHECK(!atf::config::get("atf_arch").empty());
|
||||
ATF_CHECK(!atf::config::get("atf_confdir").empty());
|
||||
ATF_CHECK(!atf::config::get("atf_libexecdir").empty());
|
||||
ATF_CHECK(!atf::config::get("atf_machine").empty());
|
||||
ATF_CHECK(!atf::config::get("atf_pkgdatadir").empty());
|
||||
ATF_CHECK(!atf::config::get("atf_shell").empty());
|
||||
ATF_CHECK(!atf::config::get("atf_workdir").empty());
|
||||
|
||||
// Check if the ATF_CONFDIR variable is recognized.
|
||||
set_env_var ("ATF_CONFDIR", "env-value");
|
||||
// Check if the ATF_ARCH variable is recognized.
|
||||
set_env_var ("ATF_ARCH", "env-value");
|
||||
unset_env_var("ATF_LIBEXECDIR");
|
||||
unset_env_var("ATF_MACHINE");
|
||||
unset_env_var("ATF_PKGDATADIR");
|
||||
unset_env_var("ATF_SHELL");
|
||||
unset_env_var("ATF_WORKDIR");
|
||||
atf::config::__reinit();
|
||||
ATF_CHECK_EQUAL(atf::config::get("atf_arch"), "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_confdir") != "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_libexecdir") != "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_machine") != "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_pkgdatadir") != "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_shell") != "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_workdir") != "env-value");
|
||||
|
||||
// Check if the ATF_CONFDIR variable is recognized.
|
||||
unset_env_var("ATF_ARCH");
|
||||
set_env_var ("ATF_CONFDIR", "env-value");
|
||||
unset_env_var("ATF_LIBEXECDIR");
|
||||
unset_env_var("ATF_MACHINE");
|
||||
unset_env_var("ATF_PKGDATADIR");
|
||||
unset_env_var("ATF_SHELL");
|
||||
unset_env_var("ATF_WORKDIR");
|
||||
atf::config::__reinit();
|
||||
ATF_CHECK(atf::config::get("atf_arch") != "env-value");
|
||||
ATF_CHECK_EQUAL(atf::config::get("atf_confdir"), "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_libexecdir") != "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_machine") != "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_pkgdatadir") != "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_shell") != "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_workdir") != "env-value");
|
||||
|
||||
// Check if the ATF_LIBEXECDIR variable is recognized.
|
||||
unset_env_var("ATF_ARCH");
|
||||
unset_env_var("ATF_CONFDIR");
|
||||
set_env_var ("ATF_LIBEXECDIR", "env-value");
|
||||
unset_env_var("ATF_MACHINE");
|
||||
unset_env_var("ATF_PKGDATADIR");
|
||||
unset_env_var("ATF_SHELL");
|
||||
unset_env_var("ATF_WORKDIR");
|
||||
atf::config::__reinit();
|
||||
ATF_CHECK(atf::config::get("atf_arch") != "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_confdir") != "env-value");
|
||||
ATF_CHECK_EQUAL(atf::config::get("atf_libexecdir"), "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_machine") != "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_pkgdatadir") != "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_shell") != "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_workdir") != "env-value");
|
||||
|
||||
// Check if the ATF_MACHINE variable is recognized.
|
||||
unset_env_var("ATF_ARCH");
|
||||
unset_env_var("ATF_CONFDIR");
|
||||
unset_env_var("ATF_LIBEXECDIR");
|
||||
set_env_var ("ATF_MACHINE", "env-value");
|
||||
unset_env_var("ATF_PKGDATADIR");
|
||||
unset_env_var("ATF_SHELL");
|
||||
unset_env_var("ATF_WORKDIR");
|
||||
atf::config::__reinit();
|
||||
ATF_CHECK(atf::config::get("atf_arch") != "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_confdir") != "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_libexecdir") != "env-value");
|
||||
ATF_CHECK_EQUAL(atf::config::get("atf_machine"), "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_pkgdatadir") != "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_shell") != "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_workdir") != "env-value");
|
||||
|
||||
// Check if the ATF_PKGDATADIR variable is recognized.
|
||||
unset_env_var("ATF_ARCH");
|
||||
unset_env_var("ATF_CONFDIR");
|
||||
unset_env_var("ATF_LIBEXECDIR");
|
||||
unset_env_var("ATF_MACHINE");
|
||||
set_env_var ("ATF_PKGDATADIR", "env-value");
|
||||
unset_env_var("ATF_SHELL");
|
||||
unset_env_var("ATF_WORKDIR");
|
||||
atf::config::__reinit();
|
||||
ATF_CHECK(atf::config::get("atf_arch") != "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_confdir") != "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_libexecdir") != "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_machine") != "env-value");
|
||||
ATF_CHECK_EQUAL(atf::config::get("atf_pkgdatadir"), "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_shell") != "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_workdir") != "env-value");
|
||||
|
||||
// Check if the ATF_SHELL variable is recognized.
|
||||
unset_env_var("ATF_ARCH");
|
||||
unset_env_var("ATF_CONFDIR");
|
||||
unset_env_var("ATF_LIBEXECDIR");
|
||||
unset_env_var("ATF_MACHINE");
|
||||
unset_env_var("ATF_PKGDATADIR");
|
||||
set_env_var ("ATF_SHELL", "env-value");
|
||||
unset_env_var("ATF_WORKDIR");
|
||||
atf::config::__reinit();
|
||||
ATF_CHECK(atf::config::get("atf_arch") != "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_confdir") != "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_libexecdir") != "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_machine") != "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_pkgdatadir") != "env-value");
|
||||
ATF_CHECK_EQUAL(atf::config::get("atf_shell"), "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_workdir") != "env-value");
|
||||
|
||||
// Check if the ATF_WORKDIR variable is recognized.
|
||||
unset_env_var("ATF_ARCH");
|
||||
unset_env_var("ATF_CONFDIR");
|
||||
unset_env_var("ATF_LIBEXECDIR");
|
||||
unset_env_var("ATF_MACHINE");
|
||||
unset_env_var("ATF_PKGDATADIR");
|
||||
unset_env_var("ATF_SHELL");
|
||||
set_env_var ("ATF_WORKDIR", "env-value");
|
||||
atf::config::__reinit();
|
||||
ATF_CHECK(atf::config::get("atf_arch") != "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_confdir") != "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_libexecdir") != "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_machine") != "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_pkgdatadir") != "env-value");
|
||||
ATF_CHECK(atf::config::get("atf_shell") != "env-value");
|
||||
ATF_CHECK_EQUAL(atf::config::get("atf_workdir"), "env-value");
|
||||
|
@ -179,9 +240,11 @@ ATF_TEST_CASE_BODY(get_all)
|
|||
|
||||
// Check that the valid variables, and only those, are returned.
|
||||
std::map< std::string, std::string > vars = atf::config::get_all();
|
||||
ATF_CHECK_EQUAL(vars.size(), 5);
|
||||
ATF_CHECK_EQUAL(vars.size(), 7);
|
||||
ATF_CHECK(vars.find("atf_arch") != vars.end());
|
||||
ATF_CHECK(vars.find("atf_confdir") != vars.end());
|
||||
ATF_CHECK(vars.find("atf_libexecdir") != vars.end());
|
||||
ATF_CHECK(vars.find("atf_machine") != vars.end());
|
||||
ATF_CHECK(vars.find("atf_pkgdatadir") != vars.end());
|
||||
ATF_CHECK(vars.find("atf_shell") != vars.end());
|
||||
ATF_CHECK(vars.find("atf_workdir") != vars.end());
|
||||
|
@ -197,15 +260,19 @@ ATF_TEST_CASE_BODY(has)
|
|||
atf::config::__reinit();
|
||||
|
||||
// Check for all the variables that must exist.
|
||||
ATF_CHECK(atf::config::has("atf_arch"));
|
||||
ATF_CHECK(atf::config::has("atf_confdir"));
|
||||
ATF_CHECK(atf::config::has("atf_libexecdir"));
|
||||
ATF_CHECK(atf::config::has("atf_machine"));
|
||||
ATF_CHECK(atf::config::has("atf_pkgdatadir"));
|
||||
ATF_CHECK(atf::config::has("atf_shell"));
|
||||
ATF_CHECK(atf::config::has("atf_workdir"));
|
||||
|
||||
// Same as above, but using uppercase (which is incorrect).
|
||||
ATF_CHECK(!atf::config::has("ATF_ARCH"));
|
||||
ATF_CHECK(!atf::config::has("ATF_CONFDIR"));
|
||||
ATF_CHECK(!atf::config::has("ATF_LIBEXECDIR"));
|
||||
ATF_CHECK(!atf::config::has("ATF_MACHINE"));
|
||||
ATF_CHECK(!atf::config::has("ATF_PKGDATADIR"));
|
||||
ATF_CHECK(!atf::config::has("ATF_SHELL"));
|
||||
ATF_CHECK(!atf::config::has("ATF_WORKDIR"));
|
||||
|
|
|
@ -0,0 +1,232 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// 1. Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// 3. All advertising materials mentioning features or use of this
|
||||
// software must display the following acknowledgement:
|
||||
// This product includes software developed by the NetBSD
|
||||
// Foundation, Inc. and its contributors.
|
||||
// 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
|
||||
// CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
// IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
// IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
|
||||
extern "C" {
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
}
|
||||
|
||||
#include <cerrno>
|
||||
|
||||
#include "atf/exceptions.hpp"
|
||||
#include "atf/macros.hpp"
|
||||
#include "atf/signals.hpp"
|
||||
|
||||
namespace sigusr1 {
|
||||
static bool happened = false;
|
||||
|
||||
static
|
||||
void
|
||||
handler(int signo)
|
||||
{
|
||||
happened = true;
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
program(void)
|
||||
{
|
||||
struct sigaction sa;
|
||||
sa.sa_handler = handler;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sa.sa_flags = 0;
|
||||
if (::sigaction(SIGUSR1, &sa, NULL) == -1)
|
||||
throw atf::system_error("sigusr1::program",
|
||||
"sigaction(2) failed", errno);
|
||||
}
|
||||
} // namespace sigusr1
|
||||
|
||||
namespace sigusr1_2 {
|
||||
static bool happened = false;
|
||||
|
||||
static
|
||||
void
|
||||
handler(int signo)
|
||||
{
|
||||
happened = true;
|
||||
}
|
||||
} // namespace sigusr1_2
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Tests for the "signal_holder" class.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
ATF_TEST_CASE(signal_holder_preserve);
|
||||
ATF_TEST_CASE_HEAD(signal_holder_preserve)
|
||||
{
|
||||
set("descr", "Tests that signal_holder preserves the original signal "
|
||||
"handler and restores it upon destruction");
|
||||
}
|
||||
ATF_TEST_CASE_BODY(signal_holder_preserve)
|
||||
{
|
||||
using atf::signals::signal_holder;
|
||||
|
||||
sigusr1::program();
|
||||
|
||||
sigusr1::happened = false;
|
||||
::kill(::getpid(), SIGUSR1);
|
||||
ATF_CHECK(sigusr1::happened);
|
||||
|
||||
{
|
||||
signal_holder hld(SIGUSR1);
|
||||
::kill(::getpid(), SIGUSR1);
|
||||
}
|
||||
|
||||
sigusr1::happened = false;
|
||||
::kill(::getpid(), SIGUSR1);
|
||||
ATF_CHECK(sigusr1::happened);
|
||||
}
|
||||
|
||||
ATF_TEST_CASE(signal_holder_destructor);
|
||||
ATF_TEST_CASE_HEAD(signal_holder_destructor)
|
||||
{
|
||||
set("descr", "Tests that signal_holder processes a pending signal "
|
||||
"upon destruction");
|
||||
}
|
||||
ATF_TEST_CASE_BODY(signal_holder_destructor)
|
||||
{
|
||||
using atf::signals::signal_holder;
|
||||
|
||||
sigusr1::program();
|
||||
|
||||
sigusr1::happened = false;
|
||||
::kill(::getpid(), SIGUSR1);
|
||||
ATF_CHECK(sigusr1::happened);
|
||||
|
||||
{
|
||||
signal_holder hld(SIGUSR1);
|
||||
|
||||
sigusr1::happened = false;
|
||||
::kill(::getpid(), SIGUSR1);
|
||||
ATF_CHECK(!sigusr1::happened);
|
||||
}
|
||||
ATF_CHECK(sigusr1::happened);
|
||||
}
|
||||
|
||||
ATF_TEST_CASE(signal_holder_process);
|
||||
ATF_TEST_CASE_HEAD(signal_holder_process)
|
||||
{
|
||||
set("descr", "Tests that signal_holder's process method works to "
|
||||
"process a delayed signal explicitly");
|
||||
}
|
||||
ATF_TEST_CASE_BODY(signal_holder_process)
|
||||
{
|
||||
using atf::signals::signal_holder;
|
||||
|
||||
sigusr1::program();
|
||||
|
||||
sigusr1::happened = false;
|
||||
::kill(::getpid(), SIGUSR1);
|
||||
ATF_CHECK(sigusr1::happened);
|
||||
|
||||
{
|
||||
signal_holder hld(SIGUSR1);
|
||||
|
||||
sigusr1::happened = false;
|
||||
::kill(::getpid(), SIGUSR1);
|
||||
ATF_CHECK(!sigusr1::happened);
|
||||
|
||||
hld.process();
|
||||
ATF_CHECK(sigusr1::happened);
|
||||
|
||||
sigusr1::happened = false;
|
||||
}
|
||||
ATF_CHECK(!sigusr1::happened);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Tests for the "signal_programmer" class.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
ATF_TEST_CASE(signal_programmer_program);
|
||||
ATF_TEST_CASE_HEAD(signal_programmer_program)
|
||||
{
|
||||
set("descr", "Tests that signal_programmer correctly installs a "
|
||||
"handler");
|
||||
}
|
||||
ATF_TEST_CASE_BODY(signal_programmer_program)
|
||||
{
|
||||
using atf::signals::signal_programmer;
|
||||
|
||||
signal_programmer sp(SIGUSR1, sigusr1_2::handler);
|
||||
|
||||
sigusr1_2::happened = false;
|
||||
::kill(::getpid(), SIGUSR1);
|
||||
ATF_CHECK(sigusr1_2::happened);
|
||||
}
|
||||
|
||||
ATF_TEST_CASE(signal_programmer_preserve);
|
||||
ATF_TEST_CASE_HEAD(signal_programmer_preserve)
|
||||
{
|
||||
set("descr", "Tests that signal_programmer uninstalls the handler "
|
||||
"during destruction");
|
||||
}
|
||||
ATF_TEST_CASE_BODY(signal_programmer_preserve)
|
||||
{
|
||||
using atf::signals::signal_programmer;
|
||||
|
||||
sigusr1::program();
|
||||
sigusr1::happened = false;
|
||||
|
||||
{
|
||||
signal_programmer sp(SIGUSR1, sigusr1_2::handler);
|
||||
|
||||
sigusr1_2::happened = false;
|
||||
::kill(::getpid(), SIGUSR1);
|
||||
ATF_CHECK(sigusr1_2::happened);
|
||||
}
|
||||
|
||||
ATF_CHECK(!sigusr1::happened);
|
||||
::kill(::getpid(), SIGUSR1);
|
||||
ATF_CHECK(sigusr1::happened);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Main.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
ATF_INIT_TEST_CASES(tcs)
|
||||
{
|
||||
// Add the tests for the "signal_holder" class.
|
||||
ATF_ADD_TEST_CASE(tcs, signal_holder_preserve);
|
||||
ATF_ADD_TEST_CASE(tcs, signal_holder_destructor);
|
||||
ATF_ADD_TEST_CASE(tcs, signal_holder_process);
|
||||
|
||||
// Add the tests for the "signal_programmer" class.
|
||||
ATF_ADD_TEST_CASE(tcs, signal_programmer_program);
|
||||
ATF_ADD_TEST_CASE(tcs, signal_programmer_preserve);
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
|
@ -252,6 +252,28 @@ ATF_TEST_CASE_BODY(to_string)
|
|||
ATF_CHECK_EQUAL(to_string("a"), "a");
|
||||
ATF_CHECK_EQUAL(to_string(5), "5");
|
||||
}
|
||||
#include <iostream>
|
||||
ATF_TEST_CASE(to_type);
|
||||
ATF_TEST_CASE_HEAD(to_type)
|
||||
{
|
||||
set("descr", "Tests the to_type function");
|
||||
}
|
||||
ATF_TEST_CASE_BODY(to_type)
|
||||
{
|
||||
using atf::text::to_type;
|
||||
|
||||
ATF_CHECK_EQUAL(to_type< int >("0"), 0);
|
||||
ATF_CHECK_EQUAL(to_type< int >("1234"), 1234);
|
||||
ATF_CHECK_THROW(to_type< int >("0 a"), std::runtime_error);
|
||||
ATF_CHECK_THROW(to_type< int >("a"), std::runtime_error);
|
||||
|
||||
ATF_CHECK_EQUAL(to_type< float >("0.5"), 0.5);
|
||||
ATF_CHECK_EQUAL(to_type< float >("1234.5"), 1234.5);
|
||||
ATF_CHECK_THROW(to_type< float >("0.5 a"), std::runtime_error);
|
||||
ATF_CHECK_THROW(to_type< float >("a"), std::runtime_error);
|
||||
|
||||
ATF_CHECK_EQUAL(to_type< std::string >("a"), "a");
|
||||
}
|
||||
|
||||
ATF_INIT_TEST_CASES(tcs)
|
||||
{
|
||||
|
@ -260,4 +282,5 @@ ATF_INIT_TEST_CASES(tcs)
|
|||
ATF_ADD_TEST_CASE(tcs, split_delims);
|
||||
ATF_ADD_TEST_CASE(tcs, trim);
|
||||
ATF_ADD_TEST_CASE(tcs, to_string);
|
||||
ATF_ADD_TEST_CASE(tcs, to_type);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
|
@ -35,10 +35,14 @@
|
|||
//
|
||||
|
||||
extern "C" {
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
}
|
||||
|
||||
#include <iostream>
|
||||
#include <set>
|
||||
|
||||
#include "atf/exceptions.hpp"
|
||||
#include "atf/macros.hpp"
|
||||
#include "atf/user.hpp"
|
||||
|
@ -47,6 +51,56 @@ extern "C" {
|
|||
// Test cases for the free functions.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
ATF_TEST_CASE(euid);
|
||||
ATF_TEST_CASE_HEAD(euid)
|
||||
{
|
||||
set("descr", "Tests the euid function");
|
||||
}
|
||||
ATF_TEST_CASE_BODY(euid)
|
||||
{
|
||||
using atf::user::euid;
|
||||
|
||||
ATF_CHECK_EQUAL(euid(), ::geteuid());
|
||||
}
|
||||
|
||||
ATF_TEST_CASE(is_member_of_group);
|
||||
ATF_TEST_CASE_HEAD(is_member_of_group)
|
||||
{
|
||||
set("descr", "Tests the is_member_of_group function");
|
||||
}
|
||||
ATF_TEST_CASE_BODY(is_member_of_group)
|
||||
{
|
||||
using atf::user::is_member_of_group;
|
||||
|
||||
std::set< gid_t > groups;
|
||||
gid_t maxgid = 0;
|
||||
{
|
||||
gid_t gids[NGROUPS_MAX];
|
||||
int ngids = ::getgroups(NGROUPS_MAX, gids);
|
||||
if (ngids == -1)
|
||||
ATF_FAIL("Call to ::getgroups failed");
|
||||
for (int i = 0; i < ngids; i++) {
|
||||
groups.insert(gids[i]);
|
||||
if (gids[i] > maxgid)
|
||||
maxgid = gids[i];
|
||||
}
|
||||
std::cout << "User belongs to " << ngids << " groups" << std::endl;
|
||||
std::cout << "Last GID is " << maxgid << std::endl;
|
||||
}
|
||||
|
||||
for (gid_t g = 0; g <= maxgid; g++) {
|
||||
if (groups.find(g) == groups.end()) {
|
||||
std::cout << "Checking if user does not belong to group "
|
||||
<< g << std::endl;
|
||||
ATF_CHECK(!is_member_of_group(g));
|
||||
} else {
|
||||
std::cout << "Checking if user belongs to group "
|
||||
<< g << std::endl;
|
||||
ATF_CHECK(is_member_of_group(g));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ATF_TEST_CASE(is_root);
|
||||
ATF_TEST_CASE_HEAD(is_root)
|
||||
{
|
||||
|
@ -86,6 +140,8 @@ ATF_TEST_CASE_BODY(is_unprivileged)
|
|||
ATF_INIT_TEST_CASES(tcs)
|
||||
{
|
||||
// Add the tests for the free functions.
|
||||
ATF_ADD_TEST_CASE(tcs, euid);
|
||||
ATF_ADD_TEST_CASE(tcs, is_member_of_group);
|
||||
ATF_ADD_TEST_CASE(tcs, is_root);
|
||||
ATF_ADD_TEST_CASE(tcs, is_unprivileged);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
|
@ -44,9 +44,9 @@
|
|||
// ------------------------------------------------------------------------
|
||||
|
||||
class test_array {
|
||||
int m_dummy;
|
||||
|
||||
public:
|
||||
int m_value;
|
||||
|
||||
static ssize_t m_nblocks;
|
||||
|
||||
void* operator new(size_t size)
|
||||
|
@ -208,6 +208,25 @@ ATF_TEST_CASE_BODY(auto_array_assign)
|
|||
ATF_CHECK_EQUAL(test_array::m_nblocks, 0);
|
||||
}
|
||||
|
||||
ATF_TEST_CASE(auto_array_access);
|
||||
ATF_TEST_CASE_HEAD(auto_array_access)
|
||||
{
|
||||
set("descr", "Tests the auto_array smart pointer class' access "
|
||||
"operator");
|
||||
}
|
||||
ATF_TEST_CASE_BODY(auto_array_access)
|
||||
{
|
||||
using atf::utils::auto_array;
|
||||
|
||||
auto_array< test_array > t(new test_array[10]);
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
t[i].m_value = i * 2;
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
ATF_CHECK_EQUAL(t[i].m_value, i * 2);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Main.
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -221,4 +240,5 @@ ATF_INIT_TEST_CASES(tcs)
|
|||
ATF_ADD_TEST_CASE(tcs, auto_array_release);
|
||||
ATF_ADD_TEST_CASE(tcs, auto_array_reset);
|
||||
ATF_ADD_TEST_CASE(tcs, auto_array_assign);
|
||||
ATF_ADD_TEST_CASE(tcs, auto_array_access);
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
#include "atf/application.hpp"
|
||||
|
||||
class h_app_empty : public atf::application {
|
||||
class h_app_empty : public atf::application::app {
|
||||
static const char* m_description;
|
||||
|
||||
public:
|
||||
|
@ -52,7 +52,7 @@ const char* h_app_empty::m_description =
|
|||
"on its own and redefines no methods.";
|
||||
|
||||
h_app_empty::h_app_empty(void) :
|
||||
application(m_description, "h_app_empty(1)")
|
||||
app(m_description, "h_app_empty(1)", "atf(7)")
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include "atf/application.hpp"
|
||||
#include "atf/sanity.hpp"
|
||||
|
||||
class h_app_opts_args : public atf::application {
|
||||
class h_app_opts_args : public atf::application::app {
|
||||
static const char* m_description;
|
||||
|
||||
std::string specific_args(void) const;
|
||||
|
@ -58,7 +58,7 @@ const char* h_app_opts_args::m_description =
|
|||
"methods to specify custom options and arguments.";
|
||||
|
||||
h_app_opts_args::h_app_opts_args(void) :
|
||||
application(m_description, "h_app_opts_args(1)")
|
||||
app(m_description, "h_app_opts_args(1)", "atf(7)")
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -73,6 +73,7 @@ h_app_opts_args::options_set
|
|||
h_app_opts_args::specific_options(void)
|
||||
const
|
||||
{
|
||||
using atf::application::option;
|
||||
options_set opts;
|
||||
opts.insert(option('d', "", "Debug mode"));
|
||||
opts.insert(option('v', "level", "Verbosity level"));
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Signature of the current package.
|
||||
m4_define([AT_PACKAGE_NAME], [Automated Testing Framework])
|
||||
m4_define([AT_PACKAGE_TARNAME], [atf])
|
||||
m4_define([AT_PACKAGE_VERSION], [0.3])
|
||||
m4_define([AT_PACKAGE_STRING], [Automated Testing Framework 0.3])
|
||||
m4_define([AT_PACKAGE_VERSION], [0.4])
|
||||
m4_define([AT_PACKAGE_STRING], [Automated Testing Framework 0.4])
|
||||
m4_define([AT_PACKAGE_BUGREPORT], [atf-devel@NetBSD.org])
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
dnl
|
||||
dnl Automated Testing Framework (atf)
|
||||
dnl
|
||||
dnl Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
dnl Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
dnl All rights reserved.
|
||||
dnl
|
||||
dnl Redistribution and use in source and binary forms, with or without
|
||||
|
@ -72,6 +72,12 @@ AT_CHECK([grep -- '-v given with argument foo' stdout], 0, [ignore], [])
|
|||
AT_CHECK([APP_HELPER(app_opts_args) -z], 1, [], [stderr])
|
||||
AT_CHECK([grep 'Unknown option.*-z' stderr], 0, [ignore], [])
|
||||
|
||||
dnl Check that option processing stops after an argument.
|
||||
AT_CHECK([APP_HELPER(app_opts_args) -- -d], 0, [stdout], [])
|
||||
AT_CHECK([grep -- '-d given' stdout], 1, [], [])
|
||||
AT_CHECK([APP_HELPER(app_opts_args) arg -d], 0, [stdout], [])
|
||||
AT_CHECK([grep -- '-d given' stdout], 1, [], [])
|
||||
|
||||
dnl Check that an application that does not redefine any method does
|
||||
dnl not show unexpected arguments in the usage message.
|
||||
AT_CHECK([APP_HELPER(app_empty) -h], 0, [stdout], [])
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
dnl
|
||||
dnl Automated Testing Framework (atf)
|
||||
dnl
|
||||
dnl Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
dnl Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
dnl All rights reserved.
|
||||
dnl
|
||||
dnl Redistribution and use in source and binary forms, with or without
|
||||
|
@ -37,8 +37,9 @@ dnl
|
|||
AT_SETUP([atf-config: querying of build-time variables])
|
||||
AT_TESTED(atf-config)
|
||||
|
||||
all_vars="atf_confdir atf_libexecdir atf_pkgdatadir atf_shell atf_workdir"
|
||||
all_vars_no=5
|
||||
all_vars="atf_arch atf_confdir atf_libexecdir atf_machine atf_pkgdatadir \
|
||||
atf_shell atf_workdir"
|
||||
all_vars_no=7
|
||||
|
||||
dnl List all variables.
|
||||
AT_CHECK([atf-config], [0], [stdout], [])
|
||||
|
|
|
@ -41,7 +41,9 @@ dnl XXX The 9 number used below is a hack used to simplify these tests.
|
|||
dnl The correct fix could be to make the auxiliary test programs be real
|
||||
dnl test programs instead of two-liners creted from here.
|
||||
|
||||
m4_define([CREATE_PASS_TEST], [AT_DATA([$1],[#! /bin/sh
|
||||
m4_define([CREATE_PASS_TEST],
|
||||
[cat >$1 <<EOF
|
||||
#! @S|@(atf-config -t atf_shell)
|
||||
echo "Content-Type: application/X-atf-tcs; version=\"1\"" >&9
|
||||
echo "" >&9
|
||||
echo 'tcs-count: 1' >&9
|
||||
|
@ -50,11 +52,13 @@ echo ignore-me
|
|||
echo ignore-me >&2
|
||||
echo 'tc-end: $2, passed' >&9
|
||||
true
|
||||
])
|
||||
EOF
|
||||
AT_CHECK([chmod +x $1], [0], [], [])
|
||||
])
|
||||
|
||||
m4_define([CREATE_FAIL_TEST], [AT_DATA([$1],[#! /bin/sh
|
||||
m4_define([CREATE_FAIL_TEST],
|
||||
[cat >$1 <<EOF
|
||||
#! @S|@(atf-config -t atf_shell)
|
||||
echo "Content-Type: application/X-atf-tcs; version=\"1\"" >&9
|
||||
echo "" >&9
|
||||
echo 'tcs-count: 1' >&9
|
||||
|
@ -63,7 +67,7 @@ echo ignore-me
|
|||
echo ignore-me >&2
|
||||
echo 'tc-end: $2, failed, No reason' >&9
|
||||
false
|
||||
])
|
||||
EOF
|
||||
AT_CHECK([chmod +x $1], [0], [], [])
|
||||
])
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1 @@
|
|||
#include <atf/signals.hpp>
|
|
@ -0,0 +1,75 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// 1. Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// 3. All advertising materials mentioning features or use of this
|
||||
// software must display the following acknowledgement:
|
||||
// This product includes software developed by the NetBSD
|
||||
// Foundation, Inc. and its contributors.
|
||||
// 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
|
||||
// CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
// IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
// IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include <atf/macros.hpp>
|
||||
|
||||
void
|
||||
atf_check_inside_if(void)
|
||||
{
|
||||
// Make sure that ATF_CHECK can be used inside an if statement that
|
||||
// does not have braces. Earlier versions of it generated an error
|
||||
// if there was an else clause because they confused the compiler
|
||||
// by defining an unprotected nested if.
|
||||
if (true)
|
||||
ATF_CHECK(true);
|
||||
else
|
||||
ATF_CHECK(true);
|
||||
}
|
||||
|
||||
void
|
||||
atf_check_equal_inside_if(void)
|
||||
{
|
||||
// Make sure that ATF_CHECK_EQUAL can be used inside an if statement
|
||||
// that does not have braces. Earlier versions of it generated an
|
||||
// error if there was an else clause because they confused the
|
||||
// compiler by defining an unprotected nested if.
|
||||
if (true)
|
||||
ATF_CHECK_EQUAL(true, true);
|
||||
else
|
||||
ATF_CHECK_EQUAL(true, true);
|
||||
}
|
||||
|
||||
void
|
||||
atf_check_throw_runtime_error(void)
|
||||
{
|
||||
// Check that we can pass std::runtime_error to ATF_CHECK_THROW.
|
||||
// Earlier versions generated a warning because the macro's code also
|
||||
// attempted to capture this exception, and thus we had a duplicate
|
||||
// catch clause.
|
||||
ATF_CHECK_THROW((void)0, std::runtime_error);
|
||||
}
|
|
@ -41,7 +41,7 @@
|
|||
#include "atf/fs.hpp"
|
||||
#include "atf/ui.hpp"
|
||||
|
||||
class atf_cleanup : public atf::application {
|
||||
class atf_cleanup : public atf::application::app {
|
||||
static const char* m_description;
|
||||
|
||||
std::string specific_args(void) const;
|
||||
|
@ -58,7 +58,7 @@ const char* atf_cleanup::m_description =
|
|||
"recurse into them if the unmounting fails.";
|
||||
|
||||
atf_cleanup::atf_cleanup(void) :
|
||||
application(m_description, "atf-cleanup(1)")
|
||||
app(m_description, "atf-cleanup(1)", "atf(7)")
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
|
@ -60,7 +60,7 @@ cat_file(std::ostream& os, const std::string& path)
|
|||
is.close();
|
||||
}
|
||||
|
||||
class atf_compile : public atf::application {
|
||||
class atf_compile : public atf::application::app {
|
||||
static const char* m_description;
|
||||
|
||||
std::string m_outfile;
|
||||
|
@ -82,7 +82,7 @@ const char* atf_compile::m_description =
|
|||
"POSIX shell language, generating an executable.";
|
||||
|
||||
atf_compile::atf_compile(void) :
|
||||
application(m_description, "atf-compile(1)")
|
||||
app(m_description, "atf-compile(1)", "atf(7)")
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -97,6 +97,7 @@ atf_compile::options_set
|
|||
atf_compile::specific_options(void)
|
||||
const
|
||||
{
|
||||
using atf::application::option;
|
||||
options_set opts;
|
||||
opts.insert(option('o', "out-file", "Name of the output file"));
|
||||
return opts;
|
||||
|
@ -121,7 +122,6 @@ atf_compile::compile(std::ostream& os)
|
|||
os << "#! " << atf::config::get("atf_shell") << std::endl;
|
||||
cat_file(os, atf::config::get("atf_pkgdatadir") + "/atf.init.subr");
|
||||
os << std::endl;
|
||||
os << ". ${Atf_Pkgdatadir}/atf.config.subr" << std::endl;
|
||||
os << ". ${Atf_Pkgdatadir}/atf.header.subr" << std::endl;
|
||||
os << std::endl;
|
||||
for (int i = 0; i < m_argc; i++) {
|
||||
|
@ -137,10 +137,10 @@ int
|
|||
atf_compile::main(void)
|
||||
{
|
||||
if (m_argc < 1)
|
||||
throw atf::usage_error("No test program specified");
|
||||
throw atf::application::usage_error("No test program specified");
|
||||
|
||||
if (m_outfile.empty())
|
||||
throw atf::usage_error("No output file specified");
|
||||
throw atf::application::usage_error("No output file specified");
|
||||
|
||||
std::ofstream os(m_outfile.c_str());
|
||||
if (!os)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\"
|
||||
.\" Automated Testing Framework (atf)
|
||||
.\"
|
||||
.\" Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
.\" Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
|
@ -33,7 +33,7 @@
|
|||
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd August 18, 2007
|
||||
.Dd January 4, 2008
|
||||
.Dt ATF-CONFIG 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -82,12 +82,24 @@ per line, without the variable names.
|
|||
The following list describes all the variables that are part of ATF's
|
||||
static configuration:
|
||||
.Bl -tag -width atfXpkgdatadirXX
|
||||
.It Va atf_arch
|
||||
The architecture name detected by ATF.
|
||||
This is derived from
|
||||
.Va atf_machine
|
||||
because it is a subset of it.
|
||||
Given that this name might be misdetected, it is provided to the user
|
||||
as a configuration variable so that he can fix its value temporarily
|
||||
until a real fix is incorporated into mainstream sources.
|
||||
.It Va atf_confdir
|
||||
The path to the directory that contains the system-wide configuration
|
||||
files for ATF.
|
||||
.It Va atf_libexecdir
|
||||
The path to the directory that contains the auxiliary utilities of ATF,
|
||||
used internally by the public tools.
|
||||
.It Va atf_machine
|
||||
The machine type name detected by ATF.
|
||||
This should not be tunable but is provided for symmetry with
|
||||
.Va atf_arch .
|
||||
.It Va atf_pkgdatadir
|
||||
The path to the directory that contains the files that form the ATF's
|
||||
shell-scripting library.
|
||||
|
@ -106,12 +118,18 @@ except that the name is all composed of uppercase letters.
|
|||
.Pp
|
||||
The recognized environment variables are:
|
||||
.Bl -tag -width ATFXPKGDATADIRXX
|
||||
.It Ev ATF_ARCH
|
||||
Overrides the built-in value of
|
||||
.Va atf_arch .
|
||||
.It Ev ATF_CONFDIR
|
||||
Overrides the built-in value of
|
||||
.Va atf_confdir .
|
||||
.It Ev ATF_LIBEXECDIR
|
||||
Overrides the built-in value of
|
||||
.Va atf_libexecdir .
|
||||
.It Ev ATF_MACHINE
|
||||
Overrides the built-in value of
|
||||
.Va atf_machine .
|
||||
.It Ev ATF_PKGDATADIR
|
||||
Overrides the built-in value of
|
||||
.Va atf_pkgdatadir .
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include "atf/config.hpp"
|
||||
#include "atf/sanity.hpp"
|
||||
|
||||
class atf_config : public atf::application {
|
||||
class atf_config : public atf::application::app {
|
||||
static const char* m_description;
|
||||
|
||||
bool m_tflag;
|
||||
|
@ -67,7 +67,7 @@ const char* atf_config::m_description =
|
|||
"internal atf files are installed.";
|
||||
|
||||
atf_config::atf_config(void) :
|
||||
application(m_description, "atf-config(1)"),
|
||||
app(m_description, "atf-config(1)", "atf(7)"),
|
||||
m_tflag(false)
|
||||
{
|
||||
}
|
||||
|
@ -96,6 +96,7 @@ atf_config::options_set
|
|||
atf_config::specific_options(void)
|
||||
const
|
||||
{
|
||||
using atf::application::option;
|
||||
options_set opts;
|
||||
opts.insert(option('t', "", "Terse output: show values only"));
|
||||
return opts;
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
.\"
|
||||
.\" Automated Testing Framework (atf)
|
||||
.\"
|
||||
.\" Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. All advertising materials mentioning features or use of this
|
||||
.\" software must display the following acknowledgement:
|
||||
.\" This product includes software developed by the NetBSD
|
||||
.\" Foundation, Inc. and its contributors.
|
||||
.\" 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
.\" contributors may be used to endorse or promote products derived
|
||||
.\" from this software without specific prior written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
|
||||
.\" CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
.\" IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd January 25, 2008
|
||||
.Dt ATF-EXEC 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm atf-exec
|
||||
.Nd executes a command after modifying settings in its container process
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Fl g
|
||||
.Ar command
|
||||
.Nm
|
||||
.Fl h
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
is a wrapper that executes the given command after doing some additional
|
||||
tasks.
|
||||
These tasks involve modifying the properties of the process that will run
|
||||
the command that cannot be changed with regular system tools.
|
||||
.Pp
|
||||
In the first synopsis form,
|
||||
.Nm
|
||||
will execute the provided command after applying the changes requested by
|
||||
the options to its environment.
|
||||
If no additional options are given, the command is executed as if
|
||||
.Nm
|
||||
had not been used.
|
||||
.Pp
|
||||
In the second synopsis form,
|
||||
.Nm
|
||||
will print information about all supported options and their purpose.
|
||||
.Pp
|
||||
The following options are available:
|
||||
.Bl -tag -width XgXX
|
||||
.It Fl g
|
||||
Configures the process to become a new process group leader.
|
||||
.It Fl h
|
||||
Shows a short summary of all available options and their purpose.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr atf-killpg 1 ,
|
||||
.Xr atf 7
|
|
@ -0,0 +1,151 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// 1. Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// 3. All advertising materials mentioning features or use of this
|
||||
// software must display the following acknowledgement:
|
||||
// This product includes software developed by the NetBSD
|
||||
// Foundation, Inc. and its contributors.
|
||||
// 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
|
||||
// CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
// IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
// IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
|
||||
extern "C" {
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
}
|
||||
|
||||
#include <cerrno>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
|
||||
#include "atf/application.hpp"
|
||||
#include "atf/exceptions.hpp"
|
||||
#include "atf/sanity.hpp"
|
||||
#include "atf/text.hpp"
|
||||
|
||||
class atf_exec : public atf::application::app {
|
||||
static const char* m_description;
|
||||
|
||||
std::string specific_args(void) const;
|
||||
options_set specific_options(void) const;
|
||||
void process_option(int, const char*);
|
||||
|
||||
bool m_pgid;
|
||||
|
||||
public:
|
||||
atf_exec(void);
|
||||
|
||||
int main(void);
|
||||
};
|
||||
|
||||
const char* atf_exec::m_description =
|
||||
"atf-exec executes the given command after modifying its environment "
|
||||
"in different ways.";
|
||||
|
||||
atf_exec::atf_exec(void) :
|
||||
app(m_description, "atf-exec(1)", "atf(7)"),
|
||||
m_pgid(false)
|
||||
{
|
||||
}
|
||||
|
||||
std::string
|
||||
atf_exec::specific_args(void)
|
||||
const
|
||||
{
|
||||
return "<command>";
|
||||
}
|
||||
|
||||
atf_exec::options_set
|
||||
atf_exec::specific_options(void)
|
||||
const
|
||||
{
|
||||
using atf::application::option;
|
||||
options_set opts;
|
||||
opts.insert(option('g', "", "Creates a new process group under which "
|
||||
"to run the command"));
|
||||
return opts;
|
||||
}
|
||||
|
||||
void
|
||||
atf_exec::process_option(int ch, const char* arg)
|
||||
{
|
||||
switch (ch) {
|
||||
case 'g':
|
||||
m_pgid = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
UNREACHABLE;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
atf_exec::main(void)
|
||||
{
|
||||
if (m_argc < 1)
|
||||
throw atf::application::usage_error("No command specified");
|
||||
|
||||
if (m_pgid) {
|
||||
if (::setpgid(::getpid(), 0) == -1)
|
||||
throw atf::system_error("main", "setpgid failed", errno);
|
||||
}
|
||||
|
||||
int exitcode = EXIT_FAILURE;
|
||||
|
||||
pid_t pid = ::fork();
|
||||
if (pid == 0) {
|
||||
char** argv = new char*[m_argc + 1];
|
||||
for (int i = 0; i < m_argc; i++)
|
||||
argv[i] = ::strdup(m_argv[i]);
|
||||
argv[m_argc] = NULL;
|
||||
|
||||
::execvp(m_argv[0], argv);
|
||||
return EXIT_FAILURE;
|
||||
} else {
|
||||
int status;
|
||||
if (::waitpid(pid, &status, 0) != pid)
|
||||
throw atf::system_error("main", "waitpid failed", errno);
|
||||
if (WIFEXITED(status))
|
||||
exitcode = WEXITSTATUS(status);
|
||||
else if (WIFSIGNALED(status))
|
||||
::kill(0, WTERMSIG(status));
|
||||
else
|
||||
UNREACHABLE;
|
||||
}
|
||||
|
||||
return exitcode;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char* const* argv)
|
||||
{
|
||||
return atf_exec().run(argc, argv);
|
||||
}
|
|
@ -42,7 +42,7 @@
|
|||
#include "atf/sanity.hpp"
|
||||
#include "atf/ui.hpp"
|
||||
|
||||
class atf_format : public atf::application {
|
||||
class atf_format : public atf::application::app {
|
||||
static const char* m_description;
|
||||
|
||||
size_t m_length;
|
||||
|
@ -66,7 +66,7 @@ const char* atf_format::m_description =
|
|||
"line is treated as a different paragraph.";
|
||||
|
||||
atf_format::atf_format(void) :
|
||||
application(m_description, "atf-format(1)"),
|
||||
app(m_description, "atf-format(1)", "atf(7)"),
|
||||
m_length(0),
|
||||
m_repeat(false)
|
||||
{
|
||||
|
@ -112,6 +112,7 @@ atf_format::options_set
|
|||
atf_format::specific_options(void)
|
||||
const
|
||||
{
|
||||
using atf::application::option;
|
||||
options_set opts;
|
||||
opts.insert(option('l', "length", "Tag length"));
|
||||
opts.insert(option('r', "", "Repeat tag on each line"));
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# Automated Testing Framework (atf)
|
||||
#
|
||||
# Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
# Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
|
@ -76,7 +76,6 @@ main()
|
|||
echo "#! ${Atf_Shell}" >${tfile}
|
||||
cat ${Atf_Pkgdatadir}/atf.init.subr >>${tfile}
|
||||
echo >>${tfile}
|
||||
echo '. ${Atf_Pkgdatadir}/atf.config.subr' >>${tfile}
|
||||
echo '. ${Atf_Pkgdatadir}/atf.header.subr' >>${tfile}
|
||||
echo >>${tfile}
|
||||
cat ${sfiles} >>${tfile}
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
.\"
|
||||
.\" Automated Testing Framework (atf)
|
||||
.\"
|
||||
.\" Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. All advertising materials mentioning features or use of this
|
||||
.\" software must display the following acknowledgement:
|
||||
.\" This product includes software developed by the NetBSD
|
||||
.\" Foundation, Inc. and its contributors.
|
||||
.\" 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
.\" contributors may be used to endorse or promote products derived
|
||||
.\" from this software without specific prior written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
|
||||
.\" CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
.\" IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd January 25, 2008
|
||||
.Dt ATF-KILLPG 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm atf-killpg
|
||||
.Nd sends a signal to a process group
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl s Ar signal
|
||||
.Ar pgid
|
||||
.Nm
|
||||
.Fl h
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
sends a signal to a process group.
|
||||
.Pp
|
||||
In the first synopsis form,
|
||||
.Nm
|
||||
will send the specified signal to the given process group.
|
||||
If the signal is not provided through the
|
||||
.Fl s
|
||||
flag,
|
||||
.Sq SIGTERM
|
||||
will be send instead.
|
||||
.Pp
|
||||
In the second synopsis form,
|
||||
.Nm
|
||||
will print information about all supported options and their purpose.
|
||||
.Pp
|
||||
The following options are available:
|
||||
.Bl -tag -width XsXsignalXX
|
||||
.It Fl h
|
||||
Shows a short summary of all available options and their purpose.
|
||||
.It Fl s Ar signal
|
||||
The numerical signal to send; defaults to
|
||||
.Sq SIGTERM .
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr atf-exec 1 ,
|
||||
.Xr atf 7
|
|
@ -0,0 +1,123 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// 1. Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// 3. All advertising materials mentioning features or use of this
|
||||
// software must display the following acknowledgement:
|
||||
// This product includes software developed by the NetBSD
|
||||
// Foundation, Inc. and its contributors.
|
||||
// 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
|
||||
// CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
// IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
// IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
|
||||
extern "C" {
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
}
|
||||
|
||||
#include <cerrno>
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
|
||||
#include "atf/application.hpp"
|
||||
#include "atf/exceptions.hpp"
|
||||
#include "atf/sanity.hpp"
|
||||
#include "atf/text.hpp"
|
||||
|
||||
class atf_killpg : public atf::application::app {
|
||||
static const char* m_description;
|
||||
|
||||
int m_signo;
|
||||
|
||||
std::string specific_args(void) const;
|
||||
options_set specific_options(void) const;
|
||||
void process_option(int, const char*);
|
||||
|
||||
public:
|
||||
atf_killpg(void);
|
||||
|
||||
int main(void);
|
||||
};
|
||||
|
||||
const char* atf_killpg::m_description =
|
||||
"atf-killpg sends a signal to a process group.";
|
||||
|
||||
atf_killpg::atf_killpg(void) :
|
||||
app(m_description, "atf-killpg(1)", "atf(7)"),
|
||||
m_signo(SIGTERM)
|
||||
{
|
||||
}
|
||||
|
||||
std::string
|
||||
atf_killpg::specific_args(void)
|
||||
const
|
||||
{
|
||||
return "<pid>";
|
||||
}
|
||||
|
||||
atf_killpg::options_set
|
||||
atf_killpg::specific_options(void)
|
||||
const
|
||||
{
|
||||
using atf::application::option;
|
||||
options_set opts;
|
||||
opts.insert(option('s', "signal",
|
||||
"The signal to send to processes (default SIGTERM)"));
|
||||
return opts;
|
||||
}
|
||||
|
||||
void
|
||||
atf_killpg::process_option(int ch, const char* arg)
|
||||
{
|
||||
switch (ch) {
|
||||
case 's':
|
||||
m_signo = atf::text::to_type< int >(arg);
|
||||
break;
|
||||
|
||||
default:
|
||||
UNREACHABLE;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
atf_killpg::main(void)
|
||||
{
|
||||
if (m_argc < 1)
|
||||
throw atf::application::usage_error("No PID specified");
|
||||
|
||||
pid_t pid = atf::text::to_type< pid_t >(m_argv[0]);
|
||||
if (::killpg(pid, m_signo) == -1)
|
||||
throw atf::system_error("main", "killpg failed", errno);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char* const* argv)
|
||||
{
|
||||
return atf_killpg().run(argc, argv);
|
||||
}
|
|
@ -566,7 +566,7 @@ public:
|
|||
// The "atf_report" class.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
class atf_report : public atf::application {
|
||||
class atf_report : public atf::application::app {
|
||||
static const char* m_description;
|
||||
|
||||
typedef std::pair< std::string, atf::fs::path > fmt_path_pair;
|
||||
|
@ -586,7 +586,7 @@ const char* atf_report::m_description =
|
|||
"generates user-friendly reports in multiple different formats.";
|
||||
|
||||
atf_report::atf_report(void) :
|
||||
application(m_description, "atf-report(1)")
|
||||
app(m_description, "atf-report(1)", "atf(7)")
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -617,6 +617,7 @@ atf_report::options_set
|
|||
atf_report::specific_options(void)
|
||||
const
|
||||
{
|
||||
using atf::application::option;
|
||||
options_set opts;
|
||||
opts.insert(option('o', "fmt:path", "Adds a new output file; multiple "
|
||||
"ones can be specified, and a - "
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
|
@ -198,7 +198,7 @@ merge_maps(std::map< K, V >& dest, const std::map< K, V >& src)
|
|||
dest[(*iter).first] = (*iter).second;
|
||||
}
|
||||
|
||||
class atf_run : public atf::application {
|
||||
class atf_run : public atf::application::app {
|
||||
static const char* m_description;
|
||||
|
||||
atf::tests::vars_map m_atffile_vars;
|
||||
|
@ -246,7 +246,7 @@ const char* atf_run::m_description =
|
|||
"results.";
|
||||
|
||||
atf_run::atf_run(void) :
|
||||
application(m_description, "atf-run(1)")
|
||||
app(m_description, "atf-run(1)", "atf(7)")
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -278,6 +278,7 @@ atf_run::options_set
|
|||
atf_run::specific_options(void)
|
||||
const
|
||||
{
|
||||
using atf::application::option;
|
||||
options_set opts;
|
||||
opts.insert(option('v', "var=value", "Sets the configuration variable "
|
||||
"`var' to `value'; overrides "
|
||||
|
@ -365,12 +366,12 @@ atf_run::run_test_program_child(const atf::fs::path& tp,
|
|||
// do not care to release it. We are going to die anyway very soon,
|
||||
// either due to exec(2) or to exit(3).
|
||||
std::vector< std::string > confargs = conf_args();
|
||||
char* args[4 + confargs.size()];
|
||||
char** args = new char*[4 + confargs.size()];
|
||||
{
|
||||
// 0: Program name.
|
||||
const char* name = tp.leaf_name().c_str();
|
||||
args[0] = new char[std::strlen(name) + 1];
|
||||
std::strcpy(args[0], name);
|
||||
std::string progname = tp.leaf_name();
|
||||
args[0] = new char[progname.length() + 1];
|
||||
std::strcpy(args[0], progname.c_str());
|
||||
|
||||
// 1: The file descriptor to which the results will be printed.
|
||||
args[1] = new char[4];
|
||||
|
@ -455,7 +456,7 @@ atf_run::run_test_program_parent(const atf::fs::path& tp,
|
|||
}
|
||||
|
||||
int code, status;
|
||||
if (::waitpid(pid, &status, 0) == -1) {
|
||||
if (::waitpid(pid, &status, 0) != pid) {
|
||||
m.finalize("waitpid(2) on the child process " +
|
||||
atf::text::to_string(pid) + " failed" +
|
||||
(fmterr.empty() ? "" : (". " + fmterr)));
|
||||
|
@ -478,11 +479,6 @@ atf_run::run_test_program_parent(const atf::fs::path& tp,
|
|||
atf::text::to_string(WTERMSIG(status)) +
|
||||
(WCOREDUMP(status) ? " (core dumped)" : "") +
|
||||
(fmterr.empty() ? "" : (". " + fmterr)));
|
||||
} else if (WIFSTOPPED(status)) {
|
||||
code = EXIT_FAILURE;
|
||||
m.finalize("Test program stopped due to signal " +
|
||||
atf::text::to_string(WSTOPSIG(status)) +
|
||||
(fmterr.empty() ? "" : (". " + fmterr)));
|
||||
} else
|
||||
throw std::runtime_error
|
||||
("Child process " + atf::text::to_string(pid) +
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#include "atf/application.hpp"
|
||||
#include "atf/ui.hpp"
|
||||
|
||||
class atf_version : public atf::application {
|
||||
class atf_version : public atf::application::app {
|
||||
static const char* m_description;
|
||||
|
||||
public:
|
||||
|
@ -59,7 +59,7 @@ const char* atf_version::m_description =
|
|||
"installed version of ATF.";
|
||||
|
||||
atf_version::atf_version(void) :
|
||||
application(m_description, "atf-version(1)")
|
||||
app(m_description, "atf-version(1)", "atf(7)")
|
||||
{
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue