mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-13 21:40:00 -04:00
4870. [test] Update included ATF library to atf-0.21 preserving
the ATF tool. [RT #46967]
(cherry picked from commit 23d77c8747)
This commit is contained in:
parent
2cf0fe3b80
commit
4a53e3c2b8
313 changed files with 25977 additions and 15705 deletions
3
CHANGES
3
CHANGES
|
|
@ -1,3 +1,6 @@
|
|||
4870. [test] Update included ATF library to atf-0.21 preserving
|
||||
the ATF tool. [RT #46967]
|
||||
|
||||
4869. [bug] Address some cases where NULL with zero length could
|
||||
be passed to memmove which is undefined behaviour and
|
||||
can lead to bad optimisation. [RT #46888]
|
||||
|
|
|
|||
19
unit/atf-src/.travis.yml
Normal file
19
unit/atf-src/.travis.yml
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
language: cpp
|
||||
|
||||
compiler:
|
||||
- gcc
|
||||
- clang
|
||||
|
||||
before_install:
|
||||
- ./admin/travis-install-deps.sh
|
||||
|
||||
env:
|
||||
- AS_ROOT=no
|
||||
- AS_ROOT=yes
|
||||
|
||||
script:
|
||||
- ./admin/travis-build.sh
|
||||
|
||||
notifications:
|
||||
email:
|
||||
- atf-log@googlegroups.com
|
||||
|
|
@ -7,6 +7,4 @@ tp: atf-c++
|
|||
tp: atf-sh
|
||||
tp: test-programs
|
||||
|
||||
tp-glob: atf-config*
|
||||
tp-glob: atf-report*
|
||||
tp-glob: atf-run*
|
||||
tp-glob: tools*
|
||||
|
|
|
|||
|
|
@ -7,12 +7,6 @@ include("atf-c++/Kyuafile")
|
|||
include("atf-sh/Kyuafile")
|
||||
include("test-programs/Kyuafile")
|
||||
|
||||
if fs.exists("atf-config/Kyuafile") then
|
||||
include("atf-config/Kyuafile")
|
||||
end
|
||||
if fs.exists("atf-report/Kyuafile") then
|
||||
include("atf-report/Kyuafile")
|
||||
end
|
||||
if fs.exists("atf-run/Kyuafile") then
|
||||
include("atf-run/Kyuafile")
|
||||
if fs.exists("tools/Kyuafile") then
|
||||
include("tools/Kyuafile")
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
#
|
||||
# Automated Testing Framework (atf)
|
||||
#
|
||||
# Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
|
|
@ -25,11 +22,11 @@
|
|||
# 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_aclocal_DATA =
|
||||
BUILT_SOURCES =
|
||||
CLEANFILES =
|
||||
DIST_HOOKS =
|
||||
EXTRA_DIST =
|
||||
bin_PROGRAMS =
|
||||
dist_man_MANS =
|
||||
|
|
@ -54,10 +51,7 @@ include doc/Makefile.am.inc
|
|||
include test-programs/Makefile.am.inc
|
||||
|
||||
if ENABLE_TOOLS
|
||||
include atf-report/Makefile.am.inc
|
||||
include atf-config/Makefile.am.inc
|
||||
include atf-run/Makefile.am.inc
|
||||
include atf-version/Makefile.am.inc
|
||||
include tools/Makefile.am.inc
|
||||
endif
|
||||
|
||||
#
|
||||
|
|
@ -75,6 +69,10 @@ EXTRA_DIST += $(doc_DATA) INSTALL README
|
|||
TESTS_ENVIRONMENT = PATH=$(prefix)/bin:$${PATH} \
|
||||
PKG_CONFIG_PATH=$(prefix)/lib/pkgconfig
|
||||
|
||||
# Allow the caller to override the configuration file to passed to our
|
||||
# test runs below.
|
||||
KYUA_TEST_CONFIG_FILE = none
|
||||
|
||||
testsdir = $(exec_prefix)/tests
|
||||
pkgtestsdir = $(testsdir)/$(PACKAGE)
|
||||
|
||||
|
|
@ -105,7 +103,8 @@ if !ENABLE_TOOLS
|
|||
INSTALLCHECK_TARGETS += installcheck-kyua
|
||||
endif
|
||||
installcheck-kyua:
|
||||
cd $(pkgtestsdir) && $(TESTS_ENVIRONMENT) $(KYUA) test
|
||||
cd $(pkgtestsdir) && $(TESTS_ENVIRONMENT) \
|
||||
$(KYUA) --config='$(KYUA_TEST_CONFIG_FILE)' test
|
||||
endif
|
||||
|
||||
installcheck-local: $(INSTALLCHECK_TARGETS)
|
||||
|
|
@ -117,16 +116,20 @@ endif
|
|||
EXTRA_DIST += $(pkgtests_DATA)
|
||||
|
||||
BUILD_SH_TP = \
|
||||
echo "Creating $${dst}"; \
|
||||
echo "\#! $(bindir)/atf-sh" >$${dst}; \
|
||||
cat $${src} >>$${dst}; \
|
||||
chmod +x $${dst}
|
||||
test -d "$$(dirname "$${dst}")" || mkdir -p "$$(dirname "$${dst}")"; \
|
||||
echo "\#! $(bindir)/atf-sh" >"$${dst}"; \
|
||||
if [ -n "$${substs}" ]; then \
|
||||
cat $${src} | sed $${substs} >>"$${dst}"; \
|
||||
else \
|
||||
cat $${src} >>"$${dst}"; \
|
||||
fi; \
|
||||
chmod +x "$${dst}"
|
||||
|
||||
#
|
||||
# Custom targets.
|
||||
#
|
||||
|
||||
dist-hook: forbid-dist
|
||||
DIST_HOOKS += forbid-dist
|
||||
if ENABLE_TOOLS
|
||||
forbid-dist:
|
||||
@true
|
||||
|
|
@ -141,14 +144,16 @@ PHONY_TARGETS += clean-all
|
|||
clean-all:
|
||||
GIT="$(GIT)" $(SH) $(srcdir)/admin/clean-all.sh
|
||||
|
||||
PHONY_TARGETS += release
|
||||
release:
|
||||
$(SH) $(srcdir)/admin/release.sh $(PACKAGE_VERSION) $(DIST_ARCHIVES)
|
||||
|
||||
PHONY_TARGETS += release-test
|
||||
release-test:
|
||||
$(SH) $(srcdir)/admin/release-test.sh $(DIST_ARCHIVES)
|
||||
|
||||
.PHONY: $(PHONY_TARGETS)
|
||||
|
||||
# TODO(jmmv): Remove after atf 0.22.
|
||||
install-data-hook:
|
||||
cd $(DESTDIR)$(man3dir) && \
|
||||
for binding in c c++ sh; do \
|
||||
rm -f "atf-$${binding}-api.3"; \
|
||||
$(LN_S) "atf-$${binding}.3" "atf-$${binding}-api.3"; \
|
||||
done
|
||||
|
||||
dist-hook: $(DIST_HOOKS)
|
||||
|
||||
# vim: syntax=make:noexpandtab:shiftwidth=8:softtabstop=8
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,6 +1,112 @@
|
|||
Major changes between releases Automated Testing Framework
|
||||
===========================================================================
|
||||
|
||||
Changes in version 0.21
|
||||
***********************
|
||||
|
||||
Released on October 23rd, 2014.
|
||||
|
||||
* Restored the atf(7) manual page to serve as a reference to all the other
|
||||
manual pages shipped by ATF.
|
||||
|
||||
* Added the -s flag to atf-sh to support specifying the shell interpreter
|
||||
to be used.
|
||||
|
||||
* Removed ATF_WORKDIR. The only remaining consumers have been converted to
|
||||
use the standard TMPDIR environment variable. As a benefit, and because
|
||||
Kyua forces the TMPDIR to live within the test case's work directory,
|
||||
any stale files left behind by ATF will be automatically cleaned up.
|
||||
|
||||
* Documented the environment variables recognized by each component in the
|
||||
relevant manual pages. This information was lost with the atf-config(1)
|
||||
removal.
|
||||
|
||||
* Added a new "require.diskspace" metadata property to test cases so that
|
||||
they can specify the minimum amount of disk space required for the test
|
||||
to run.
|
||||
|
||||
* Renamed the atf-{c,c++,sh}-api(3) manual pages to atf-{c,c++,sh}(3) for
|
||||
discoverability purposes. Symbolic links are provided for the time
|
||||
being to still make the old names visible.
|
||||
|
||||
* Issue #5: Recommend the (expected, actual) idiom for calls to the test
|
||||
macros in the manual pages.
|
||||
|
||||
* Issue #7: Stopped catching unhandled exceptions in atf-c++ tests. This
|
||||
propagates the crash to the caller, which in turn allows it to obtain
|
||||
proper debugging information. In particular, Kyua should now be able to
|
||||
extract a stacktrace pinpointing the problem.
|
||||
|
||||
* Issue #8: Fixed atf-c/macros_test:use test failures spotted by the clang
|
||||
that ships with FreeBSD 11.0-CURRENT.
|
||||
|
||||
* Issue #12: Improved documentation of atf-sh(3) and atf-check(1) by better
|
||||
explaining how they relate to each other.
|
||||
|
||||
* Issue #14: Stopped setting 'set -e' in atf-sh. This setting was
|
||||
initially added as a way to enable a "strict" mode in the library and to
|
||||
make test cases fail fast when they run unprotected commands. However,
|
||||
doing so in the library is surprising as the responsibility of enabling
|
||||
'set -e' should be on the user's code. Also, 'set -e' introduces
|
||||
inconsistent behavior on subshells and users do not expect that.
|
||||
|
||||
* Issue #15: Fixed atf_utils_{fork,wait} to support nested calls.
|
||||
|
||||
* Issue #16: Fixed test failures (by removing a long-standing hack) on
|
||||
systems that lack \e support in printf(1).
|
||||
|
||||
* Issue #19: Removed stale references to atf-config and atf-run.
|
||||
|
||||
|
||||
Changes in version 0.19
|
||||
***********************
|
||||
|
||||
Experimental version released on February 7th, 2014.
|
||||
|
||||
This is the last release to bundle the code for the deprecated tools.
|
||||
The next release will drop their code and will stop worrying about
|
||||
backwards compatibility between the ATF libraries and what the old tools
|
||||
may or may not support.
|
||||
|
||||
If you still require the old tools for some reason, grab a copy of the
|
||||
'tools' directory now. The code in this directory is standalone and
|
||||
does not depend on any internal details of atf-c++ any longer.
|
||||
|
||||
* Various fixes and improvements to support running as part of the FreeBSD
|
||||
test suite.
|
||||
|
||||
* Project hosting moved from Google Code (as a subproject of Kyua) to
|
||||
GitHub (as a first-class project). The main reason for the change is
|
||||
the suppression of binary downloads in Google Code on Jan 15th, 2014.
|
||||
See https://github.com/jmmv/atf/
|
||||
|
||||
* Removed builtin help from atf-sh(1) and atf-check(1) for simplicity
|
||||
reasons. In other words, their -h option is gone.
|
||||
|
||||
* Moved the code of the deprecated tools into a 'tools' directory and
|
||||
completely decoupled their code from the internals of atf-c++. The
|
||||
reason for this is to painlessly allow a third-party to maintain a
|
||||
copy of these tools after we delete them because upcoming changes to
|
||||
atf-c++ would break the stale tools.
|
||||
|
||||
|
||||
Changes in version 0.18
|
||||
***********************
|
||||
|
||||
Experimental version released on November 16th, 2013.
|
||||
|
||||
* Issue 45: Added require.memory support in atf-run for FreeBSD.
|
||||
|
||||
* Fixed an issue with the handling of cin with libc++.
|
||||
|
||||
* Issue 64: Fixed various mandoc formatting warnings.
|
||||
|
||||
* NetBSD PR bin/48284: Made atf-check flush its progress message to
|
||||
stdout so that an interrupted test case always shows the last message
|
||||
being executed.
|
||||
|
||||
* NetBSD PR bin/48285: Fixed atf_check examples in atf-sh-api(3).
|
||||
|
||||
|
||||
Changes in version 0.17
|
||||
***********************
|
||||
|
|
|
|||
45
unit/atf-src/README.md
Normal file
45
unit/atf-src/README.md
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
# Welcome to the ATF project!
|
||||
|
||||
ATF, or Automated Testing Framework, is a **collection of libraries** to
|
||||
write test programs in **C, C++ and POSIX shell**.
|
||||
|
||||
The ATF libraries offer a simple API. The API is orthogonal through the
|
||||
various bindings, allowing developers to quickly learn how to write test
|
||||
programs in different languages.
|
||||
|
||||
ATF-based test programs offer a **consistent end-user command-line
|
||||
interface** to allow both humans and automation to run the tests.
|
||||
|
||||
ATF-based test programs **rely on an execution engine** to be run and
|
||||
this execution engine is *not* shipped with ATF.
|
||||
**[Kyua](https://github.com/jmmv/kyua/) is the engine of choice.**
|
||||
|
||||
## Download
|
||||
|
||||
Formal releases for source files are available for download from GitHub:
|
||||
|
||||
* [atf 0.20](../../releases/tag/atf-0.20), released on February 7th, 2014.
|
||||
|
||||
## Installation
|
||||
|
||||
You are encouraged to install binary packages for your operating system
|
||||
wherever available:
|
||||
|
||||
* Fedora 20 and above: install the `atf` package with `yum install atf`.
|
||||
|
||||
* FreeBSD 10.0 and above: install the `atf` package with `pkg install atf`.
|
||||
|
||||
* NetBSD with pkgsrc: install the `pkgsrc/devel/atf` package.
|
||||
|
||||
Should you want to build and install ATF from the source tree provided
|
||||
here, follow the instructions in the [INSTALL file](INSTALL).
|
||||
|
||||
## Support
|
||||
|
||||
Please use the
|
||||
[atf-discuss mailing list](https://groups.google.com/forum/#!forum/atf-discuss)
|
||||
for any support inquiries related to `atf-c`, `atf-c++` or `atf-sh`.
|
||||
|
||||
If you have any questions on Kyua proper, please use the
|
||||
[kyua-discuss mailing list](https://groups.google.com/forum/#!forum/kyua-discuss)
|
||||
instead.
|
||||
|
|
@ -1,184 +0,0 @@
|
|||
Things to do Automated Testing Framework
|
||||
===========================================================================
|
||||
|
||||
|
||||
Last revised: November 30th, 2010
|
||||
|
||||
|
||||
This document includes the list of things that need to be done in ATF that
|
||||
are most requested by the users. This information used to be available in
|
||||
an ad-hoc bug tracker but that proved to be a bad idea. I have collected
|
||||
all worthy comments in here.
|
||||
|
||||
Please note that most work these days is going into Kyua (see
|
||||
http://code.google.com/p/kyua/). The ideas listed here apply to the
|
||||
components of ATF that have *not* been migrated to the new codebase yet.
|
||||
For bug reports or ideas that apply to the components that already have
|
||||
been migrated, please use the bug tracker in the URL above. Similarly,
|
||||
whenever a component is migrated, the ideas in this file should be revised
|
||||
and migrated to the new bug tracker where appropriate.
|
||||
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
Add build-time checks to atf-sh
|
||||
|
||||
The 0.7 release introduced build-time tests to atf-c and atf-c++, but not
|
||||
to atf-sh. Expose the functionality to the shell interface.
|
||||
|
||||
This will probably require writing an atf-build utility that exposes the C
|
||||
code and can be called from the shell.
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
Revisit what to do when an Atffile lists a non-existent file
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
Add ATF_CHECK* versions to atf-c++ to support non-fatal tests
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
Implement race-condition tests
|
||||
|
||||
gcooper:
|
||||
|
||||
I would think that stress/negative tests would be of more value than race
|
||||
condition tests (they're similar, but not exactly the same in my mind).
|
||||
|
||||
In particular,
|
||||
|
||||
1. Feed through as much data as possible to determine where reporting
|
||||
breaks down.
|
||||
2. Feed through data quickly and terminate ASAP. The data should be
|
||||
captured. Terminate child applications with unexpected exit codes and
|
||||
signals (in particular, SIGCHLD, SIGPIPE, exit codes that terminate,
|
||||
etc).
|
||||
3. Open up a file descriptor in the test application, don't close the file
|
||||
descriptor.
|
||||
4. fork(2) a process; don't wait(2) for the application to complete.
|
||||
|
||||
There are other scenarios that could be exercised, but these are the ones
|
||||
I could think of off the topic of my head.
|
||||
|
||||
--
|
||||
|
||||
jmmv:
|
||||
|
||||
1. The thing is: how do you express any of this in a portable/abstract
|
||||
interface? How do you express that a test case "receives data"? What
|
||||
does that exactly mean? I don't think the framework should care about
|
||||
this: each test should be free to decide where its data is and how to
|
||||
deal with it.
|
||||
|
||||
2. Ditto.
|
||||
|
||||
3. Not sure I understand your request, but testing for "unexpected exit
|
||||
codes" is already supported. See wiki:DesignXFail for the feature
|
||||
design details.
|
||||
|
||||
4. What's the problem with this case? The test case exits right away after
|
||||
terminating the execution of its body; any open file descriptors,
|
||||
leaked memory, etc. die with it.
|
||||
|
||||
5. forking and not waiting for a subprocess was a problem already
|
||||
addressed.
|
||||
|
||||
I kinda have an idea of what Antti means with "race condition tests", but
|
||||
every time I have tried to describe my understanding of matters I seem to
|
||||
be wrong. Would be nice to have a clear description of what this involves;
|
||||
in particular, what are the expectations from the framework and how should
|
||||
the feature be exposed.
|
||||
|
||||
As of now, what I understand by "race condition test" is: a test case that
|
||||
exercises a race condition. The test case may finish without triggering
|
||||
the race, in which case it just exists with a successful status.
|
||||
Otherwise, if the race triggers, the test case gets stuck and times out.
|
||||
The result should be reported as an "expected failure" different from
|
||||
timeout.
|
||||
|
||||
--
|
||||
|
||||
pooka:
|
||||
|
||||
Yup. Plus some atf-wide mechanism for the operator to supply some kind of
|
||||
guideline if the test should try to trigger the race for a second or for
|
||||
an hour.
|
||||
|
||||
--
|
||||
|
||||
jmmv:
|
||||
|
||||
Alright. While mocking up some code for this, I think that your two
|
||||
requests are complementary.
|
||||
|
||||
On the one hand, when you are talking about a "race condition" test you
|
||||
really mean an "expected race condition" test. Correct? If so, we need to
|
||||
extend the xfail mechanism to add one more case, which is to report any
|
||||
failures as a race condition error and, if there is no failure, report the
|
||||
test as successful.
|
||||
|
||||
On the other hand, the atf-wide mechanism to support how long the test
|
||||
should run for can be thought as a "stress test" mechanism. I.e. run this
|
||||
test for X time / iterations and report its results regularly without
|
||||
involving xfail at all.
|
||||
|
||||
So, with this in mind:
|
||||
|
||||
* For a test that triggers an unfixed race condition, you set xfail to
|
||||
race mode and define the test as a stress test. Any failures are
|
||||
reported as expected failures.
|
||||
|
||||
* For a test that verifies a supposedly-fixed race condition, you do *not*
|
||||
set xfail to race mode, and only set the test to stress test. Any
|
||||
failures are reported as real failures.
|
||||
|
||||
These stress test cases implement a single iteration of the test and
|
||||
atf-run is in charge of running the test several times, stopping on the
|
||||
first failure.
|
||||
|
||||
Does that make sense?
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
Implement ATF_REQUIRE_ERRNO
|
||||
|
||||
pooka:
|
||||
|
||||
Most of the lines in tests against system functionality are:
|
||||
|
||||
if (syscall(args) == -1)
|
||||
atf_tc_fail_errno("flop")
|
||||
|
||||
Some shorthand would be helpful, like ATF_REQUIRE_ERRNO(syscall(args))
|
||||
Also, a variant which allows arbitrary return value checks (e.g. "!= 0" or
|
||||
"< 124" or "!= size") would be nice.
|
||||
|
||||
--
|
||||
|
||||
gcooper:
|
||||
|
||||
There's a problem with this request; not all functions fail in the same
|
||||
way ... in particular compare the pthread family of functions (which
|
||||
return errno) vs many native syscalls. Furthermore, compare some
|
||||
fcntl-like syscalls vs other syscalls. One size fits all solutions may not
|
||||
be a wise idea in this case, so I think that the problem statement needs
|
||||
to be better defined, because the above request is too loose.
|
||||
|
||||
FWIW, there's also a TEST macro in LTP, which tests for non-zero status,
|
||||
and sets an appropriate set of global variables for errnos and return
|
||||
codes, respectively. It was a good idea, but has been mostly abandoned
|
||||
because it's too difficult to define a success and failure in a universal
|
||||
manner, so I think that we need to be careful with what's implemented in
|
||||
ATF to not repeat the mistakes that others have made.
|
||||
|
||||
--
|
||||
|
||||
jmmv:
|
||||
|
||||
I think you've got a good point.
|
||||
|
||||
This was mostly intended to simplify the handling of the stupid errno
|
||||
global variable. I think this is valuable to have, but maybe the
|
||||
macro/function name should be different because _ERRNO can be confusing.
|
||||
Probably something like an ATF_CHECK_LIBC / ATF_CHECK_PTHREAD approach
|
||||
would be more flexible and simple.
|
||||
|
||||
|
||||
===========================================================================
|
||||
vim: filetype=text:textwidth=75:expandtab:shiftwidth=2:softtabstop=2
|
||||
548
unit/atf-src/aclocal.m4
vendored
548
unit/atf-src/aclocal.m4
vendored
|
|
@ -1,6 +1,6 @@
|
|||
# generated automatically by aclocal 1.12.2 -*- Autoconf -*-
|
||||
# generated automatically by aclocal 1.15.1 -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996-2012 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2017 Free Software Foundation, Inc.
|
||||
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
|
@ -11,6 +11,7 @@
|
|||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
|
||||
m4_ifndef([AC_AUTOCONF_VERSION],
|
||||
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
|
||||
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
|
||||
|
|
@ -19,24 +20,22 @@ You have another version of autoconf. It may work, but is not guaranteed to.
|
|||
If you have problems, you may need to regenerate the build system entirely.
|
||||
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
|
||||
|
||||
# Copyright (C) 2002-2012 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 8
|
||||
|
||||
# AM_AUTOMAKE_VERSION(VERSION)
|
||||
# ----------------------------
|
||||
# Automake X.Y traces this macro to ensure aclocal.m4 has been
|
||||
# generated from the m4 files accompanying Automake X.Y.
|
||||
# (This private macro should not be called outside this file.)
|
||||
AC_DEFUN([AM_AUTOMAKE_VERSION],
|
||||
[am__api_version='1.12'
|
||||
[am__api_version='1.15'
|
||||
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
|
||||
dnl require some minimum version. Point them to the right macro.
|
||||
m4_if([$1], [1.12.2], [],
|
||||
m4_if([$1], [1.15.1], [],
|
||||
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
|
||||
])
|
||||
|
||||
|
|
@ -52,20 +51,78 @@ m4_define([_AM_AUTOCONF_VERSION], [])
|
|||
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
|
||||
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
|
||||
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
|
||||
[AM_AUTOMAKE_VERSION([1.12.2])dnl
|
||||
[AM_AUTOMAKE_VERSION([1.15.1])dnl
|
||||
m4_ifndef([AC_AUTOCONF_VERSION],
|
||||
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
|
||||
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
|
||||
|
||||
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001-2012 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2011-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 2
|
||||
# AM_PROG_AR([ACT-IF-FAIL])
|
||||
# -------------------------
|
||||
# Try to determine the archiver interface, and trigger the ar-lib wrapper
|
||||
# if it is needed. If the detection of archiver interface fails, run
|
||||
# ACT-IF-FAIL (default is to abort configure with a proper error message).
|
||||
AC_DEFUN([AM_PROG_AR],
|
||||
[AC_BEFORE([$0], [LT_INIT])dnl
|
||||
AC_BEFORE([$0], [AC_PROG_LIBTOOL])dnl
|
||||
AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
|
||||
AC_REQUIRE_AUX_FILE([ar-lib])dnl
|
||||
AC_CHECK_TOOLS([AR], [ar lib "link -lib"], [false])
|
||||
: ${AR=ar}
|
||||
|
||||
AC_CACHE_CHECK([the archiver ($AR) interface], [am_cv_ar_interface],
|
||||
[AC_LANG_PUSH([C])
|
||||
am_cv_ar_interface=ar
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int some_variable = 0;]])],
|
||||
[am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&AS_MESSAGE_LOG_FD'
|
||||
AC_TRY_EVAL([am_ar_try])
|
||||
if test "$ac_status" -eq 0; then
|
||||
am_cv_ar_interface=ar
|
||||
else
|
||||
am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&AS_MESSAGE_LOG_FD'
|
||||
AC_TRY_EVAL([am_ar_try])
|
||||
if test "$ac_status" -eq 0; then
|
||||
am_cv_ar_interface=lib
|
||||
else
|
||||
am_cv_ar_interface=unknown
|
||||
fi
|
||||
fi
|
||||
rm -f conftest.lib libconftest.a
|
||||
])
|
||||
AC_LANG_POP([C])])
|
||||
|
||||
case $am_cv_ar_interface in
|
||||
ar)
|
||||
;;
|
||||
lib)
|
||||
# Microsoft lib, so override with the ar-lib wrapper script.
|
||||
# FIXME: It is wrong to rewrite AR.
|
||||
# But if we don't then we get into trouble of one sort or another.
|
||||
# A longer-term fix would be to have automake use am__AR in this case,
|
||||
# and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something
|
||||
# similar.
|
||||
AR="$am_aux_dir/ar-lib $AR"
|
||||
;;
|
||||
unknown)
|
||||
m4_default([$1],
|
||||
[AC_MSG_ERROR([could not determine $AR interface])])
|
||||
;;
|
||||
esac
|
||||
AC_SUBST([AR])dnl
|
||||
])
|
||||
|
||||
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
|
||||
# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to
|
||||
|
|
@ -106,22 +163,19 @@ _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
|
|||
# configured tree to be moved without reconfiguration.
|
||||
|
||||
AC_DEFUN([AM_AUX_DIR_EXPAND],
|
||||
[dnl Rely on autoconf to set up CDPATH properly.
|
||||
AC_PREREQ([2.50])dnl
|
||||
# expand $ac_aux_dir to an absolute path
|
||||
am_aux_dir=`cd $ac_aux_dir && pwd`
|
||||
[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
|
||||
# Expand $ac_aux_dir to an absolute path.
|
||||
am_aux_dir=`cd "$ac_aux_dir" && pwd`
|
||||
])
|
||||
|
||||
# AM_CONDITIONAL -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1997-2012 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1997-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 10
|
||||
|
||||
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
|
||||
# -------------------------------------
|
||||
# Define a conditional.
|
||||
|
|
@ -147,13 +201,12 @@ AC_CONFIG_COMMANDS_PRE(
|
|||
Usually this means the macro was only invoked conditionally.]])
|
||||
fi])])
|
||||
|
||||
# Copyright (C) 1999-2012 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 17
|
||||
|
||||
# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
|
||||
# written in clear, in which case automake, when reading aclocal.m4,
|
||||
|
|
@ -339,19 +392,18 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
|
|||
|
||||
# Generate code to set up dependency tracking. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1999-2012 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 6
|
||||
|
||||
# _AM_OUTPUT_DEPENDENCY_COMMANDS
|
||||
# ------------------------------
|
||||
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
[{
|
||||
# Autoconf 2.62 quotes --file arguments for eval, but not when files
|
||||
# Older Autoconf quotes --file arguments for eval, but not when files
|
||||
# are listed without --file. Let's play safe and only enable the eval
|
||||
# if we detect the quoting.
|
||||
case $CONFIG_FILES in
|
||||
|
|
@ -380,7 +432,7 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
|
|||
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
|
||||
test -z "$DEPDIR" && continue
|
||||
am__include=`sed -n 's/^am__include = //p' < "$mf"`
|
||||
test -z "am__include" && continue
|
||||
test -z "$am__include" && continue
|
||||
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
|
||||
# Find all dependency output files, they are included files with
|
||||
# $(DEPDIR) in their names. We invoke sed twice because it is the
|
||||
|
|
@ -416,17 +468,21 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
|
|||
|
||||
# Do all the work for Automake. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996-2012 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 19
|
||||
|
||||
# This macro actually does too much. Some checks are only needed if
|
||||
# your package does certain things. But this isn't really a big deal.
|
||||
|
||||
dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
|
||||
m4_define([AC_PROG_CC],
|
||||
m4_defn([AC_PROG_CC])
|
||||
[_AM_PROG_CC_C_O
|
||||
])
|
||||
|
||||
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
|
||||
# AM_INIT_AUTOMAKE([OPTIONS])
|
||||
# -----------------------------------------------
|
||||
|
|
@ -439,7 +495,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
|
|||
# arguments mandatory, and then we can depend on a new Autoconf
|
||||
# release and drop the old call support.
|
||||
AC_DEFUN([AM_INIT_AUTOMAKE],
|
||||
[AC_PREREQ([2.62])dnl
|
||||
[AC_PREREQ([2.65])dnl
|
||||
dnl Autoconf wants to disallow AM_ names. We explicitly allow
|
||||
dnl the ones we care about.
|
||||
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
|
||||
|
|
@ -469,8 +525,7 @@ AC_SUBST([CYGPATH_W])
|
|||
dnl Distinguish between old-style and new-style calls.
|
||||
m4_ifval([$2],
|
||||
[AC_DIAGNOSE([obsolete],
|
||||
[$0: two- and three-arguments forms are deprecated. For more info, see:
|
||||
http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_INIT_AUTOMAKE-invocation])
|
||||
[$0: two- and three-arguments forms are deprecated.])
|
||||
m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
|
||||
AC_SUBST([PACKAGE], [$1])dnl
|
||||
AC_SUBST([VERSION], [$2])],
|
||||
|
|
@ -503,8 +558,8 @@ AC_REQUIRE([AC_PROG_MKDIR_P])dnl
|
|||
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
|
||||
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
|
||||
AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
|
||||
# We need awk for the "check" target. The system "awk" is bad on
|
||||
# some platforms.
|
||||
# We need awk for the "check" target (and possibly the TAP driver). The
|
||||
# system "awk" is bad on some platforms.
|
||||
AC_REQUIRE([AC_PROG_AWK])dnl
|
||||
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
|
||||
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
|
||||
|
|
@ -524,21 +579,63 @@ AC_PROVIDE_IFELSE([AC_PROG_OBJC],
|
|||
[_AM_DEPENDENCIES([OBJC])],
|
||||
[m4_define([AC_PROG_OBJC],
|
||||
m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
|
||||
dnl Support for Objective C++ was only introduced in Autoconf 2.65,
|
||||
dnl but we still cater to Autoconf 2.62.
|
||||
m4_ifdef([AC_PROG_OBJCXX],
|
||||
[AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
|
||||
AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
|
||||
[_AM_DEPENDENCIES([OBJCXX])],
|
||||
[m4_define([AC_PROG_OBJCXX],
|
||||
m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])])dnl
|
||||
m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
|
||||
])
|
||||
_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
|
||||
dnl The 'parallel-tests' driver may need to know about EXEEXT, so add the
|
||||
dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro
|
||||
dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
|
||||
AC_REQUIRE([AM_SILENT_RULES])dnl
|
||||
dnl The testsuite driver may need to know about EXEEXT, so add the
|
||||
dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This
|
||||
dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
|
||||
AC_CONFIG_COMMANDS_PRE(dnl
|
||||
[m4_provide_if([_AM_COMPILER_EXEEXT],
|
||||
[AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
|
||||
|
||||
# POSIX will say in a future version that running "rm -f" with no argument
|
||||
# is OK; and we want to be able to make that assumption in our Makefile
|
||||
# recipes. So use an aggressive probe to check that the usage we want is
|
||||
# actually supported "in the wild" to an acceptable degree.
|
||||
# See automake bug#10828.
|
||||
# To make any issue more visible, cause the running configure to be aborted
|
||||
# by default if the 'rm' program in use doesn't match our expectations; the
|
||||
# user can still override this though.
|
||||
if rm -f && rm -fr && rm -rf; then : OK; else
|
||||
cat >&2 <<'END'
|
||||
Oops!
|
||||
|
||||
Your 'rm' program seems unable to run without file operands specified
|
||||
on the command line, even when the '-f' option is present. This is contrary
|
||||
to the behaviour of most rm programs out there, and not conforming with
|
||||
the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
|
||||
|
||||
Please tell bug-automake@gnu.org about your system, including the value
|
||||
of your $PATH and any error possibly output before this message. This
|
||||
can help us improve future automake versions.
|
||||
|
||||
END
|
||||
if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
|
||||
echo 'Configuration will proceed anyway, since you have set the' >&2
|
||||
echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
|
||||
echo >&2
|
||||
else
|
||||
cat >&2 <<'END'
|
||||
Aborting the configuration process, to ensure you take notice of the issue.
|
||||
|
||||
You can download and install GNU coreutils to get an 'rm' implementation
|
||||
that behaves properly: <http://www.gnu.org/software/coreutils/>.
|
||||
|
||||
If you want to complete the configuration process using your problematic
|
||||
'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
|
||||
to "yes", and re-run configure.
|
||||
|
||||
END
|
||||
AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
|
||||
fi
|
||||
fi
|
||||
dnl The trailing newline in this macro's definition is deliberate, for
|
||||
dnl backward compatibility and to allow trailing 'dnl'-style comments
|
||||
dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
|
||||
])
|
||||
|
||||
dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
|
||||
|
|
@ -547,7 +644,6 @@ dnl mangled by Autoconf and run in a shell conditional statement.
|
|||
m4_define([_AC_COMPILER_EXEEXT],
|
||||
m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
|
||||
|
||||
|
||||
# When config.status generates a header, we must update the stamp-h file.
|
||||
# This file resides in the same directory as the config header
|
||||
# that is generated. The stamp files are numbered to have different names.
|
||||
|
|
@ -569,20 +665,18 @@ for _am_header in $config_headers :; do
|
|||
done
|
||||
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
|
||||
|
||||
# Copyright (C) 2001-2012 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 8
|
||||
|
||||
# AM_PROG_INSTALL_SH
|
||||
# ------------------
|
||||
# Define $install_sh.
|
||||
AC_DEFUN([AM_PROG_INSTALL_SH],
|
||||
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
|
||||
if test x"${install_sh}" != xset; then
|
||||
if test x"${install_sh+set}" != xset; then
|
||||
case $am_aux_dir in
|
||||
*\ * | *\ *)
|
||||
install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
|
||||
|
|
@ -592,14 +686,12 @@ if test x"${install_sh}" != xset; then
|
|||
fi
|
||||
AC_SUBST([install_sh])])
|
||||
|
||||
# Copyright (C) 2003-2012 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2003-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 2
|
||||
|
||||
# Check whether the underlying file-system supports filenames
|
||||
# with a leading dot. For instance MS-DOS doesn't.
|
||||
AC_DEFUN([AM_SET_LEADING_DOT],
|
||||
|
|
@ -615,14 +707,12 @@ AC_SUBST([am__leading_dot])])
|
|||
|
||||
# Check to see how 'make' treats includes. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001-2012 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 5
|
||||
|
||||
# AM_MAKE_INCLUDE()
|
||||
# -----------------
|
||||
# Check to see how make treats includes.
|
||||
|
|
@ -665,50 +755,14 @@ AC_MSG_RESULT([$_am_result])
|
|||
rm -f confinc confmf
|
||||
])
|
||||
|
||||
# Copyright (C) 1999-2012 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 6
|
||||
|
||||
# AM_PROG_CC_C_O
|
||||
# --------------
|
||||
# Like AC_PROG_CC_C_O, but changed for automake.
|
||||
AC_DEFUN([AM_PROG_CC_C_O],
|
||||
[AC_REQUIRE([AC_PROG_CC_C_O])dnl
|
||||
AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
|
||||
AC_REQUIRE_AUX_FILE([compile])dnl
|
||||
# FIXME: we rely on the cache variable name because
|
||||
# there is no other way.
|
||||
set dummy $CC
|
||||
am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
|
||||
eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
|
||||
if test "$am_t" != yes; then
|
||||
# Losing compiler, so override with the script.
|
||||
# FIXME: It is wrong to rewrite CC.
|
||||
# But if we don't then we get into trouble of one sort or another.
|
||||
# A longer-term fix would be to have automake use am__CC in this case,
|
||||
# and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
|
||||
CC="$am_aux_dir/compile $CC"
|
||||
fi
|
||||
dnl Make sure AC_PROG_CC is never called again, or it will override our
|
||||
dnl setting of CC.
|
||||
m4_define([AC_PROG_CC],
|
||||
[m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])])
|
||||
])
|
||||
|
||||
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1997-2012 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1997-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 7
|
||||
|
||||
# AM_MISSING_PROG(NAME, PROGRAM)
|
||||
# ------------------------------
|
||||
AC_DEFUN([AM_MISSING_PROG],
|
||||
|
|
@ -716,11 +770,10 @@ AC_DEFUN([AM_MISSING_PROG],
|
|||
$1=${$1-"${am_missing_run}$2"}
|
||||
AC_SUBST($1)])
|
||||
|
||||
|
||||
# AM_MISSING_HAS_RUN
|
||||
# ------------------
|
||||
# Define MISSING if not defined so far and test if it supports --run.
|
||||
# If it does, set am_missing_run to use it, otherwise, to nothing.
|
||||
# Define MISSING if not defined so far and test if it is modern enough.
|
||||
# If it is, set am_missing_run to use it, otherwise, to nothing.
|
||||
AC_DEFUN([AM_MISSING_HAS_RUN],
|
||||
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
|
||||
AC_REQUIRE_AUX_FILE([missing])dnl
|
||||
|
|
@ -733,8 +786,8 @@ if test x"${MISSING+set}" != xset; then
|
|||
esac
|
||||
fi
|
||||
# Use eval to expand $SHELL
|
||||
if eval "$MISSING --run true"; then
|
||||
am_missing_run="$MISSING --run "
|
||||
if eval "$MISSING --is-lightweight"; then
|
||||
am_missing_run="$MISSING "
|
||||
else
|
||||
am_missing_run=
|
||||
AC_MSG_WARN(['missing' script is too old or missing])
|
||||
|
|
@ -743,14 +796,12 @@ fi
|
|||
|
||||
# Helper functions for option handling. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001-2012 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 6
|
||||
|
||||
# _AM_MANGLE_OPTION(NAME)
|
||||
# -----------------------
|
||||
AC_DEFUN([_AM_MANGLE_OPTION],
|
||||
|
|
@ -774,15 +825,77 @@ AC_DEFUN([_AM_SET_OPTIONS],
|
|||
AC_DEFUN([_AM_IF_OPTION],
|
||||
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
|
||||
|
||||
# Check to make sure that the build environment is sane. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996-2012 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 9
|
||||
# _AM_PROG_CC_C_O
|
||||
# ---------------
|
||||
# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC
|
||||
# to automatically call this.
|
||||
AC_DEFUN([_AM_PROG_CC_C_O],
|
||||
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
|
||||
AC_REQUIRE_AUX_FILE([compile])dnl
|
||||
AC_LANG_PUSH([C])dnl
|
||||
AC_CACHE_CHECK(
|
||||
[whether $CC understands -c and -o together],
|
||||
[am_cv_prog_cc_c_o],
|
||||
[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
|
||||
# Make sure it works both with $CC and with simple cc.
|
||||
# Following AC_PROG_CC_C_O, we do the test twice because some
|
||||
# compilers refuse to overwrite an existing .o file with -o,
|
||||
# though they will create one.
|
||||
am_cv_prog_cc_c_o=yes
|
||||
for am_i in 1 2; do
|
||||
if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
|
||||
&& test -f conftest2.$ac_objext; then
|
||||
: OK
|
||||
else
|
||||
am_cv_prog_cc_c_o=no
|
||||
break
|
||||
fi
|
||||
done
|
||||
rm -f core conftest*
|
||||
unset am_i])
|
||||
if test "$am_cv_prog_cc_c_o" != yes; then
|
||||
# Losing compiler, so override with the script.
|
||||
# FIXME: It is wrong to rewrite CC.
|
||||
# But if we don't then we get into trouble of one sort or another.
|
||||
# A longer-term fix would be to have automake use am__CC in this case,
|
||||
# and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
|
||||
CC="$am_aux_dir/compile $CC"
|
||||
fi
|
||||
AC_LANG_POP([C])])
|
||||
|
||||
# For backward compatibility.
|
||||
AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
|
||||
|
||||
# Copyright (C) 2001-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# AM_RUN_LOG(COMMAND)
|
||||
# -------------------
|
||||
# Run COMMAND, save the exit status in ac_status, and log it.
|
||||
# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
|
||||
AC_DEFUN([AM_RUN_LOG],
|
||||
[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
|
||||
($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
|
||||
(exit $ac_status); }])
|
||||
|
||||
# Check to make sure that the build environment is sane. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# AM_SANITY_CHECK
|
||||
# ---------------
|
||||
|
|
@ -859,13 +972,71 @@ AC_CONFIG_COMMANDS_PRE(
|
|||
rm -f conftest.file
|
||||
])
|
||||
|
||||
# Copyright (C) 2001-2012 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2009-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 2
|
||||
# AM_SILENT_RULES([DEFAULT])
|
||||
# --------------------------
|
||||
# Enable less verbose build rules; with the default set to DEFAULT
|
||||
# ("yes" being less verbose, "no" or empty being verbose).
|
||||
AC_DEFUN([AM_SILENT_RULES],
|
||||
[AC_ARG_ENABLE([silent-rules], [dnl
|
||||
AS_HELP_STRING(
|
||||
[--enable-silent-rules],
|
||||
[less verbose build output (undo: "make V=1")])
|
||||
AS_HELP_STRING(
|
||||
[--disable-silent-rules],
|
||||
[verbose build output (undo: "make V=0")])dnl
|
||||
])
|
||||
case $enable_silent_rules in @%:@ (((
|
||||
yes) AM_DEFAULT_VERBOSITY=0;;
|
||||
no) AM_DEFAULT_VERBOSITY=1;;
|
||||
*) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
|
||||
esac
|
||||
dnl
|
||||
dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
|
||||
dnl do not support nested variable expansions.
|
||||
dnl See automake bug#9928 and bug#10237.
|
||||
am_make=${MAKE-make}
|
||||
AC_CACHE_CHECK([whether $am_make supports nested variables],
|
||||
[am_cv_make_support_nested_variables],
|
||||
[if AS_ECHO([['TRUE=$(BAR$(V))
|
||||
BAR0=false
|
||||
BAR1=true
|
||||
V=1
|
||||
am__doit:
|
||||
@$(TRUE)
|
||||
.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
|
||||
am_cv_make_support_nested_variables=yes
|
||||
else
|
||||
am_cv_make_support_nested_variables=no
|
||||
fi])
|
||||
if test $am_cv_make_support_nested_variables = yes; then
|
||||
dnl Using '$V' instead of '$(V)' breaks IRIX make.
|
||||
AM_V='$(V)'
|
||||
AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
|
||||
else
|
||||
AM_V=$AM_DEFAULT_VERBOSITY
|
||||
AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
|
||||
fi
|
||||
AC_SUBST([AM_V])dnl
|
||||
AM_SUBST_NOTMAKE([AM_V])dnl
|
||||
AC_SUBST([AM_DEFAULT_V])dnl
|
||||
AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
|
||||
AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
|
||||
AM_BACKSLASH='\'
|
||||
AC_SUBST([AM_BACKSLASH])dnl
|
||||
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
|
||||
])
|
||||
|
||||
# Copyright (C) 2001-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# AM_PROG_INSTALL_STRIP
|
||||
# ---------------------
|
||||
|
|
@ -889,14 +1060,12 @@ fi
|
|||
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
|
||||
AC_SUBST([INSTALL_STRIP_PROGRAM])])
|
||||
|
||||
# Copyright (C) 2006-2012 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2006-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 3
|
||||
|
||||
# _AM_SUBST_NOTMAKE(VARIABLE)
|
||||
# ---------------------------
|
||||
# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
|
||||
|
|
@ -910,14 +1079,12 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
|
|||
|
||||
# Check how to create a tarball. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2004-2012 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2004-2017 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 3
|
||||
|
||||
# _AM_PROG_TAR(FORMAT)
|
||||
# --------------------
|
||||
# Check how to create a tarball in format FORMAT.
|
||||
|
|
@ -931,76 +1098,114 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
|
|||
# Substitute a variable $(am__untar) that extract such
|
||||
# a tarball read from stdin.
|
||||
# $(am__untar) < result.tar
|
||||
#
|
||||
AC_DEFUN([_AM_PROG_TAR],
|
||||
[# Always define AMTAR for backward compatibility. Yes, it's still used
|
||||
# in the wild :-( We should find a proper way to deprecate it ...
|
||||
AC_SUBST([AMTAR], ['$${TAR-tar}'])
|
||||
m4_if([$1], [v7],
|
||||
[am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
|
||||
[m4_case([$1], [ustar],, [pax],,
|
||||
[m4_fatal([Unknown tar format])])
|
||||
AC_MSG_CHECKING([how to create a $1 tar archive])
|
||||
# Loop over all known methods to create a tar archive until one works.
|
||||
|
||||
# We'll loop over all known methods to create a tar archive until one works.
|
||||
_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
|
||||
_am_tools=${am_cv_prog_tar_$1-$_am_tools}
|
||||
# Do not fold the above two line into one, because Tru64 sh and
|
||||
# Solaris sh will not grok spaces in the rhs of '-'.
|
||||
for _am_tool in $_am_tools
|
||||
do
|
||||
case $_am_tool in
|
||||
gnutar)
|
||||
for _am_tar in tar gnutar gtar;
|
||||
do
|
||||
AM_RUN_LOG([$_am_tar --version]) && break
|
||||
done
|
||||
am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
|
||||
am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
|
||||
am__untar="$_am_tar -xf -"
|
||||
;;
|
||||
plaintar)
|
||||
# Must skip GNU tar: if it does not support --format= it doesn't create
|
||||
# ustar tarball either.
|
||||
(tar --version) >/dev/null 2>&1 && continue
|
||||
am__tar='tar chf - "$$tardir"'
|
||||
am__tar_='tar chf - "$tardir"'
|
||||
am__untar='tar xf -'
|
||||
;;
|
||||
pax)
|
||||
am__tar='pax -L -x $1 -w "$$tardir"'
|
||||
am__tar_='pax -L -x $1 -w "$tardir"'
|
||||
am__untar='pax -r'
|
||||
;;
|
||||
cpio)
|
||||
am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
|
||||
am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
|
||||
am__untar='cpio -i -H $1 -d'
|
||||
;;
|
||||
none)
|
||||
am__tar=false
|
||||
am__tar_=false
|
||||
am__untar=false
|
||||
;;
|
||||
esac
|
||||
|
||||
# If the value was cached, stop now. We just wanted to have am__tar
|
||||
# and am__untar set.
|
||||
test -n "${am_cv_prog_tar_$1}" && break
|
||||
m4_if([$1], [v7],
|
||||
[am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
|
||||
|
||||
# tar/untar a dummy directory, and stop if the command works
|
||||
[m4_case([$1],
|
||||
[ustar],
|
||||
[# The POSIX 1988 'ustar' format is defined with fixed-size fields.
|
||||
# There is notably a 21 bits limit for the UID and the GID. In fact,
|
||||
# the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
|
||||
# and bug#13588).
|
||||
am_max_uid=2097151 # 2^21 - 1
|
||||
am_max_gid=$am_max_uid
|
||||
# The $UID and $GID variables are not portable, so we need to resort
|
||||
# to the POSIX-mandated id(1) utility. Errors in the 'id' calls
|
||||
# below are definitely unexpected, so allow the users to see them
|
||||
# (that is, avoid stderr redirection).
|
||||
am_uid=`id -u || echo unknown`
|
||||
am_gid=`id -g || echo unknown`
|
||||
AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
|
||||
if test $am_uid -le $am_max_uid; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
_am_tools=none
|
||||
fi
|
||||
AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
|
||||
if test $am_gid -le $am_max_gid; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
_am_tools=none
|
||||
fi],
|
||||
|
||||
[pax],
|
||||
[],
|
||||
|
||||
[m4_fatal([Unknown tar format])])
|
||||
|
||||
AC_MSG_CHECKING([how to create a $1 tar archive])
|
||||
|
||||
# Go ahead even if we have the value already cached. We do so because we
|
||||
# need to set the values for the 'am__tar' and 'am__untar' variables.
|
||||
_am_tools=${am_cv_prog_tar_$1-$_am_tools}
|
||||
|
||||
for _am_tool in $_am_tools; do
|
||||
case $_am_tool in
|
||||
gnutar)
|
||||
for _am_tar in tar gnutar gtar; do
|
||||
AM_RUN_LOG([$_am_tar --version]) && break
|
||||
done
|
||||
am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
|
||||
am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
|
||||
am__untar="$_am_tar -xf -"
|
||||
;;
|
||||
plaintar)
|
||||
# Must skip GNU tar: if it does not support --format= it doesn't create
|
||||
# ustar tarball either.
|
||||
(tar --version) >/dev/null 2>&1 && continue
|
||||
am__tar='tar chf - "$$tardir"'
|
||||
am__tar_='tar chf - "$tardir"'
|
||||
am__untar='tar xf -'
|
||||
;;
|
||||
pax)
|
||||
am__tar='pax -L -x $1 -w "$$tardir"'
|
||||
am__tar_='pax -L -x $1 -w "$tardir"'
|
||||
am__untar='pax -r'
|
||||
;;
|
||||
cpio)
|
||||
am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
|
||||
am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
|
||||
am__untar='cpio -i -H $1 -d'
|
||||
;;
|
||||
none)
|
||||
am__tar=false
|
||||
am__tar_=false
|
||||
am__untar=false
|
||||
;;
|
||||
esac
|
||||
|
||||
# If the value was cached, stop now. We just wanted to have am__tar
|
||||
# and am__untar set.
|
||||
test -n "${am_cv_prog_tar_$1}" && break
|
||||
|
||||
# tar/untar a dummy directory, and stop if the command works.
|
||||
rm -rf conftest.dir
|
||||
mkdir conftest.dir
|
||||
echo GrepMe > conftest.dir/file
|
||||
AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
|
||||
rm -rf conftest.dir
|
||||
if test -s conftest.tar; then
|
||||
AM_RUN_LOG([$am__untar <conftest.tar])
|
||||
AM_RUN_LOG([cat conftest.dir/file])
|
||||
grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
|
||||
fi
|
||||
done
|
||||
rm -rf conftest.dir
|
||||
mkdir conftest.dir
|
||||
echo GrepMe > conftest.dir/file
|
||||
AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
|
||||
rm -rf conftest.dir
|
||||
if test -s conftest.tar; then
|
||||
AM_RUN_LOG([$am__untar <conftest.tar])
|
||||
grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
|
||||
fi
|
||||
done
|
||||
rm -rf conftest.dir
|
||||
|
||||
AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
|
||||
AC_MSG_RESULT([$am_cv_prog_tar_$1])])
|
||||
AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
|
||||
AC_MSG_RESULT([$am_cv_prog_tar_$1])])
|
||||
|
||||
AC_SUBST([am__tar])
|
||||
AC_SUBST([am__untar])
|
||||
]) # _AM_PROG_TAR
|
||||
|
|
@ -1017,6 +1222,5 @@ m4_include([m4/module-application.m4])
|
|||
m4_include([m4/module-defs.m4])
|
||||
m4_include([m4/module-env.m4])
|
||||
m4_include([m4/module-fs.m4])
|
||||
m4_include([m4/module-sanity.m4])
|
||||
m4_include([m4/module-signals.m4])
|
||||
m4_include([m4/runtime-tool.m4])
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
#
|
||||
# Automated Testing Framework (atf)
|
||||
#
|
||||
# Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
|
|
@ -25,7 +22,6 @@
|
|||
# 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.
|
||||
#
|
||||
|
||||
dist-hook: check-style
|
||||
PHONY_TARGETS += check-style
|
||||
|
|
|
|||
270
unit/atf-src/admin/ar-lib
Executable file
270
unit/atf-src/admin/ar-lib
Executable file
|
|
@ -0,0 +1,270 @@
|
|||
#! /bin/sh
|
||||
# Wrapper for Microsoft lib.exe
|
||||
|
||||
me=ar-lib
|
||||
scriptversion=2012-03-01.08; # UTC
|
||||
|
||||
# Copyright (C) 2010-2017 Free Software Foundation, Inc.
|
||||
# Written by Peter Rosin <peda@lysator.liu.se>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
|
||||
# func_error message
|
||||
func_error ()
|
||||
{
|
||||
echo "$me: $1" 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
file_conv=
|
||||
|
||||
# func_file_conv build_file
|
||||
# Convert a $build file to $host form and store it in $file
|
||||
# Currently only supports Windows hosts.
|
||||
func_file_conv ()
|
||||
{
|
||||
file=$1
|
||||
case $file in
|
||||
/ | /[!/]*) # absolute file, and not a UNC file
|
||||
if test -z "$file_conv"; then
|
||||
# lazily determine how to convert abs files
|
||||
case `uname -s` in
|
||||
MINGW*)
|
||||
file_conv=mingw
|
||||
;;
|
||||
CYGWIN*)
|
||||
file_conv=cygwin
|
||||
;;
|
||||
*)
|
||||
file_conv=wine
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
case $file_conv in
|
||||
mingw)
|
||||
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
|
||||
;;
|
||||
cygwin)
|
||||
file=`cygpath -m "$file" || echo "$file"`
|
||||
;;
|
||||
wine)
|
||||
file=`winepath -w "$file" || echo "$file"`
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# func_at_file at_file operation archive
|
||||
# Iterate over all members in AT_FILE performing OPERATION on ARCHIVE
|
||||
# for each of them.
|
||||
# When interpreting the content of the @FILE, do NOT use func_file_conv,
|
||||
# since the user would need to supply preconverted file names to
|
||||
# binutils ar, at least for MinGW.
|
||||
func_at_file ()
|
||||
{
|
||||
operation=$2
|
||||
archive=$3
|
||||
at_file_contents=`cat "$1"`
|
||||
eval set x "$at_file_contents"
|
||||
shift
|
||||
|
||||
for member
|
||||
do
|
||||
$AR -NOLOGO $operation:"$member" "$archive" || exit $?
|
||||
done
|
||||
}
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
func_error "no command. Try '$0 --help' for more information."
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<EOF
|
||||
Usage: $me [--help] [--version] PROGRAM ACTION ARCHIVE [MEMBER...]
|
||||
|
||||
Members may be specified in a file named with @FILE.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "$me, version $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
if test $# -lt 3; then
|
||||
func_error "you must specify a program, an action and an archive"
|
||||
fi
|
||||
|
||||
AR=$1
|
||||
shift
|
||||
while :
|
||||
do
|
||||
if test $# -lt 2; then
|
||||
func_error "you must specify a program, an action and an archive"
|
||||
fi
|
||||
case $1 in
|
||||
-lib | -LIB \
|
||||
| -ltcg | -LTCG \
|
||||
| -machine* | -MACHINE* \
|
||||
| -subsystem* | -SUBSYSTEM* \
|
||||
| -verbose | -VERBOSE \
|
||||
| -wx* | -WX* )
|
||||
AR="$AR $1"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
action=$1
|
||||
shift
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
orig_archive=$1
|
||||
shift
|
||||
func_file_conv "$orig_archive"
|
||||
archive=$file
|
||||
|
||||
# strip leading dash in $action
|
||||
action=${action#-}
|
||||
|
||||
delete=
|
||||
extract=
|
||||
list=
|
||||
quick=
|
||||
replace=
|
||||
index=
|
||||
create=
|
||||
|
||||
while test -n "$action"
|
||||
do
|
||||
case $action in
|
||||
d*) delete=yes ;;
|
||||
x*) extract=yes ;;
|
||||
t*) list=yes ;;
|
||||
q*) quick=yes ;;
|
||||
r*) replace=yes ;;
|
||||
s*) index=yes ;;
|
||||
S*) ;; # the index is always updated implicitly
|
||||
c*) create=yes ;;
|
||||
u*) ;; # TODO: don't ignore the update modifier
|
||||
v*) ;; # TODO: don't ignore the verbose modifier
|
||||
*)
|
||||
func_error "unknown action specified"
|
||||
;;
|
||||
esac
|
||||
action=${action#?}
|
||||
done
|
||||
|
||||
case $delete$extract$list$quick$replace,$index in
|
||||
yes,* | ,yes)
|
||||
;;
|
||||
yesyes*)
|
||||
func_error "more than one action specified"
|
||||
;;
|
||||
*)
|
||||
func_error "no action specified"
|
||||
;;
|
||||
esac
|
||||
|
||||
if test -n "$delete"; then
|
||||
if test ! -f "$orig_archive"; then
|
||||
func_error "archive not found"
|
||||
fi
|
||||
for member
|
||||
do
|
||||
case $1 in
|
||||
@*)
|
||||
func_at_file "${1#@}" -REMOVE "$archive"
|
||||
;;
|
||||
*)
|
||||
func_file_conv "$1"
|
||||
$AR -NOLOGO -REMOVE:"$file" "$archive" || exit $?
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
elif test -n "$extract"; then
|
||||
if test ! -f "$orig_archive"; then
|
||||
func_error "archive not found"
|
||||
fi
|
||||
if test $# -gt 0; then
|
||||
for member
|
||||
do
|
||||
case $1 in
|
||||
@*)
|
||||
func_at_file "${1#@}" -EXTRACT "$archive"
|
||||
;;
|
||||
*)
|
||||
func_file_conv "$1"
|
||||
$AR -NOLOGO -EXTRACT:"$file" "$archive" || exit $?
|
||||
;;
|
||||
esac
|
||||
done
|
||||
else
|
||||
$AR -NOLOGO -LIST "$archive" | sed -e 's/\\/\\\\/g' | while read member
|
||||
do
|
||||
$AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $?
|
||||
done
|
||||
fi
|
||||
|
||||
elif test -n "$quick$replace"; then
|
||||
if test ! -f "$orig_archive"; then
|
||||
if test -z "$create"; then
|
||||
echo "$me: creating $orig_archive"
|
||||
fi
|
||||
orig_archive=
|
||||
else
|
||||
orig_archive=$archive
|
||||
fi
|
||||
|
||||
for member
|
||||
do
|
||||
case $1 in
|
||||
@*)
|
||||
func_file_conv "${1#@}"
|
||||
set x "$@" "@$file"
|
||||
;;
|
||||
*)
|
||||
func_file_conv "$1"
|
||||
set x "$@" "$file"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
shift
|
||||
done
|
||||
|
||||
if test -n "$orig_archive"; then
|
||||
$AR -NOLOGO -OUT:"$archive" "$orig_archive" "$@" || exit $?
|
||||
else
|
||||
$AR -NOLOGO -OUT:"$archive" "$@" || exit $?
|
||||
fi
|
||||
|
||||
elif test -n "$list"; then
|
||||
if test ! -f "$orig_archive"; then
|
||||
func_error "archive not found"
|
||||
fi
|
||||
$AR -NOLOGO -LIST "$archive" || exit $?
|
||||
fi
|
||||
|
|
@ -1,6 +1,3 @@
|
|||
#
|
||||
# Automated Testing Framework (atf)
|
||||
#
|
||||
# Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
|
|
@ -25,7 +22,6 @@
|
|||
# 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.
|
||||
#
|
||||
|
||||
function warn(msg) {
|
||||
print FILENAME "[" FNR "]: " msg > "/dev/stderr"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
#
|
||||
# Automated Testing Framework (atf)
|
||||
#
|
||||
# Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
|
|
@ -25,7 +22,6 @@
|
|||
# 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.
|
||||
#
|
||||
|
||||
function warn(msg) {
|
||||
print FILENAME "[" FNR "]: " msg > "/dev/stderr"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
#
|
||||
# Automated Testing Framework (atf)
|
||||
#
|
||||
# Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
|
|
@ -25,7 +22,6 @@
|
|||
# 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.
|
||||
#
|
||||
|
||||
function warn(msg) {
|
||||
print FILENAME "[" FNR "]: " msg > "/dev/stderr"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
#
|
||||
# Automated Testing Framework (atf)
|
||||
#
|
||||
# Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
|
|
@ -25,7 +22,6 @@
|
|||
# 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.
|
||||
#
|
||||
|
||||
function warn(msg) {
|
||||
print FILENAME "[" FNR "]: " msg > "/dev/stderr"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
#
|
||||
# Automated Testing Framework (atf)
|
||||
#
|
||||
# Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
|
|
@ -25,7 +22,6 @@
|
|||
# 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.
|
||||
#
|
||||
|
||||
function warn(msg) {
|
||||
print FILENAME "[" FNR "]: " msg > "/dev/stderr"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
#! /bin/sh
|
||||
#
|
||||
# Automated Testing Framework (atf)
|
||||
#
|
||||
# Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
|
|
@ -26,7 +23,6 @@
|
|||
# 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 sanity check the coding style of all source files in the
|
||||
|
|
@ -100,14 +96,15 @@ find_sources() {
|
|||
\! -path "*autom4te*" -a \
|
||||
-type f -a \
|
||||
\! -name "aclocal.m4" \
|
||||
\! -name "bconfig.h" \
|
||||
\! -name "config.h" \
|
||||
\! -name "defs.h" \
|
||||
\! -name "defs.hpp" \
|
||||
\! -name "libtool.m4" \
|
||||
\! -name "ltoptions.m4" \
|
||||
\! -name "ltsugar.m4" \
|
||||
\! -name "lt~obsolete.m4" \
|
||||
\! -name "*.so.*" \
|
||||
\)
|
||||
\) | grep -v tools/
|
||||
}
|
||||
|
||||
#
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
#! /bin/sh
|
||||
# Wrapper for compilers which do not understand '-c -o'.
|
||||
|
||||
scriptversion=2012-03-05.13; # UTC
|
||||
scriptversion=2016-01-11.22; # UTC
|
||||
|
||||
# Copyright (C) 1999-2012 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2017 Free Software Foundation, Inc.
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -112,6 +112,11 @@ func_cl_dashl ()
|
|||
lib=$dir/$lib.lib
|
||||
break
|
||||
fi
|
||||
if test -f "$dir/lib$lib.a"; then
|
||||
found=yes
|
||||
lib=$dir/lib$lib.a
|
||||
break
|
||||
fi
|
||||
done
|
||||
IFS=$save_IFS
|
||||
|
||||
|
|
@ -250,7 +255,8 @@ EOF
|
|||
echo "compile $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
|
||||
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
|
||||
icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
|
||||
func_cl_wrapper "$@" # Doesn't return...
|
||||
;;
|
||||
esac
|
||||
|
|
@ -337,6 +343,6 @@ exit $ret
|
|||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
|
|
|
|||
717
unit/atf-src/admin/config.guess
vendored
717
unit/atf-src/admin/config.guess
vendored
File diff suppressed because it is too large
Load diff
364
unit/atf-src/admin/config.sub
vendored
364
unit/atf-src/admin/config.sub
vendored
|
|
@ -1,38 +1,31 @@
|
|||
#! /bin/sh
|
||||
# Configuration validation subroutine script.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
||||
# Free Software Foundation, Inc.
|
||||
# Copyright 1992-2017 Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2009-12-31'
|
||||
timestamp='2017-04-02'
|
||||
|
||||
# This file is (in principle) common to ALL GNU software.
|
||||
# The presence of a machine in this file suggests that SOME GNU software
|
||||
# can handle that machine. It does not imply ALL GNU software can.
|
||||
#
|
||||
# This file is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
|
||||
# 02110-1301, USA.
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
# the same distribution terms that you use for the rest of that
|
||||
# program. This Exception is an additional permission under section 7
|
||||
# of the GNU General Public License, version 3 ("GPLv3").
|
||||
|
||||
|
||||
# Please send patches to <config-patches@gnu.org>. Submit a context
|
||||
# diff and a properly formatted GNU ChangeLog entry.
|
||||
# Please send patches to <config-patches@gnu.org>.
|
||||
#
|
||||
# Configuration subroutine to validate and canonicalize a configuration type.
|
||||
# Supply the specified configuration type as an argument.
|
||||
|
|
@ -40,7 +33,7 @@ timestamp='2009-12-31'
|
|||
# Otherwise, we print the canonical config type on stdout and succeed.
|
||||
|
||||
# You can get the latest version of this script from:
|
||||
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
|
||||
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
|
||||
|
||||
# This file is supposed to be the same for all GNU packages
|
||||
# and recognize all the CPU types, system types and aliases
|
||||
|
|
@ -60,8 +53,7 @@ timestamp='2009-12-31'
|
|||
me=`echo "$0" | sed -e 's,.*/,,'`
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION] CPU-MFR-OPSYS
|
||||
$0 [OPTION] ALIAS
|
||||
Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
|
||||
|
||||
Canonicalize a configuration name.
|
||||
|
||||
|
|
@ -75,9 +67,7 @@ Report bugs and patches to <config-patches@gnu.org>."
|
|||
version="\
|
||||
GNU config.sub ($timestamp)
|
||||
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
||||
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
|
||||
Software Foundation, Inc.
|
||||
Copyright 1992-2017 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."
|
||||
|
|
@ -124,13 +114,18 @@ esac
|
|||
# Here we must recognize all the valid KERNEL-OS combinations.
|
||||
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
||||
case $maybe_os in
|
||||
nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
|
||||
uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
|
||||
kopensolaris*-gnu* | \
|
||||
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
|
||||
linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
|
||||
knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
|
||||
kopensolaris*-gnu* | cloudabi*-eabi* | \
|
||||
storm-chaos* | os2-emx* | rtmk-nova*)
|
||||
os=-$maybe_os
|
||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
||||
;;
|
||||
android-linux)
|
||||
os=-linux-android
|
||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
|
||||
;;
|
||||
*)
|
||||
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
|
||||
if [ $basic_machine != $1 ]
|
||||
|
|
@ -153,12 +148,12 @@ case $os in
|
|||
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
|
||||
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
||||
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
|
||||
-apple | -axis | -knuth | -cray | -microblaze)
|
||||
-apple | -axis | -knuth | -cray | -microblaze*)
|
||||
os=
|
||||
basic_machine=$1
|
||||
;;
|
||||
-bluegene*)
|
||||
os=-cnk
|
||||
-bluegene*)
|
||||
os=-cnk
|
||||
;;
|
||||
-sim | -cisco | -oki | -wec | -winbond)
|
||||
os=
|
||||
|
|
@ -174,10 +169,10 @@ case $os in
|
|||
os=-chorusos
|
||||
basic_machine=$1
|
||||
;;
|
||||
-chorusrdb)
|
||||
os=-chorusrdb
|
||||
-chorusrdb)
|
||||
os=-chorusrdb
|
||||
basic_machine=$1
|
||||
;;
|
||||
;;
|
||||
-hiux*)
|
||||
os=-hiuxwe2
|
||||
;;
|
||||
|
|
@ -222,6 +217,12 @@ case $os in
|
|||
-isc*)
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-lynx*178)
|
||||
os=-lynxos178
|
||||
;;
|
||||
-lynx*5)
|
||||
os=-lynxos5
|
||||
;;
|
||||
-lynx*)
|
||||
os=-lynxos
|
||||
;;
|
||||
|
|
@ -246,20 +247,29 @@ case $basic_machine in
|
|||
# Some are omitted here because they have special meanings below.
|
||||
1750a | 580 \
|
||||
| a29k \
|
||||
| aarch64 | aarch64_be \
|
||||
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
|
||||
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
|
||||
| am33_2.0 \
|
||||
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
|
||||
| arc | arceb \
|
||||
| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
|
||||
| avr | avr32 \
|
||||
| ba \
|
||||
| be32 | be64 \
|
||||
| bfin \
|
||||
| c4x | clipper \
|
||||
| c4x | c8051 | clipper \
|
||||
| d10v | d30v | dlx | dsp16xx \
|
||||
| fido | fr30 | frv \
|
||||
| e2k | epiphany \
|
||||
| fido | fr30 | frv | ft32 \
|
||||
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
|
||||
| i370 | i860 | i960 | ia64 \
|
||||
| hexagon \
|
||||
| i370 | i860 | i960 | ia16 | ia64 \
|
||||
| ip2k | iq2000 \
|
||||
| k1om \
|
||||
| le32 | le64 \
|
||||
| lm32 \
|
||||
| m32c | m32r | m32rle | m68000 | m68k | m88k \
|
||||
| maxq | mb | microblaze | mcore | mep | metag \
|
||||
| maxq | mb | microblaze | microblazeel | mcore | mep | metag \
|
||||
| mips | mipsbe | mipseb | mipsel | mipsle \
|
||||
| mips16 \
|
||||
| mips64 | mips64el \
|
||||
|
|
@ -273,38 +283,57 @@ case $basic_machine in
|
|||
| mips64vr5900 | mips64vr5900el \
|
||||
| mipsisa32 | mipsisa32el \
|
||||
| mipsisa32r2 | mipsisa32r2el \
|
||||
| mipsisa32r6 | mipsisa32r6el \
|
||||
| mipsisa64 | mipsisa64el \
|
||||
| mipsisa64r2 | mipsisa64r2el \
|
||||
| mipsisa64r6 | mipsisa64r6el \
|
||||
| mipsisa64sb1 | mipsisa64sb1el \
|
||||
| mipsisa64sr71k | mipsisa64sr71kel \
|
||||
| mipsr5900 | mipsr5900el \
|
||||
| mipstx39 | mipstx39el \
|
||||
| mn10200 | mn10300 \
|
||||
| moxie \
|
||||
| mt \
|
||||
| msp430 \
|
||||
| nios | nios2 \
|
||||
| nds32 | nds32le | nds32be \
|
||||
| nios | nios2 | nios2eb | nios2el \
|
||||
| ns16k | ns32k \
|
||||
| or32 \
|
||||
| open8 | or1k | or1knd | or32 \
|
||||
| pdp10 | pdp11 | pj | pjl \
|
||||
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
|
||||
| powerpc | powerpc64 | powerpc64le | powerpcle \
|
||||
| pru \
|
||||
| pyramid \
|
||||
| rx \
|
||||
| riscv32 | riscv64 \
|
||||
| rl78 | rx \
|
||||
| score \
|
||||
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
|
||||
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
|
||||
| sh64 | sh64le \
|
||||
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
|
||||
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
|
||||
| spu | strongarm \
|
||||
| tahoe | thumb | tic4x | tic80 | tron \
|
||||
| spu \
|
||||
| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
|
||||
| ubicom32 \
|
||||
| v850 | v850e \
|
||||
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
|
||||
| visium \
|
||||
| wasm32 \
|
||||
| we32k \
|
||||
| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
|
||||
| x86 | xc16x | xstormy16 | xtensa \
|
||||
| z8k | z80)
|
||||
basic_machine=$basic_machine-unknown
|
||||
;;
|
||||
m6811 | m68hc11 | m6812 | m68hc12 | picochip)
|
||||
# Motorola 68HC11/12.
|
||||
c54x)
|
||||
basic_machine=tic54x-unknown
|
||||
;;
|
||||
c55x)
|
||||
basic_machine=tic55x-unknown
|
||||
;;
|
||||
c6x)
|
||||
basic_machine=tic6x-unknown
|
||||
;;
|
||||
leon|leon[3-9])
|
||||
basic_machine=sparc-$basic_machine
|
||||
;;
|
||||
m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
|
||||
basic_machine=$basic_machine-unknown
|
||||
os=-none
|
||||
;;
|
||||
|
|
@ -314,6 +343,21 @@ case $basic_machine in
|
|||
basic_machine=mt-unknown
|
||||
;;
|
||||
|
||||
strongarm | thumb | xscale)
|
||||
basic_machine=arm-unknown
|
||||
;;
|
||||
xgate)
|
||||
basic_machine=$basic_machine-unknown
|
||||
os=-none
|
||||
;;
|
||||
xscaleeb)
|
||||
basic_machine=armeb-unknown
|
||||
;;
|
||||
|
||||
xscaleel)
|
||||
basic_machine=armel-unknown
|
||||
;;
|
||||
|
||||
# We use `pc' rather than `unknown'
|
||||
# because (1) that's what they normally are, and
|
||||
# (2) the word "unknown" tends to confuse beginning users.
|
||||
|
|
@ -328,25 +372,32 @@ case $basic_machine in
|
|||
# Recognize the basic CPU types with company name.
|
||||
580-* \
|
||||
| a29k-* \
|
||||
| aarch64-* | aarch64_be-* \
|
||||
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
|
||||
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
|
||||
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
|
||||
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
|
||||
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
|
||||
| avr-* | avr32-* \
|
||||
| ba-* \
|
||||
| be32-* | be64-* \
|
||||
| bfin-* | bs2000-* \
|
||||
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
|
||||
| clipper-* | craynv-* | cydra-* \
|
||||
| c[123]* | c30-* | [cjt]90-* | c4x-* \
|
||||
| c8051-* | clipper-* | craynv-* | cydra-* \
|
||||
| d10v-* | d30v-* | dlx-* \
|
||||
| elxsi-* \
|
||||
| e2k-* | elxsi-* \
|
||||
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
|
||||
| h8300-* | h8500-* \
|
||||
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
|
||||
| i*86-* | i860-* | i960-* | ia64-* \
|
||||
| hexagon-* \
|
||||
| i*86-* | i860-* | i960-* | ia16-* | ia64-* \
|
||||
| ip2k-* | iq2000-* \
|
||||
| k1om-* \
|
||||
| le32-* | le64-* \
|
||||
| lm32-* \
|
||||
| m32c-* | m32r-* | m32rle-* \
|
||||
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
|
||||
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
|
||||
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
|
||||
| microblaze-* | microblazeel-* \
|
||||
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
|
||||
| mips16-* \
|
||||
| mips64-* | mips64el-* \
|
||||
|
|
@ -360,33 +411,45 @@ case $basic_machine in
|
|||
| mips64vr5900-* | mips64vr5900el-* \
|
||||
| mipsisa32-* | mipsisa32el-* \
|
||||
| mipsisa32r2-* | mipsisa32r2el-* \
|
||||
| mipsisa32r6-* | mipsisa32r6el-* \
|
||||
| mipsisa64-* | mipsisa64el-* \
|
||||
| mipsisa64r2-* | mipsisa64r2el-* \
|
||||
| mipsisa64r6-* | mipsisa64r6el-* \
|
||||
| mipsisa64sb1-* | mipsisa64sb1el-* \
|
||||
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
|
||||
| mipsr5900-* | mipsr5900el-* \
|
||||
| mipstx39-* | mipstx39el-* \
|
||||
| mmix-* \
|
||||
| mt-* \
|
||||
| msp430-* \
|
||||
| nios-* | nios2-* \
|
||||
| nds32-* | nds32le-* | nds32be-* \
|
||||
| nios-* | nios2-* | nios2eb-* | nios2el-* \
|
||||
| none-* | np1-* | ns16k-* | ns32k-* \
|
||||
| open8-* \
|
||||
| or1k*-* \
|
||||
| orion-* \
|
||||
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
|
||||
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
|
||||
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
|
||||
| pru-* \
|
||||
| pyramid-* \
|
||||
| romp-* | rs6000-* | rx-* \
|
||||
| riscv32-* | riscv64-* \
|
||||
| rl78-* | romp-* | rs6000-* | rx-* \
|
||||
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
|
||||
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
|
||||
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
|
||||
| sparclite-* \
|
||||
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
|
||||
| tahoe-* | thumb-* \
|
||||
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
|
||||
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
|
||||
| tahoe-* \
|
||||
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
|
||||
| tile*-* \
|
||||
| tron-* \
|
||||
| ubicom32-* \
|
||||
| v850-* | v850e-* | vax-* \
|
||||
| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
|
||||
| vax-* \
|
||||
| visium-* \
|
||||
| wasm32-* \
|
||||
| we32k-* \
|
||||
| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
|
||||
| x86-* | x86_64-* | xc16x-* | xps100-* \
|
||||
| xstormy16-* | xtensa*-* \
|
||||
| ymp-* \
|
||||
| z8k-* | z80-*)
|
||||
|
|
@ -411,7 +474,7 @@ case $basic_machine in
|
|||
basic_machine=a29k-amd
|
||||
os=-udi
|
||||
;;
|
||||
abacus)
|
||||
abacus)
|
||||
basic_machine=abacus-unknown
|
||||
;;
|
||||
adobe68k)
|
||||
|
|
@ -461,6 +524,9 @@ case $basic_machine in
|
|||
basic_machine=i386-pc
|
||||
os=-aros
|
||||
;;
|
||||
asmjs)
|
||||
basic_machine=asmjs-unknown
|
||||
;;
|
||||
aux)
|
||||
basic_machine=m68k-apple
|
||||
os=-aux
|
||||
|
|
@ -481,11 +547,20 @@ case $basic_machine in
|
|||
basic_machine=powerpc-ibm
|
||||
os=-cnk
|
||||
;;
|
||||
c54x-*)
|
||||
basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
c55x-*)
|
||||
basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
c6x-*)
|
||||
basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
c90)
|
||||
basic_machine=c90-cray
|
||||
os=-unicos
|
||||
;;
|
||||
cegcc)
|
||||
cegcc)
|
||||
basic_machine=arm-unknown
|
||||
os=-cegcc
|
||||
;;
|
||||
|
|
@ -517,7 +592,7 @@ case $basic_machine in
|
|||
basic_machine=craynv-cray
|
||||
os=-unicosmp
|
||||
;;
|
||||
cr16)
|
||||
cr16 | cr16-*)
|
||||
basic_machine=cr16-unknown
|
||||
os=-elf
|
||||
;;
|
||||
|
|
@ -572,6 +647,14 @@ case $basic_machine in
|
|||
basic_machine=m68k-bull
|
||||
os=-sysv3
|
||||
;;
|
||||
e500v[12])
|
||||
basic_machine=powerpc-unknown
|
||||
os=$os"spe"
|
||||
;;
|
||||
e500v[12]-*)
|
||||
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
os=$os"spe"
|
||||
;;
|
||||
ebmon29k)
|
||||
basic_machine=a29k-amd
|
||||
os=-ebmon
|
||||
|
|
@ -675,7 +758,6 @@ case $basic_machine in
|
|||
i370-ibm* | ibm*)
|
||||
basic_machine=i370-ibm
|
||||
;;
|
||||
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
|
||||
i*86v32)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv32
|
||||
|
|
@ -714,6 +796,9 @@ case $basic_machine in
|
|||
basic_machine=m68k-isi
|
||||
os=-sysv
|
||||
;;
|
||||
leon-*|leon[3-9]-*)
|
||||
basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
|
||||
;;
|
||||
m68knommu)
|
||||
basic_machine=m68k-unknown
|
||||
os=-linux
|
||||
|
|
@ -733,11 +818,15 @@ case $basic_machine in
|
|||
basic_machine=ns32k-utek
|
||||
os=-sysv
|
||||
;;
|
||||
microblaze)
|
||||
microblaze*)
|
||||
basic_machine=microblaze-xilinx
|
||||
;;
|
||||
mingw64)
|
||||
basic_machine=x86_64-pc
|
||||
os=-mingw64
|
||||
;;
|
||||
mingw32)
|
||||
basic_machine=i386-pc
|
||||
basic_machine=i686-pc
|
||||
os=-mingw32
|
||||
;;
|
||||
mingw32ce)
|
||||
|
|
@ -765,6 +854,10 @@ case $basic_machine in
|
|||
basic_machine=powerpc-unknown
|
||||
os=-morphos
|
||||
;;
|
||||
moxiebox)
|
||||
basic_machine=moxie-unknown
|
||||
os=-moxiebox
|
||||
;;
|
||||
msdos)
|
||||
basic_machine=i386-pc
|
||||
os=-msdos
|
||||
|
|
@ -772,10 +865,18 @@ case $basic_machine in
|
|||
ms1-*)
|
||||
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
|
||||
;;
|
||||
msys)
|
||||
basic_machine=i686-pc
|
||||
os=-msys
|
||||
;;
|
||||
mvs)
|
||||
basic_machine=i370-ibm
|
||||
os=-mvs
|
||||
;;
|
||||
nacl)
|
||||
basic_machine=le32-unknown
|
||||
os=-nacl
|
||||
;;
|
||||
ncr3000)
|
||||
basic_machine=i486-ncr
|
||||
os=-sysv4
|
||||
|
|
@ -840,9 +941,18 @@ case $basic_machine in
|
|||
np1)
|
||||
basic_machine=np1-gould
|
||||
;;
|
||||
neo-tandem)
|
||||
basic_machine=neo-tandem
|
||||
;;
|
||||
nse-tandem)
|
||||
basic_machine=nse-tandem
|
||||
;;
|
||||
nsr-tandem)
|
||||
basic_machine=nsr-tandem
|
||||
;;
|
||||
nsx-tandem)
|
||||
basic_machine=nsx-tandem
|
||||
;;
|
||||
op50n-* | op60c-*)
|
||||
basic_machine=hppa1.1-oki
|
||||
os=-proelf
|
||||
|
|
@ -922,11 +1032,12 @@ case $basic_machine in
|
|||
;;
|
||||
power) basic_machine=power-ibm
|
||||
;;
|
||||
ppc) basic_machine=powerpc-unknown
|
||||
ppc | ppcbe) basic_machine=powerpc-unknown
|
||||
;;
|
||||
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
ppc-* | ppcbe-*)
|
||||
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
ppcle | powerpclittle | ppc-le | powerpc-little)
|
||||
ppcle | powerpclittle)
|
||||
basic_machine=powerpcle-unknown
|
||||
;;
|
||||
ppcle-* | powerpclittle-*)
|
||||
|
|
@ -936,7 +1047,7 @@ case $basic_machine in
|
|||
;;
|
||||
ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
ppc64le | powerpc64little | ppc64-le | powerpc64-little)
|
||||
ppc64le | powerpc64little)
|
||||
basic_machine=powerpc64le-unknown
|
||||
;;
|
||||
ppc64le-* | powerpc64little-*)
|
||||
|
|
@ -949,7 +1060,11 @@ case $basic_machine in
|
|||
basic_machine=i586-unknown
|
||||
os=-pw32
|
||||
;;
|
||||
rdos)
|
||||
rdos | rdos64)
|
||||
basic_machine=x86_64-pc
|
||||
os=-rdos
|
||||
;;
|
||||
rdos32)
|
||||
basic_machine=i386-pc
|
||||
os=-rdos
|
||||
;;
|
||||
|
|
@ -1018,6 +1133,9 @@ case $basic_machine in
|
|||
basic_machine=i860-stratus
|
||||
os=-sysv4
|
||||
;;
|
||||
strongarm-* | thumb-*)
|
||||
basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
sun2)
|
||||
basic_machine=m68000-sun
|
||||
;;
|
||||
|
|
@ -1074,20 +1192,8 @@ case $basic_machine in
|
|||
basic_machine=t90-cray
|
||||
os=-unicos
|
||||
;;
|
||||
tic54x | c54x*)
|
||||
basic_machine=tic54x-unknown
|
||||
os=-coff
|
||||
;;
|
||||
tic55x | c55x*)
|
||||
basic_machine=tic55x-unknown
|
||||
os=-coff
|
||||
;;
|
||||
tic6x | c6x*)
|
||||
basic_machine=tic6x-unknown
|
||||
os=-coff
|
||||
;;
|
||||
tile*)
|
||||
basic_machine=tile-unknown
|
||||
basic_machine=$basic_machine-unknown
|
||||
os=-linux-gnu
|
||||
;;
|
||||
tx39)
|
||||
|
|
@ -1142,6 +1248,9 @@ case $basic_machine in
|
|||
basic_machine=a29k-wrs
|
||||
os=-vxworks
|
||||
;;
|
||||
wasm32)
|
||||
basic_machine=wasm32-unknown
|
||||
;;
|
||||
w65*)
|
||||
basic_machine=w65-wdc
|
||||
os=-none
|
||||
|
|
@ -1157,6 +1266,9 @@ case $basic_machine in
|
|||
xps | xps100)
|
||||
basic_machine=xps100-honeywell
|
||||
;;
|
||||
xscale-* | xscalee[bl]-*)
|
||||
basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
|
||||
;;
|
||||
ymp)
|
||||
basic_machine=ymp-cray
|
||||
os=-unicos
|
||||
|
|
@ -1254,11 +1366,11 @@ esac
|
|||
if [ x"$os" != x"" ]
|
||||
then
|
||||
case $os in
|
||||
# First match some system type aliases
|
||||
# that might get confused with valid system types.
|
||||
# First match some system type aliases
|
||||
# that might get confused with valid system types.
|
||||
# -solaris* is a basic system type, with this one exception.
|
||||
-auroraux)
|
||||
os=-auroraux
|
||||
-auroraux)
|
||||
os=-auroraux
|
||||
;;
|
||||
-solaris1 | -solaris1.*)
|
||||
os=`echo $os | sed -e 's|solaris1|sunos4|'`
|
||||
|
|
@ -1282,28 +1394,30 @@ case $os in
|
|||
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
|
||||
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
|
||||
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
|
||||
| -sym* | -kopensolaris* \
|
||||
| -sym* | -kopensolaris* | -plan9* \
|
||||
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
|
||||
| -aos* | -aros* \
|
||||
| -aos* | -aros* | -cloudabi* | -sortix* \
|
||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
|
||||
| -openbsd* | -solidbsd* \
|
||||
| -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
|
||||
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
|
||||
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||
| -chorusos* | -chorusrdb* | -cegcc* \
|
||||
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
|
||||
| -uxpv* | -beos* | -mpeix* | -udk* \
|
||||
| -chorusos* | -chorusrdb* | -cegcc* | -glidix* \
|
||||
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
|
||||
| -linux-newlib* | -linux-musl* | -linux-uclibc* \
|
||||
| -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
|
||||
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
|
||||
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
|
||||
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
|
||||
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
|
||||
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
|
||||
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
|
||||
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
|
||||
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
|
||||
| -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox*)
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
-qnx*)
|
||||
|
|
@ -1342,7 +1456,7 @@ case $os in
|
|||
-opened*)
|
||||
os=-openedition
|
||||
;;
|
||||
-os400*)
|
||||
-os400*)
|
||||
os=-os400
|
||||
;;
|
||||
-wince*)
|
||||
|
|
@ -1391,7 +1505,7 @@ case $os in
|
|||
-sinix*)
|
||||
os=-sysv4
|
||||
;;
|
||||
-tpf*)
|
||||
-tpf*)
|
||||
os=-tpf
|
||||
;;
|
||||
-triton*)
|
||||
|
|
@ -1427,17 +1541,16 @@ case $os in
|
|||
-aros*)
|
||||
os=-aros
|
||||
;;
|
||||
-kaos*)
|
||||
os=-kaos
|
||||
;;
|
||||
-zvmoe)
|
||||
os=-zvmoe
|
||||
;;
|
||||
-dicos*)
|
||||
os=-dicos
|
||||
;;
|
||||
-nacl*)
|
||||
;;
|
||||
-nacl*)
|
||||
;;
|
||||
-ios)
|
||||
;;
|
||||
-none)
|
||||
;;
|
||||
*)
|
||||
|
|
@ -1460,10 +1573,10 @@ else
|
|||
# system, and we'll never get to this point.
|
||||
|
||||
case $basic_machine in
|
||||
score-*)
|
||||
score-*)
|
||||
os=-elf
|
||||
;;
|
||||
spu-*)
|
||||
spu-*)
|
||||
os=-elf
|
||||
;;
|
||||
*-acorn)
|
||||
|
|
@ -1475,8 +1588,23 @@ case $basic_machine in
|
|||
arm*-semi)
|
||||
os=-aout
|
||||
;;
|
||||
c4x-* | tic4x-*)
|
||||
os=-coff
|
||||
c4x-* | tic4x-*)
|
||||
os=-coff
|
||||
;;
|
||||
c8051-*)
|
||||
os=-elf
|
||||
;;
|
||||
hexagon-*)
|
||||
os=-elf
|
||||
;;
|
||||
tic54x-*)
|
||||
os=-coff
|
||||
;;
|
||||
tic55x-*)
|
||||
os=-coff
|
||||
;;
|
||||
tic6x-*)
|
||||
os=-coff
|
||||
;;
|
||||
# This must come before the *-dec entry.
|
||||
pdp10-*)
|
||||
|
|
@ -1496,14 +1624,11 @@ case $basic_machine in
|
|||
;;
|
||||
m68000-sun)
|
||||
os=-sunos3
|
||||
# This also exists in the configure program, but was not the
|
||||
# default.
|
||||
# os=-sunos4
|
||||
;;
|
||||
m68*-cisco)
|
||||
os=-aout
|
||||
;;
|
||||
mep-*)
|
||||
mep-*)
|
||||
os=-elf
|
||||
;;
|
||||
mips*-cisco)
|
||||
|
|
@ -1521,6 +1646,9 @@ case $basic_machine in
|
|||
sparc-* | *-sun)
|
||||
os=-sunos4.1.1
|
||||
;;
|
||||
pru-*)
|
||||
os=-elf
|
||||
;;
|
||||
*-be)
|
||||
os=-beos
|
||||
;;
|
||||
|
|
@ -1530,7 +1658,7 @@ case $basic_machine in
|
|||
*-ibm)
|
||||
os=-aix
|
||||
;;
|
||||
*-knuth)
|
||||
*-knuth)
|
||||
os=-mmixware
|
||||
;;
|
||||
*-wec)
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
#! /bin/sh
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
|
||||
scriptversion=2012-03-27.16; # UTC
|
||||
scriptversion=2016-01-11.22; # UTC
|
||||
|
||||
# Copyright (C) 1999-2012 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2017 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -27,9 +27,9 @@ scriptversion=2012-03-27.16; # UTC
|
|||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
|
||||
|
|
@ -56,11 +56,65 @@ EOF
|
|||
;;
|
||||
esac
|
||||
|
||||
# Get the directory component of the given path, and save it in the
|
||||
# global variables '$dir'. Note that this directory component will
|
||||
# be either empty or ending with a '/' character. This is deliberate.
|
||||
set_dir_from ()
|
||||
{
|
||||
case $1 in
|
||||
*/*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
|
||||
*) dir=;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Get the suffix-stripped basename of the given path, and save it the
|
||||
# global variable '$base'.
|
||||
set_base_from ()
|
||||
{
|
||||
base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
|
||||
}
|
||||
|
||||
# If no dependency file was actually created by the compiler invocation,
|
||||
# we still have to create a dummy depfile, to avoid errors with the
|
||||
# Makefile "include basename.Plo" scheme.
|
||||
make_dummy_depfile ()
|
||||
{
|
||||
echo "#dummy" > "$depfile"
|
||||
}
|
||||
|
||||
# Factor out some common post-processing of the generated depfile.
|
||||
# Requires the auxiliary global variable '$tmpdepfile' to be set.
|
||||
aix_post_process_depfile ()
|
||||
{
|
||||
# If the compiler actually managed to produce a dependency file,
|
||||
# post-process it.
|
||||
if test -f "$tmpdepfile"; then
|
||||
# Each line is of the form 'foo.o: dependency.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# $object: dependency.h
|
||||
# and one to simply output
|
||||
# dependency.h:
|
||||
# which is needed to avoid the deleted-header problem.
|
||||
{ sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
|
||||
sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
|
||||
} > "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
else
|
||||
make_dummy_depfile
|
||||
fi
|
||||
}
|
||||
|
||||
# A tabulation character.
|
||||
tab=' '
|
||||
# A newline character.
|
||||
nl='
|
||||
'
|
||||
# Character ranges might be problematic outside the C locale.
|
||||
# These definitions help.
|
||||
upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
||||
lower=abcdefghijklmnopqrstuvwxyz
|
||||
digits=0123456789
|
||||
alpha=${upper}${lower}
|
||||
|
||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||
|
|
@ -74,6 +128,9 @@ tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
|||
|
||||
rm -f "$tmpdepfile"
|
||||
|
||||
# Avoid interferences from the environment.
|
||||
gccflag= dashmflag=
|
||||
|
||||
# Some modes work just like other modes, but use different flags. We
|
||||
# parameterize here, but still list the modes in the big case below,
|
||||
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||
|
|
@ -85,32 +142,32 @@ if test "$depmode" = hp; then
|
|||
fi
|
||||
|
||||
if test "$depmode" = dashXmstdout; then
|
||||
# This is just like dashmstdout with a different argument.
|
||||
dashmflag=-xM
|
||||
depmode=dashmstdout
|
||||
# This is just like dashmstdout with a different argument.
|
||||
dashmflag=-xM
|
||||
depmode=dashmstdout
|
||||
fi
|
||||
|
||||
cygpath_u="cygpath -u -f -"
|
||||
if test "$depmode" = msvcmsys; then
|
||||
# This is just like msvisualcpp but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u='sed s,\\\\,/,g'
|
||||
depmode=msvisualcpp
|
||||
# This is just like msvisualcpp but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u='sed s,\\\\,/,g'
|
||||
depmode=msvisualcpp
|
||||
fi
|
||||
|
||||
if test "$depmode" = msvc7msys; then
|
||||
# This is just like msvc7 but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u='sed s,\\\\,/,g'
|
||||
depmode=msvc7
|
||||
# This is just like msvc7 but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u='sed s,\\\\,/,g'
|
||||
depmode=msvc7
|
||||
fi
|
||||
|
||||
if test "$depmode" = xlc; then
|
||||
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations.
|
||||
gccflag=-qmakedep=gcc,-MF
|
||||
depmode=gcc
|
||||
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
|
||||
gccflag=-qmakedep=gcc,-MF
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
case "$depmode" in
|
||||
|
|
@ -133,8 +190,7 @@ gcc3)
|
|||
done
|
||||
"$@"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
|
|
@ -142,13 +198,17 @@ gcc3)
|
|||
;;
|
||||
|
||||
gcc)
|
||||
## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
|
||||
## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
|
||||
## (see the conditional assignment to $gccflag above).
|
||||
## There are various ways to get dependency output from gcc. Here's
|
||||
## why we pick this rather obscure method:
|
||||
## - Don't want to use -MD because we'd like the dependencies to end
|
||||
## up in a subdir. Having to rename by hand is ugly.
|
||||
## (We might end up doing this anyway to support other compilers.)
|
||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||
## -MM, not -M (despite what the docs say).
|
||||
## -MM, not -M (despite what the docs say). Also, it might not be
|
||||
## supported by the other compilers which use the 'gcc' depmode.
|
||||
## - Using -M directly means running the compiler twice (even worse
|
||||
## than renaming).
|
||||
if test -z "$gccflag"; then
|
||||
|
|
@ -156,15 +216,14 @@ gcc)
|
|||
fi
|
||||
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
|
||||
## The second -e expression handles DOS-style file names with drive letters.
|
||||
# The second -e expression handles DOS-style file names with drive
|
||||
# letters.
|
||||
sed -e 's/^[^:]*: / /' \
|
||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||
## This next piece of magic avoids the "deleted header file" problem.
|
||||
|
|
@ -173,15 +232,15 @@ gcc)
|
|||
## typically no way to rebuild the header). We avoid this by adding
|
||||
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||
## this for us directly.
|
||||
tr ' ' "$nl" < "$tmpdepfile" |
|
||||
## Some versions of gcc put a space before the ':'. On the theory
|
||||
## that the space means something, we add a space to the output as
|
||||
## well. hp depmode also adds that space, but also prefixes the VPATH
|
||||
## to the object. Take care to not repeat it in the output.
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
|
|
@ -199,8 +258,7 @@ sgi)
|
|||
"$@" -MDupdate "$tmpdepfile"
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
|
|
@ -208,7 +266,6 @@ sgi)
|
|||
|
||||
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
||||
echo "$object : \\" > "$depfile"
|
||||
|
||||
# Clip off the initial element (the dependent). Don't try to be
|
||||
# clever and replace this with sed code, as IRIX sed won't handle
|
||||
# lines with more than a fixed number of characters (4096 in
|
||||
|
|
@ -216,19 +273,15 @@ sgi)
|
|||
# the IRIX cc adds comments like '#:fec' to the end of the
|
||||
# dependency line.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
|
||||
tr "$nl" ' ' >> "$depfile"
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
|
||||
| tr "$nl" ' ' >> "$depfile"
|
||||
echo >> "$depfile"
|
||||
|
||||
# The second pass generates a dummy entry for each header file.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||
>> "$depfile"
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||
>> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
make_dummy_depfile
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
|
@ -246,9 +299,8 @@ aix)
|
|||
# current directory. Also, the AIX compiler puts '$object:' at the
|
||||
# start of each line; $object doesn't have directory information.
|
||||
# Version 6 uses the directory in both cases.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$base.u
|
||||
|
|
@ -261,9 +313,7 @@ aix)
|
|||
"$@" -M
|
||||
fi
|
||||
stat=$?
|
||||
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
|
@ -272,65 +322,113 @@ aix)
|
|||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
# Each line is of the form 'foo.o: dependent.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# '$object: dependent.h' and one to simply 'dependent.h:'.
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
aix_post_process_depfile
|
||||
;;
|
||||
|
||||
icc)
|
||||
# Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'.
|
||||
# However on
|
||||
# $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c
|
||||
# ICC 7.0 will fill foo.d with something like
|
||||
# foo.o: sub/foo.c
|
||||
# foo.o: sub/foo.h
|
||||
# which is wrong. We want
|
||||
# sub/foo.o: sub/foo.c
|
||||
# sub/foo.o: sub/foo.h
|
||||
# sub/foo.c:
|
||||
# sub/foo.h:
|
||||
# ICC 7.1 will output
|
||||
# foo.o: sub/foo.c sub/foo.h
|
||||
# and will wrap long lines using '\':
|
||||
# foo.o: sub/foo.c ... \
|
||||
# sub/foo.h ... \
|
||||
# ...
|
||||
# tcc 0.9.26 (FIXME still under development at the moment of writing)
|
||||
# will emit a similar output, but also prepend the continuation lines
|
||||
# with horizontal tabulation characters.
|
||||
tcc)
|
||||
# tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
|
||||
# FIXME: That version still under development at the moment of writing.
|
||||
# Make that this statement remains true also for stable, released
|
||||
# versions.
|
||||
# It will wrap lines (doesn't matter whether long or short) with a
|
||||
# trailing '\', as in:
|
||||
#
|
||||
# foo.o : \
|
||||
# foo.c \
|
||||
# foo.h \
|
||||
#
|
||||
# It will put a trailing '\' even on the last line, and will use leading
|
||||
# spaces rather than leading tabs (at least since its commit 0394caf7
|
||||
# "Emit spaces for -MD").
|
||||
"$@" -MD -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each line is of the form 'foo.o: dependent.h',
|
||||
# or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'.
|
||||
# Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
|
||||
# We have to change lines of the first kind to '$object: \'.
|
||||
sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
|
||||
# And for each line of the second kind, we have to emit a 'dep.h:'
|
||||
# dummy dependency, to avoid the deleted-header problem.
|
||||
sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
## The order of this option in the case statement is important, since the
|
||||
## shell code in configure will try each of these formats in the order
|
||||
## listed in this file. A plain '-MD' option would be understood by many
|
||||
## compilers, so we must ensure this comes after the gcc and icc options.
|
||||
pgcc)
|
||||
# Portland's C compiler understands '-MD'.
|
||||
# Will always output deps to 'file.d' where file is the root name of the
|
||||
# source file under compilation, even if file resides in a subdirectory.
|
||||
# The object file name does not affect the name of the '.d' file.
|
||||
# pgcc 10.2 will output
|
||||
# foo.o: sub/foo.c sub/foo.h
|
||||
# and will wrap long lines using '\' :
|
||||
# foo.o: sub/foo.c ... \
|
||||
# sub/foo.h ... \
|
||||
# ...
|
||||
set_dir_from "$object"
|
||||
# Use the source, not the object, to determine the base name, since
|
||||
# that's sadly what pgcc will do too.
|
||||
set_base_from "$source"
|
||||
tmpdepfile=$base.d
|
||||
|
||||
# For projects that build the same source file twice into different object
|
||||
# files, the pgcc approach of using the *source* file root name can cause
|
||||
# problems in parallel builds. Use a locking strategy to avoid stomping on
|
||||
# the same $tmpdepfile.
|
||||
lockdir=$base.d-lock
|
||||
trap "
|
||||
echo '$0: caught signal, cleaning up...' >&2
|
||||
rmdir '$lockdir'
|
||||
exit 1
|
||||
" 1 2 13 15
|
||||
numtries=100
|
||||
i=$numtries
|
||||
while test $i -gt 0; do
|
||||
# mkdir is a portable test-and-set.
|
||||
if mkdir "$lockdir" 2>/dev/null; then
|
||||
# This process acquired the lock.
|
||||
"$@" -MD
|
||||
stat=$?
|
||||
# Release the lock.
|
||||
rmdir "$lockdir"
|
||||
break
|
||||
else
|
||||
# If the lock is being held by a different process, wait
|
||||
# until the winning process is done or we timeout.
|
||||
while test -d "$lockdir" && test $i -gt 0; do
|
||||
sleep 1
|
||||
i=`expr $i - 1`
|
||||
done
|
||||
fi
|
||||
i=`expr $i - 1`
|
||||
done
|
||||
trap - 1 2 13 15
|
||||
if test $i -le 0; then
|
||||
echo "$0: failed to acquire lock after $numtries attempts" >&2
|
||||
echo "$0: check lockdir '$lockdir'" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each line is of the form `foo.o: dependent.h',
|
||||
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
|
||||
# Do two passes, one to just change these to
|
||||
# '$object: dependent.h' and one to simply 'dependent.h:'.
|
||||
sed -e "s/^[ $tab][ $tab]*/ /" -e "s,^[^:]*:,$object :," \
|
||||
< "$tmpdepfile" > "$depfile"
|
||||
sed '
|
||||
s/[ '"$tab"'][ '"$tab"']*/ /g
|
||||
s/^ *//
|
||||
s/ *\\*$//
|
||||
s/^[^:]*: *//
|
||||
/^$/d
|
||||
/:$/d
|
||||
s/$/ :/
|
||||
' < "$tmpdepfile" >> "$depfile"
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
|
|
@ -341,9 +439,8 @@ hp2)
|
|||
# 'foo.d', which lands next to the object file, wherever that
|
||||
# happens to be.
|
||||
# Much of this is similar to the tru64 case; see comments there.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir.libs/$base.d
|
||||
|
|
@ -354,8 +451,7 @@ hp2)
|
|||
"$@" +Maked
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||
exit $stat
|
||||
fi
|
||||
|
|
@ -365,76 +461,61 @@ hp2)
|
|||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
|
||||
sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
|
||||
# Add 'dependent.h:' lines.
|
||||
sed -ne '2,${
|
||||
s/^ *//
|
||||
s/ \\*$//
|
||||
s/$/:/
|
||||
p
|
||||
}' "$tmpdepfile" >> "$depfile"
|
||||
s/^ *//
|
||||
s/ \\*$//
|
||||
s/$/:/
|
||||
p
|
||||
}' "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
make_dummy_depfile
|
||||
fi
|
||||
rm -f "$tmpdepfile" "$tmpdepfile2"
|
||||
;;
|
||||
|
||||
tru64)
|
||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||
# effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in 'foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||
# effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in 'foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
|
||||
if test "$libtool" = yes; then
|
||||
# With Tru64 cc, shared objects can also be used to make a
|
||||
# static library. This mechanism is used in libtool 1.4 series to
|
||||
# handle both shared and static libraries in a single compilation.
|
||||
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
|
||||
#
|
||||
# With libtool 1.5 this exception was removed, and libtool now
|
||||
# generates 2 separate objects for the 2 libraries. These two
|
||||
# compilations output dependencies in $dir.libs/$base.o.d and
|
||||
# in $dir$base.o.d. We have to check for both files, because
|
||||
# one of the two compilations can be disabled. We should prefer
|
||||
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
|
||||
# automatically cleaned when .libs/ is deleted, while ignoring
|
||||
# the former would cause a distcleancheck panic.
|
||||
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
|
||||
tmpdepfile2=$dir$base.o.d # libtool 1.5
|
||||
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
|
||||
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
tmpdepfile1=$dir$base.o.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
tmpdepfile3=$dir$base.d
|
||||
tmpdepfile4=$dir$base.d
|
||||
"$@" -MD
|
||||
fi
|
||||
if test "$libtool" = yes; then
|
||||
# Libtool generates 2 separate objects for the 2 libraries. These
|
||||
# two compilations output dependencies in $dir.libs/$base.o.d and
|
||||
# in $dir$base.o.d. We have to check for both files, because
|
||||
# one of the two compilations can be disabled. We should prefer
|
||||
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
|
||||
# automatically cleaned when .libs/ is deleted, while ignoring
|
||||
# the former would cause a distcleancheck panic.
|
||||
tmpdepfile1=$dir$base.o.d # libtool 1.5
|
||||
tmpdepfile2=$dir.libs/$base.o.d # Likewise.
|
||||
tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
tmpdepfile3=$dir$base.d
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||
exit $stat
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
# Same post-processing that is required for AIX mode.
|
||||
aix_post_process_depfile
|
||||
;;
|
||||
|
||||
msvc7)
|
||||
if test "$libtool" = yes; then
|
||||
|
|
@ -445,8 +526,7 @@ msvc7)
|
|||
"$@" $showIncludes > "$tmpdepfile"
|
||||
stat=$?
|
||||
grep -v '^Note: including file: ' "$tmpdepfile"
|
||||
if test "$stat" = 0; then :
|
||||
else
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
|
|
@ -472,6 +552,7 @@ $ {
|
|||
G
|
||||
p
|
||||
}' >> "$depfile"
|
||||
echo >> "$depfile" # make sure the fragment doesn't end with a backslash
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
|
|
@ -523,13 +604,14 @@ dashmstdout)
|
|||
# in the target name. This is to cope with DOS-style filenames:
|
||||
# a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
|
||||
"$@" $dashmflag |
|
||||
sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile"
|
||||
sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
tr ' ' "$nl" < "$tmpdepfile" | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this sed invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
|
|
@ -582,10 +664,12 @@ makedepend)
|
|||
# makedepend may prepend the VPATH from the source file name to the object.
|
||||
# No need to regex-escape $object, excess matching of '.' is harmless.
|
||||
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
|
||||
sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process the last invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed '1,2d' "$tmpdepfile" \
|
||||
| tr ' ' "$nl" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||
;;
|
||||
|
||||
|
|
@ -621,10 +705,10 @@ cpp)
|
|||
esac
|
||||
done
|
||||
|
||||
"$@" -E |
|
||||
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
|
||||
sed '$ s: \\$::' > "$tmpdepfile"
|
||||
"$@" -E \
|
||||
| sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
| sed '$ s: \\$::' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
cat < "$tmpdepfile" >> "$depfile"
|
||||
|
|
@ -656,15 +740,15 @@ msvisualcpp)
|
|||
shift
|
||||
;;
|
||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||
set fnord "$@"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
set fnord "$@"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
set fnord "$@" "$arg"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
"$@" -E 2>/dev/null |
|
||||
|
|
@ -702,6 +786,6 @@ exit 0
|
|||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
|
|
|
|||
|
|
@ -1,301 +1,501 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# $NetBSD: install-sh.in,v 1.6 2012/01/11 13:07:31 hans Exp $
|
||||
# This script now also installs multiple files, but might choke on installing
|
||||
# multiple files with spaces in the file names.
|
||||
#
|
||||
# install - install a program, script, or datafile
|
||||
# This comes from X11R5 (mit/util/scripts/install.sh).
|
||||
|
||||
scriptversion=2016-01-11.22; # UTC
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright 1991 by the Massachusetts Institute of Technology
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission to use, copy, modify, distribute, and sell this software and its
|
||||
# documentation for any purpose is hereby granted without fee, provided that
|
||||
# the above copyright notice appear in all copies and that both that
|
||||
# copyright notice and this permission notice appear in supporting
|
||||
# documentation, and that the name of M.I.T. not be used in advertising or
|
||||
# publicity pertaining to distribution of the software without specific,
|
||||
# written prior permission. M.I.T. makes no representations about the
|
||||
# suitability of this software for any purpose. It is provided "as is"
|
||||
# without express or implied warranty.
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# 'make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit="${DOITPROG-}"
|
||||
|
||||
|
||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||
|
||||
awkprog="${AWKPROG-awk}"
|
||||
mvprog="${MVPROG-mv}"
|
||||
cpprog="${CPPROG-cp}"
|
||||
chmodprog="${CHMODPROG-chmod}"
|
||||
chownprog="${CHOWNPROG-chown}"
|
||||
chgrpprog="${CHGRPPROG-chgrp}"
|
||||
stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
mkdirprog="${MKDIRPROG-mkdir}"
|
||||
|
||||
instcmd="$cpprog"
|
||||
instflags=""
|
||||
pathcompchmodcmd="$chmodprog 755"
|
||||
chmodcmd="$chmodprog 755"
|
||||
chowncmd=""
|
||||
chgrpcmd=""
|
||||
stripcmd=""
|
||||
stripflags=""
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
src=""
|
||||
msrc=""
|
||||
dst=""
|
||||
dir_arg=""
|
||||
suffix=""
|
||||
suffixfmt=""
|
||||
|
||||
while [ x"$1" != x ]; do
|
||||
case $1 in
|
||||
-b) suffix=".old"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-B) suffixfmt="$2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-c) instcmd="$cpprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-d) dir_arg=true
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-m*)
|
||||
chmodcmd="$chmodprog ${1#-m}"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-s) stripcmd="$stripprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-S) stripcmd="$stripprog"
|
||||
stripflags="-S $2 $stripflags"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-p) instflags="-p"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
*) if [ x"$msrc" = x ]
|
||||
then
|
||||
msrc="$dst"
|
||||
else
|
||||
msrc="$msrc $dst"
|
||||
fi
|
||||
src="$dst"
|
||||
dst="$1"
|
||||
shift
|
||||
continue;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ x"$dir_arg" = x ]
|
||||
then
|
||||
dstisfile=""
|
||||
if [ ! -d "$dst" ]
|
||||
then
|
||||
if [ x"$msrc" = x"$src" ]
|
||||
then
|
||||
dstisfile=true
|
||||
else
|
||||
echo "install: destination is not a directory"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
else
|
||||
msrc="$msrc $dst"
|
||||
fi
|
||||
|
||||
if [ x"$msrc" = x ]
|
||||
then
|
||||
echo "install: no destination specified"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for srcarg in $msrc; do
|
||||
|
||||
if [ x"$dir_arg" != x ]; then
|
||||
|
||||
dstarg="$srcarg"
|
||||
else
|
||||
dstarg="$dst"
|
||||
|
||||
# Waiting for this to be detected by the "$instcmd $srcarg $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
|
||||
if [ -f "$srcarg" ]
|
||||
then
|
||||
doinst="$instcmd $instflags"
|
||||
elif [ -d "$srcarg" ]
|
||||
then
|
||||
echo "install: $srcarg: not a regular file"
|
||||
exit 1
|
||||
elif [ "$srcarg" = "/dev/null" ]
|
||||
then
|
||||
doinst="$cpprog"
|
||||
else
|
||||
echo "install: $srcarg does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# If destination is a directory, append the input filename; if your system
|
||||
# does not like double slashes in filenames, you may need to add some logic
|
||||
|
||||
if [ -d "$dstarg" ]
|
||||
then
|
||||
dstarg="$dstarg"/`basename "$srcarg"`
|
||||
fi
|
||||
fi
|
||||
|
||||
## this sed command emulates the dirname command
|
||||
dstdir=`echo "$dstarg" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
|
||||
# Make sure that the destination directory exists.
|
||||
# this part is taken from Noah Friedman's mkinstalldirs script
|
||||
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if [ ! -d "$dstdir" ]; then
|
||||
defaultIFS='
|
||||
tab=' '
|
||||
nl='
|
||||
'
|
||||
IFS="${IFS-${defaultIFS}}"
|
||||
IFS=" $tab$nl"
|
||||
|
||||
oIFS="${IFS}"
|
||||
# Some sh's can't handle IFS=/ for some reason.
|
||||
IFS='%'
|
||||
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||
IFS="${oIFS}"
|
||||
# Set DOITPROG to "echo" to test this script.
|
||||
|
||||
pathcomp=''
|
||||
doit=${DOITPROG-}
|
||||
doit_exec=${doit:-exec}
|
||||
|
||||
while [ $# -ne 0 ] ; do
|
||||
pathcomp="${pathcomp}${1}"
|
||||
shift
|
||||
# Put in absolute file names if you don't have them in your path;
|
||||
# or use environment vars.
|
||||
|
||||
if [ ! -d "${pathcomp}" ] ;
|
||||
then
|
||||
$doit $mkdirprog "${pathcomp}"
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd "${pathcomp}"; else true ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "${pathcomp}"; else true ; fi &&
|
||||
if [ x"$pathcompchmodcmd" != x ]; then $doit $pathcompchmodcmd "${pathcomp}"; else true ; fi
|
||||
chgrpprog=${CHGRPPROG-chgrp}
|
||||
chmodprog=${CHMODPROG-chmod}
|
||||
chownprog=${CHOWNPROG-chown}
|
||||
cmpprog=${CMPPROG-cmp}
|
||||
cpprog=${CPPROG-cp}
|
||||
mkdirprog=${MKDIRPROG-mkdir}
|
||||
mvprog=${MVPROG-mv}
|
||||
rmprog=${RMPROG-rm}
|
||||
stripprog=${STRIPPROG-strip}
|
||||
|
||||
else
|
||||
true
|
||||
fi
|
||||
posix_mkdir=
|
||||
|
||||
pathcomp="${pathcomp}/"
|
||||
# Desired mode of installed file.
|
||||
mode=0755
|
||||
|
||||
chgrpcmd=
|
||||
chmodcmd=$chmodprog
|
||||
chowncmd=
|
||||
mvcmd=$mvprog
|
||||
rmcmd="$rmprog -f"
|
||||
stripcmd=
|
||||
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dst_arg=
|
||||
|
||||
copy_on_change=false
|
||||
is_target_a_directory=possibly
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||
or: $0 [OPTION]... -d DIRECTORIES...
|
||||
|
||||
In the 1st form, copy SRCFILE to DSTFILE.
|
||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||
In the 4th, create DIRECTORIES.
|
||||
|
||||
Options:
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
|
||||
-c (ignored)
|
||||
-C install only if different (preserve the last data modification time)
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrpprog installed files to GROUP.
|
||||
-m MODE $chmodprog installed files to MODE.
|
||||
-o USER $chownprog installed files to USER.
|
||||
-s $stripprog installed files.
|
||||
-t DIRECTORY install into DIRECTORY.
|
||||
-T report an error if DSTFILE is a directory.
|
||||
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
||||
RMPROG STRIPPROG
|
||||
"
|
||||
|
||||
while test $# -ne 0; do
|
||||
case $1 in
|
||||
-c) ;;
|
||||
|
||||
-C) copy_on_change=true;;
|
||||
|
||||
-d) dir_arg=true;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift;;
|
||||
|
||||
--help) echo "$usage"; exit $?;;
|
||||
|
||||
-m) mode=$2
|
||||
case $mode in
|
||||
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
|
||||
echo "$0: invalid mode: $mode" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift;;
|
||||
|
||||
-s) stripcmd=$stripprog;;
|
||||
|
||||
-t)
|
||||
is_target_a_directory=always
|
||||
dst_arg=$2
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-T) is_target_a_directory=never;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;;
|
||||
|
||||
--) shift
|
||||
break;;
|
||||
|
||||
-*) echo "$0: invalid option: $1" >&2
|
||||
exit 1;;
|
||||
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# We allow the use of options -d and -T together, by making -d
|
||||
# take the precedence; this is for compatibility with GNU install.
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
if test -n "$dst_arg"; then
|
||||
echo "$0: target directory not allowed when installing a directory." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]
|
||||
then
|
||||
if [ -d "$dstarg" ]; then
|
||||
true
|
||||
else
|
||||
$doit $mkdirprog "$dstarg" &&
|
||||
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
||||
# When -d is used, all remaining arguments are directories to create.
|
||||
# When -t is used, the destination is already specified.
|
||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||
for arg
|
||||
do
|
||||
if test -n "$dst_arg"; then
|
||||
# $@ is not empty: it contains at least $arg.
|
||||
set fnord "$@" "$dst_arg"
|
||||
shift # fnord
|
||||
fi
|
||||
shift # arg
|
||||
dst_arg=$arg
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dstarg"; else true ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dstarg"; else true ; fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dstarg"; else true ; fi
|
||||
fi
|
||||
else
|
||||
if test $# -eq 0; then
|
||||
if test -z "$dir_arg"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call 'install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ x"$dstisfile" = x ]
|
||||
then
|
||||
file=$srcarg
|
||||
else
|
||||
file=$dst
|
||||
fi
|
||||
if test -z "$dir_arg"; then
|
||||
if test $# -gt 1 || test "$is_target_a_directory" = always; then
|
||||
if test ! -d "$dst_arg"; then
|
||||
echo "$0: $dst_arg: Is not a directory." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
dstfile=`basename "$file"`
|
||||
dstfinal="$dstdir/$dstfile"
|
||||
if test -z "$dir_arg"; then
|
||||
do_exit='(exit $ret); exit $ret'
|
||||
trap "ret=129; $do_exit" 1
|
||||
trap "ret=130; $do_exit" 2
|
||||
trap "ret=141; $do_exit" 13
|
||||
trap "ret=143; $do_exit" 15
|
||||
|
||||
# Make a temp file name in the proper directory.
|
||||
# Set umask so as not to create temps with too-generous modes.
|
||||
# However, 'strip' requires both read and write access to temps.
|
||||
case $mode in
|
||||
# Optimize common cases.
|
||||
*644) cp_umask=133;;
|
||||
*755) cp_umask=22;;
|
||||
|
||||
dsttmp=$dstdir/#inst.$$#
|
||||
*[0-7])
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw='% 200'
|
||||
fi
|
||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
|
||||
*)
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw=,u+rw
|
||||
fi
|
||||
cp_umask=$mode$u_plus_rw;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Make a backup file name in the proper directory.
|
||||
case x$suffixfmt in
|
||||
*%*) suffix=`echo x |
|
||||
$awkprog -v bname="$dstfinal" -v fmt="$suffixfmt" '
|
||||
{ cnt = 0;
|
||||
do {
|
||||
sfx = sprintf(fmt, cnt++);
|
||||
name = bname sfx;
|
||||
} while (system("test -f " name) == 0);
|
||||
print sfx; }' -`;;
|
||||
x) ;;
|
||||
*) suffix="$suffixfmt";;
|
||||
esac
|
||||
dstbackup="$dstfinal$suffix"
|
||||
for src
|
||||
do
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $src in
|
||||
-* | [=\(\)!]) src=./$src;;
|
||||
esac
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
if test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
dstdir=$dst
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
else
|
||||
|
||||
$doit $doinst $srcarg "$dsttmp" &&
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
trap "rm -f ${dsttmp}" 0 &&
|
||||
if test -z "$dst_arg"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
dst=$dst_arg
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits
|
||||
# If destination is a directory, append the input filename; won't work
|
||||
# if double slashes aren't ignored.
|
||||
if test -d "$dst"; then
|
||||
if test "$is_target_a_directory" = never; then
|
||||
echo "$0: $dst_arg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dstdir=$dst
|
||||
dst=$dstdir/`basename "$src"`
|
||||
dstdir_status=0
|
||||
else
|
||||
dstdir=`dirname "$dst"`
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||
obsolete_mkdir_used=false
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else true;fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else true;fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $stripflags "$dsttmp"; else true;fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else true;fi &&
|
||||
if test $dstdir_status != 0; then
|
||||
case $posix_mkdir in
|
||||
'')
|
||||
# Create intermediate dirs using mode 755 as modified by the umask.
|
||||
# This is like FreeBSD 'install' as of 1997-10-28.
|
||||
umask=`umask`
|
||||
case $stripcmd.$umask in
|
||||
# Optimize common cases.
|
||||
*[2367][2367]) mkdir_umask=$umask;;
|
||||
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
*[0-7])
|
||||
mkdir_umask=`expr $umask + 22 \
|
||||
- $umask % 100 % 40 + $umask % 20 \
|
||||
- $umask % 10 % 4 + $umask % 2
|
||||
`;;
|
||||
*) mkdir_umask=$umask,go-w;;
|
||||
esac
|
||||
|
||||
if [ x"$suffix" != x ] && [ -f "$dstfinal" ]
|
||||
then
|
||||
$doit $mvcmd "$dstfinal" "$dstbackup"
|
||||
else
|
||||
$doit $rmcmd -f "$dstfinal"
|
||||
fi &&
|
||||
$doit $mvcmd "$dsttmp" "$dstfinal"
|
||||
fi
|
||||
# With -d, create the new directory with the user-specified mode.
|
||||
# Otherwise, rely on $mkdir_umask.
|
||||
if test -n "$dir_arg"; then
|
||||
mkdir_mode=-m$mode
|
||||
else
|
||||
mkdir_mode=
|
||||
fi
|
||||
|
||||
done &&
|
||||
posix_mkdir=false
|
||||
case $umask in
|
||||
*[123567][0-7][0-7])
|
||||
# POSIX mkdir -p sets u+wx bits regardless of umask, which
|
||||
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
|
||||
;;
|
||||
*)
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
|
||||
|
||||
if (umask $mkdir_umask &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
|
||||
then
|
||||
if test -z "$dir_arg" || {
|
||||
# Check for POSIX incompatibilities with -m.
|
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||
# other-writable bit of parent directory when it shouldn't.
|
||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
||||
ls_ld_tmpdir=`ls -ld "$tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/d" "$tmpdir"
|
||||
else
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
if
|
||||
$posix_mkdir && (
|
||||
umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
||||
)
|
||||
then :
|
||||
else
|
||||
|
||||
# The umask is ridiculous, or mkdir does not conform to POSIX,
|
||||
# or it failed possibly due to a race condition. Create the
|
||||
# directory the slow way, step by step, checking for races as we go.
|
||||
|
||||
case $dstdir in
|
||||
/*) prefix='/';;
|
||||
[-=\(\)!]*) prefix='./';;
|
||||
*) prefix='';;
|
||||
esac
|
||||
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
set -f
|
||||
set fnord $dstdir
|
||||
shift
|
||||
set +f
|
||||
IFS=$oIFS
|
||||
|
||||
prefixes=
|
||||
|
||||
for d
|
||||
do
|
||||
test X"$d" = X && continue
|
||||
|
||||
prefix=$prefix$d
|
||||
if test -d "$prefix"; then
|
||||
prefixes=
|
||||
else
|
||||
if $posix_mkdir; then
|
||||
(umask=$mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
||||
# Don't fail if two instances are running concurrently.
|
||||
test -d "$prefix" || exit 1
|
||||
else
|
||||
case $prefix in
|
||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
||||
*) qprefix=$prefix;;
|
||||
esac
|
||||
prefixes="$prefixes '$qprefix'"
|
||||
fi
|
||||
fi
|
||||
prefix=$prefix/
|
||||
done
|
||||
|
||||
if test -n "$prefixes"; then
|
||||
# Don't fail if two instances are running concurrently.
|
||||
(umask $mkdir_umask &&
|
||||
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
||||
test -d "$dstdir" || exit 1
|
||||
obsolete_mkdir_used=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
|
||||
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
|
||||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
|
||||
else
|
||||
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=$dstdir/_inst.$$_
|
||||
rmtmp=$dstdir/_rm.$$_
|
||||
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||
|
||||
# Copy the file name to the temp name.
|
||||
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
|
||||
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
|
||||
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
||||
|
||||
# If -C, don't bother to copy if it wouldn't change the file.
|
||||
if $copy_on_change &&
|
||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||
set -f &&
|
||||
set X $old && old=:$2:$4:$5:$6 &&
|
||||
set X $new && new=:$2:$4:$5:$6 &&
|
||||
set +f &&
|
||||
test "$old" = "$new" &&
|
||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||
then
|
||||
rm -f "$dsttmp"
|
||||
else
|
||||
# Rename the file to the real destination.
|
||||
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
||||
|
||||
# The rename failed, perhaps because mv can't rename something else
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
{
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
test ! -f "$dst" ||
|
||||
$doit $rmcmd -f "$dst" 2>/dev/null ||
|
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
|
||||
} ||
|
||||
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||
(exit 1); exit 1
|
||||
}
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dst"
|
||||
}
|
||||
fi || exit 1
|
||||
|
||||
trap '' 0
|
||||
fi
|
||||
done
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
|
|
|
|||
8071
unit/atf-src/admin/ltmain.sh
Executable file → Normal file
8071
unit/atf-src/admin/ltmain.sh
Executable file → Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1,10 +1,10 @@
|
|||
#! /bin/sh
|
||||
# Common stub for a few missing GNU programs while installing.
|
||||
# Common wrapper for a few potentially missing GNU programs.
|
||||
|
||||
scriptversion=2012-01-06.18; # UTC
|
||||
scriptversion=2016-01-11.22; # UTC
|
||||
|
||||
# Copyright (C) 1996-2012 Free Software Foundation, Inc.
|
||||
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||
# Copyright (C) 1996-2017 Free Software Foundation, Inc.
|
||||
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -29,61 +29,33 @@ if test $# -eq 0; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
run=:
|
||||
sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
|
||||
sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
|
||||
|
||||
# In the cases where this matters, 'missing' is being run in the
|
||||
# srcdir already.
|
||||
if test -f configure.ac; then
|
||||
configure_ac=configure.ac
|
||||
else
|
||||
configure_ac=configure.in
|
||||
fi
|
||||
|
||||
msg="missing on your system"
|
||||
|
||||
case $1 in
|
||||
--run)
|
||||
# Try to run requested program, and just exit if it succeeds.
|
||||
run=
|
||||
shift
|
||||
"$@" && exit 0
|
||||
# Exit code 63 means version mismatch. This often happens
|
||||
# when the user try to use an ancient version of a tool on
|
||||
# a file that requires a minimum version. In this case we
|
||||
# we should proceed has if the program had been absent, or
|
||||
# if --run hadn't been passed.
|
||||
if test $? = 63; then
|
||||
run=:
|
||||
msg="probably too old"
|
||||
fi
|
||||
;;
|
||||
|
||||
--is-lightweight)
|
||||
# Used by our autoconf macros to check whether the available missing
|
||||
# script is modern enough.
|
||||
exit 0
|
||||
;;
|
||||
|
||||
--run)
|
||||
# Back-compat with the calling convention used by older automake.
|
||||
shift
|
||||
;;
|
||||
|
||||
-h|--h|--he|--hel|--help)
|
||||
echo "\
|
||||
$0 [OPTION]... PROGRAM [ARGUMENT]...
|
||||
|
||||
Handle 'PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
|
||||
error status if there is no known handling for PROGRAM.
|
||||
Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
|
||||
to PROGRAM being missing or too old.
|
||||
|
||||
Options:
|
||||
-h, --help display this help and exit
|
||||
-v, --version output version information and exit
|
||||
--run try to run the given command, and emulate it if it fails
|
||||
|
||||
Supported PROGRAM values:
|
||||
aclocal touch file 'aclocal.m4'
|
||||
autoconf touch file 'configure'
|
||||
autoheader touch file 'config.h.in'
|
||||
autom4te touch the output file, or create a stub one
|
||||
automake touch all 'Makefile.in' files
|
||||
bison create 'y.tab.[ch]', if possible, from existing .[ch]
|
||||
flex create 'lex.yy.c', if possible, from existing .c
|
||||
help2man touch the output file
|
||||
lex create 'lex.yy.c', if possible, from existing .c
|
||||
makeinfo touch the output file
|
||||
yacc create 'y.tab.[ch]', if possible, from existing .[ch]
|
||||
aclocal autoconf autoheader autom4te automake makeinfo
|
||||
bison yacc flex lex help2man
|
||||
|
||||
Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
|
||||
'g' are ignored when checking the name.
|
||||
|
|
@ -98,233 +70,146 @@ Send bug reports to <bug-automake@gnu.org>."
|
|||
;;
|
||||
|
||||
-*)
|
||||
echo 1>&2 "$0: Unknown '$1' option"
|
||||
echo 1>&2 "$0: unknown '$1' option"
|
||||
echo 1>&2 "Try '$0 --help' for more information"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
# normalize program name to check for.
|
||||
program=`echo "$1" | sed '
|
||||
s/^gnu-//; t
|
||||
s/^gnu//; t
|
||||
s/^g//; t'`
|
||||
# Run the given program, remember its exit status.
|
||||
"$@"; st=$?
|
||||
|
||||
# Now exit if we have it, but it failed. Also exit now if we
|
||||
# don't have it and --version was passed (most likely to detect
|
||||
# the program). This is about non-GNU programs, so use $1 not
|
||||
# $program.
|
||||
case $1 in
|
||||
lex*|yacc*)
|
||||
# Not GNU programs, they don't have --version.
|
||||
# If it succeeded, we are done.
|
||||
test $st -eq 0 && exit 0
|
||||
|
||||
# Also exit now if we it failed (or wasn't found), and '--version' was
|
||||
# passed; such an option is passed most likely to detect whether the
|
||||
# program is present and works.
|
||||
case $2 in --version|--help) exit $st;; esac
|
||||
|
||||
# Exit code 63 means version mismatch. This often happens when the user
|
||||
# tries to use an ancient version of a tool on a file that requires a
|
||||
# minimum version.
|
||||
if test $st -eq 63; then
|
||||
msg="probably too old"
|
||||
elif test $st -eq 127; then
|
||||
# Program was missing.
|
||||
msg="missing on your system"
|
||||
else
|
||||
# Program was found and executed, but failed. Give up.
|
||||
exit $st
|
||||
fi
|
||||
|
||||
perl_URL=http://www.perl.org/
|
||||
flex_URL=http://flex.sourceforge.net/
|
||||
gnu_software_URL=http://www.gnu.org/software
|
||||
|
||||
program_details ()
|
||||
{
|
||||
case $1 in
|
||||
aclocal|automake)
|
||||
echo "The '$1' program is part of the GNU Automake package:"
|
||||
echo "<$gnu_software_URL/automake>"
|
||||
echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
|
||||
echo "<$gnu_software_URL/autoconf>"
|
||||
echo "<$gnu_software_URL/m4/>"
|
||||
echo "<$perl_URL>"
|
||||
;;
|
||||
autoconf|autom4te|autoheader)
|
||||
echo "The '$1' program is part of the GNU Autoconf package:"
|
||||
echo "<$gnu_software_URL/autoconf/>"
|
||||
echo "It also requires GNU m4 and Perl in order to run:"
|
||||
echo "<$gnu_software_URL/m4/>"
|
||||
echo "<$perl_URL>"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
give_advice ()
|
||||
{
|
||||
# Normalize program name to check for.
|
||||
normalized_program=`echo "$1" | sed '
|
||||
s/^gnu-//; t
|
||||
s/^gnu//; t
|
||||
s/^g//; t'`
|
||||
|
||||
printf '%s\n' "'$1' is $msg."
|
||||
|
||||
configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
|
||||
case $normalized_program in
|
||||
autoconf*)
|
||||
echo "You should only need it if you modified 'configure.ac',"
|
||||
echo "or m4 files included by it."
|
||||
program_details 'autoconf'
|
||||
;;
|
||||
autoheader*)
|
||||
echo "You should only need it if you modified 'acconfig.h' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'autoheader'
|
||||
;;
|
||||
automake*)
|
||||
echo "You should only need it if you modified 'Makefile.am' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'automake'
|
||||
;;
|
||||
aclocal*)
|
||||
echo "You should only need it if you modified 'acinclude.m4' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'aclocal'
|
||||
;;
|
||||
autom4te*)
|
||||
echo "You might have modified some maintainer files that require"
|
||||
echo "the 'autom4te' program to be rebuilt."
|
||||
program_details 'autom4te'
|
||||
;;
|
||||
bison*|yacc*)
|
||||
echo "You should only need it if you modified a '.y' file."
|
||||
echo "You may want to install the GNU Bison package:"
|
||||
echo "<$gnu_software_URL/bison/>"
|
||||
;;
|
||||
lex*|flex*)
|
||||
echo "You should only need it if you modified a '.l' file."
|
||||
echo "You may want to install the Fast Lexical Analyzer package:"
|
||||
echo "<$flex_URL>"
|
||||
;;
|
||||
help2man*)
|
||||
echo "You should only need it if you modified a dependency" \
|
||||
"of a man page."
|
||||
echo "You may want to install the GNU Help2man package:"
|
||||
echo "<$gnu_software_URL/help2man/>"
|
||||
;;
|
||||
makeinfo*)
|
||||
echo "You should only need it if you modified a '.texi' file, or"
|
||||
echo "any other file indirectly affecting the aspect of the manual."
|
||||
echo "You might want to install the Texinfo package:"
|
||||
echo "<$gnu_software_URL/texinfo/>"
|
||||
echo "The spurious makeinfo call might also be the consequence of"
|
||||
echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
|
||||
echo "want to install GNU make:"
|
||||
echo "<$gnu_software_URL/make/>"
|
||||
;;
|
||||
*)
|
||||
echo "You might have modified some files without having the proper"
|
||||
echo "tools for further handling them. Check the 'README' file, it"
|
||||
echo "often tells you about the needed prerequisites for installing"
|
||||
echo "this package. You may also peek at any GNU archive site, in"
|
||||
echo "case some other package contains this missing '$1' program."
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
*)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
|
||||
# Could not run --version or --help. This is probably someone
|
||||
# running '$TOOL --version' or '$TOOL --help' to check whether
|
||||
# $TOOL exists and not knowing $TOOL uses missing.
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
give_advice "$1" | sed -e '1s/^/WARNING: /' \
|
||||
-e '2,$s/^/ /' >&2
|
||||
|
||||
# If it does not exist, or fails to run (possibly an outdated version),
|
||||
# try to emulate it.
|
||||
case $program in
|
||||
aclocal*)
|
||||
echo 1>&2 "\
|
||||
WARNING: '$1' is $msg. You should only need it if
|
||||
you modified 'acinclude.m4' or '${configure_ac}'. You might want
|
||||
to install the Automake and Perl packages. Grab them from
|
||||
any GNU archive site."
|
||||
touch aclocal.m4
|
||||
;;
|
||||
|
||||
autoconf*)
|
||||
echo 1>&2 "\
|
||||
WARNING: '$1' is $msg. You should only need it if
|
||||
you modified '${configure_ac}'. You might want to install the
|
||||
Autoconf and GNU m4 packages. Grab them from any GNU
|
||||
archive site."
|
||||
touch configure
|
||||
;;
|
||||
|
||||
autoheader*)
|
||||
echo 1>&2 "\
|
||||
WARNING: '$1' is $msg. You should only need it if
|
||||
you modified 'acconfig.h' or '${configure_ac}'. You might want
|
||||
to install the Autoconf and GNU m4 packages. Grab them
|
||||
from any GNU archive site."
|
||||
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
|
||||
test -z "$files" && files="config.h"
|
||||
touch_files=
|
||||
for f in $files; do
|
||||
case $f in
|
||||
*:*) touch_files="$touch_files "`echo "$f" |
|
||||
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
|
||||
*) touch_files="$touch_files $f.in";;
|
||||
esac
|
||||
done
|
||||
touch $touch_files
|
||||
;;
|
||||
|
||||
automake*)
|
||||
echo 1>&2 "\
|
||||
WARNING: '$1' is $msg. You should only need it if
|
||||
you modified 'Makefile.am', 'acinclude.m4' or '${configure_ac}'.
|
||||
You might want to install the Automake and Perl packages.
|
||||
Grab them from any GNU archive site."
|
||||
find . -type f -name Makefile.am -print |
|
||||
sed 's/\.am$/.in/' |
|
||||
while read f; do touch "$f"; done
|
||||
;;
|
||||
|
||||
autom4te*)
|
||||
echo 1>&2 "\
|
||||
WARNING: '$1' is needed, but is $msg.
|
||||
You might have modified some files without having the
|
||||
proper tools for further handling them.
|
||||
You can get '$1' as part of Autoconf from any GNU
|
||||
archive site."
|
||||
|
||||
file=`echo "$*" | sed -n "$sed_output"`
|
||||
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
|
||||
if test -f "$file"; then
|
||||
touch $file
|
||||
else
|
||||
test -z "$file" || exec >$file
|
||||
echo "#! /bin/sh"
|
||||
echo "# Created by GNU Automake missing as a replacement of"
|
||||
echo "# $ $@"
|
||||
echo "exit 0"
|
||||
chmod +x $file
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
bison*|yacc*)
|
||||
echo 1>&2 "\
|
||||
WARNING: '$1' $msg. You should only need it if
|
||||
you modified a '.y' file. You may need the Bison package
|
||||
in order for those modifications to take effect. You can get
|
||||
Bison from any GNU archive site."
|
||||
rm -f y.tab.c y.tab.h
|
||||
if test $# -ne 1; then
|
||||
eval LASTARG=\${$#}
|
||||
case $LASTARG in
|
||||
*.y)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
|
||||
if test -f "$SRCFILE"; then
|
||||
cp "$SRCFILE" y.tab.c
|
||||
fi
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
|
||||
if test -f "$SRCFILE"; then
|
||||
cp "$SRCFILE" y.tab.h
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if test ! -f y.tab.h; then
|
||||
echo >y.tab.h
|
||||
fi
|
||||
if test ! -f y.tab.c; then
|
||||
echo 'main() { return 0; }' >y.tab.c
|
||||
fi
|
||||
;;
|
||||
|
||||
lex*|flex*)
|
||||
echo 1>&2 "\
|
||||
WARNING: '$1' is $msg. You should only need it if
|
||||
you modified a '.l' file. You may need the Flex package
|
||||
in order for those modifications to take effect. You can get
|
||||
Flex from any GNU archive site."
|
||||
rm -f lex.yy.c
|
||||
if test $# -ne 1; then
|
||||
eval LASTARG=\${$#}
|
||||
case $LASTARG in
|
||||
*.l)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
|
||||
if test -f "$SRCFILE"; then
|
||||
cp "$SRCFILE" lex.yy.c
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if test ! -f lex.yy.c; then
|
||||
echo 'main() { return 0; }' >lex.yy.c
|
||||
fi
|
||||
;;
|
||||
|
||||
help2man*)
|
||||
echo 1>&2 "\
|
||||
WARNING: '$1' is $msg. You should only need it if
|
||||
you modified a dependency of a manual page. You may need the
|
||||
Help2man package in order for those modifications to take
|
||||
effect. You can get Help2man from any GNU archive site."
|
||||
|
||||
file=`echo "$*" | sed -n "$sed_output"`
|
||||
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
|
||||
if test -f "$file"; then
|
||||
touch $file
|
||||
else
|
||||
test -z "$file" || exec >$file
|
||||
echo ".ab help2man is required to generate this page"
|
||||
exit $?
|
||||
fi
|
||||
;;
|
||||
|
||||
makeinfo*)
|
||||
echo 1>&2 "\
|
||||
WARNING: '$1' is $msg. You should only need it if
|
||||
you modified a '.texi' or '.texinfo' file, or any other file
|
||||
indirectly affecting the aspect of the manual. The spurious
|
||||
call might also be the consequence of using a buggy 'make' (AIX,
|
||||
DU, IRIX). You might want to install the Texinfo package or
|
||||
the GNU make package. Grab either from any GNU archive site."
|
||||
# The file to touch is that specified with -o ...
|
||||
file=`echo "$*" | sed -n "$sed_output"`
|
||||
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
|
||||
if test -z "$file"; then
|
||||
# ... or it is the one specified with @setfilename ...
|
||||
infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
|
||||
file=`sed -n '
|
||||
/^@setfilename/{
|
||||
s/.* \([^ ]*\) *$/\1/
|
||||
p
|
||||
q
|
||||
}' $infile`
|
||||
# ... or it is derived from the source name (dir/f.texi becomes f.info)
|
||||
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
|
||||
fi
|
||||
# If the file does not exist, the user really needs makeinfo;
|
||||
# let's fail without touching anything.
|
||||
test -f $file || exit 1
|
||||
touch $file
|
||||
;;
|
||||
|
||||
*)
|
||||
echo 1>&2 "\
|
||||
WARNING: '$1' is needed, and is $msg.
|
||||
You might have modified some files without having the
|
||||
proper tools for further handling them. Check the 'README' file,
|
||||
it often tells you about the needed prerequisites for installing
|
||||
this package. You may also peek at any GNU archive site, in case
|
||||
some other package would contain this missing '$1' program."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
# Propagate the correct exit status (expected to be 127 for a program
|
||||
# not found, 63 for a program that failed due to version mismatch).
|
||||
exit $st
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
|
|
|
|||
50
unit/atf-src/admin/travis-build.sh
Normal file
50
unit/atf-src/admin/travis-build.sh
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
#! /bin/sh
|
||||
# Copyright 2014 Google 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:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * 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.
|
||||
# * Neither the name of Google Inc. 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 COPYRIGHT HOLDERS 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 COPYRIGHT
|
||||
# OWNER 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.
|
||||
|
||||
set -e -x
|
||||
|
||||
if [ -d /usr/local/share/aclocal ]; then
|
||||
autoreconf -isv -I/usr/local/share/aclocal
|
||||
else
|
||||
autoreconf -isv
|
||||
fi
|
||||
./configure
|
||||
|
||||
if [ "${AS_ROOT:-no}" = yes ]; then
|
||||
cat >root-kyua.conf <<EOF
|
||||
syntax(2)
|
||||
unprivileged_user = 'nobody'
|
||||
EOF
|
||||
sudo -H make distcheck DISTCHECK_CONFIGURE_FLAGS="${f}" \
|
||||
KYUA_TEST_CONFIG_FILE="$(pwd)/root-kyua.conf"
|
||||
else
|
||||
make distcheck
|
||||
fi
|
||||
|
||||
# vim: syntax=sh:expandtab:shiftwidth=4:softtabstop=4
|
||||
77
unit/atf-src/admin/travis-install-deps.sh
Normal file
77
unit/atf-src/admin/travis-install-deps.sh
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
#! /bin/sh
|
||||
# Copyright 2014 Google 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:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * 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.
|
||||
# * Neither the name of Google Inc. 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 COPYRIGHT HOLDERS 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 COPYRIGHT
|
||||
# OWNER 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.
|
||||
|
||||
set -e -x
|
||||
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y liblua5.2-0 liblua5.2-dev \
|
||||
libsqlite3-0 libsqlite3-dev pkg-config sqlite3
|
||||
|
||||
install_from_github() {
|
||||
local project="${1}"; shift
|
||||
local name="${1}"; shift
|
||||
local release="${1}"; shift
|
||||
|
||||
local distname="${name}-${release}"
|
||||
|
||||
local baseurl="https://github.com/jmmv/${project}"
|
||||
wget --no-check-certificate \
|
||||
"${baseurl}/releases/download/${distname}/${distname}.tar.gz"
|
||||
tar -xzvf "${distname}.tar.gz"
|
||||
|
||||
cd "${distname}"
|
||||
./configure \
|
||||
--disable-developer \
|
||||
--without-atf \
|
||||
--without-doxygen \
|
||||
CPPFLAGS="-I/usr/local/include" \
|
||||
LDFLAGS="-L/usr/local/lib -Wl,-R/usr/local/lib" \
|
||||
PKG_CONFIG_PATH="/usr/local/lib/pkgconfig"
|
||||
make
|
||||
sudo make install
|
||||
cd -
|
||||
|
||||
rm -rf "${distname}" "${distname}.tar.gz"
|
||||
}
|
||||
|
||||
install_from_bintray() {
|
||||
local name="20140803-usr-local-kyua-ubuntu-12-04-amd64-${CC:-gcc}.tar.gz"
|
||||
wget "http://dl.bintray.com/jmmv/kyua/${name}" || return 1
|
||||
sudo tar -xzvp -C / -f "${name}"
|
||||
rm -f "${name}"
|
||||
}
|
||||
|
||||
if ! install_from_bintray; then
|
||||
install_from_github atf atf 0.20
|
||||
install_from_github lutok lutok 0.4
|
||||
install_from_github kyua kyua-testers 0.2
|
||||
install_from_github kyua kyua-cli 0.8
|
||||
fi
|
||||
|
||||
# vim: syntax=sh:expandtab:shiftwidth=4:softtabstop=4
|
||||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,12 +22,11 @@
|
|||
// 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_CXX_HPP_)
|
||||
#define _ATF_CXX_HPP_
|
||||
#if !defined(ATF_CXX_HPP)
|
||||
#define ATF_CXX_HPP
|
||||
|
||||
#include <atf-c++/macros.hpp>
|
||||
#include <atf-c++/utils.hpp>
|
||||
|
||||
#endif // !defined(_ATF_CXX_HPP_)
|
||||
#endif // !defined(ATF_CXX_HPP)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ tp: detail
|
|||
tp: atf_c++_test
|
||||
tp: build_test
|
||||
tp: check_test
|
||||
tp: config_test
|
||||
tp: macros_test
|
||||
tp: pkg_config_test
|
||||
tp: tests_test
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ test_suite("atf")
|
|||
atf_test_program{name="atf_c++_test"}
|
||||
atf_test_program{name="build_test"}
|
||||
atf_test_program{name="check_test"}
|
||||
atf_test_program{name="config_test"}
|
||||
atf_test_program{name="macros_test"}
|
||||
atf_test_program{name="pkg_config_test"}
|
||||
atf_test_program{name="tests_test"}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
#
|
||||
# Automated Testing Framework (atf)
|
||||
#
|
||||
# Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
|
|
@ -25,7 +22,6 @@
|
|||
# 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_CXX_LIBS = libatf-c++.la libatf-c.la
|
||||
|
||||
|
|
@ -35,27 +31,22 @@ libatf_c___la_SOURCES = atf-c++/build.cpp \
|
|||
atf-c++/build.hpp \
|
||||
atf-c++/check.cpp \
|
||||
atf-c++/check.hpp \
|
||||
atf-c++/config.cpp \
|
||||
atf-c++/config.hpp \
|
||||
atf-c++/macros.hpp \
|
||||
atf-c++/noncopyable.hpp \
|
||||
atf-c++/tests.cpp \
|
||||
atf-c++/tests.hpp \
|
||||
atf-c++/utils.cpp \
|
||||
atf-c++/utils.hpp
|
||||
libatf_c___la_LDFLAGS = -version-info 0:0:0
|
||||
libatf_c___la_LDFLAGS = -version-info 2:0:0
|
||||
|
||||
include_HEADERS += atf-c++.hpp
|
||||
atf_c___HEADERS = atf-c++/build.hpp \
|
||||
atf-c++/check.hpp \
|
||||
atf-c++/config.hpp \
|
||||
atf-c++/macros.hpp \
|
||||
atf-c++/noncopyable.hpp \
|
||||
atf-c++/tests.hpp \
|
||||
atf-c++/utils.hpp
|
||||
atf_c__dir = $(includedir)/atf-c++
|
||||
|
||||
dist_man_MANS += atf-c++/atf-c++-api.3
|
||||
dist_man_MANS += atf-c++/atf-c++.3
|
||||
|
||||
atf_aclocal_DATA += atf-c++/atf-c++.m4
|
||||
EXTRA_DIST += atf-c++/atf-c++.m4
|
||||
|
|
@ -65,12 +56,12 @@ atf_c__dirpkgconfig_DATA = atf-c++/atf-c++.pc
|
|||
CLEANFILES += atf-c++/atf-c++.pc
|
||||
EXTRA_DIST += atf-c++/atf-c++.pc.in
|
||||
atf-c++/atf-c++.pc: $(srcdir)/atf-c++/atf-c++.pc.in Makefile
|
||||
test -d atf-c++ || mkdir -p atf-c++
|
||||
$(AM_V_GEN)test -d atf-c++ || mkdir -p atf-c++; \
|
||||
sed -e 's#__ATF_VERSION__#$(PACKAGE_VERSION)#g' \
|
||||
-e 's#__CXX__#$(CXX)#g' \
|
||||
-e 's#__INCLUDEDIR__#$(includedir)#g' \
|
||||
-e 's#__LIBDIR__#$(libdir)#g' \
|
||||
<$(srcdir)/atf-c++/atf-c++.pc.in >atf-c++/atf-c++.pc.tmp
|
||||
<$(srcdir)/atf-c++/atf-c++.pc.in >atf-c++/atf-c++.pc.tmp; \
|
||||
mv atf-c++/atf-c++.pc.tmp atf-c++/atf-c++.pc
|
||||
|
||||
tests_atf_c___DATA = atf-c++/Atffile \
|
||||
|
|
@ -89,9 +80,6 @@ atf_c___build_test_LDADD = atf-c++/detail/libtest_helpers.la $(ATF_CXX_LIBS)
|
|||
tests_atf_c___PROGRAMS += atf-c++/check_test
|
||||
atf_c___check_test_SOURCES = atf-c++/check_test.cpp
|
||||
atf_c___check_test_LDADD = atf-c++/detail/libtest_helpers.la $(ATF_CXX_LIBS)
|
||||
tests_atf_c___PROGRAMS += atf-c++/config_test
|
||||
atf_c___config_test_SOURCES = atf-c++/config_test.cpp
|
||||
atf_c___config_test_LDADD = atf-c++/detail/libtest_helpers.la $(ATF_CXX_LIBS)
|
||||
tests_atf_c___PROGRAMS += atf-c++/macros_test
|
||||
atf_c___macros_test_SOURCES = atf-c++/macros_test.cpp
|
||||
atf_c___macros_test_LDADD = atf-c++/detail/libtest_helpers.la $(ATF_CXX_LIBS)
|
||||
|
|
@ -99,8 +87,7 @@ tests_atf_c___SCRIPTS = atf-c++/pkg_config_test
|
|||
CLEANFILES += atf-c++/pkg_config_test
|
||||
EXTRA_DIST += atf-c++/pkg_config_test.sh
|
||||
atf-c++/pkg_config_test: $(srcdir)/atf-c++/pkg_config_test.sh
|
||||
test -d atf-c++ || mkdir -p atf-c++
|
||||
@src="$(srcdir)/atf-c++/pkg_config_test.sh"; \
|
||||
$(AM_V_GEN)src="$(srcdir)/atf-c++/pkg_config_test.sh"; \
|
||||
dst="atf-c++/pkg_config_test"; $(BUILD_SH_TP)
|
||||
|
||||
tests_atf_c___PROGRAMS += atf-c++/tests_test
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
.\"
|
||||
.\" Automated Testing Framework (atf)
|
||||
.\"
|
||||
.\" Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
|
|
@ -25,12 +22,11 @@
|
|||
.\" 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 November 30, 2012
|
||||
.Dt ATF-C++-API 3
|
||||
.Dd October 13, 2014
|
||||
.Dt ATF-C++ 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm atf-c++-api ,
|
||||
.Nm atf-c++ ,
|
||||
.Nm ATF_ADD_TEST_CASE ,
|
||||
.Nm ATF_CHECK_ERRNO ,
|
||||
.Nm ATF_FAIL ,
|
||||
|
|
@ -68,13 +64,13 @@
|
|||
.Sh SYNOPSIS
|
||||
.In atf-c++.hpp
|
||||
.Fn ATF_ADD_TEST_CASE "tcs" "name"
|
||||
.Fn ATF_CHECK_ERRNO "exp_errno" "bool_expression"
|
||||
.Fn ATF_CHECK_ERRNO "expected_errno" "bool_expression"
|
||||
.Fn ATF_FAIL "reason"
|
||||
.Fn ATF_INIT_TEST_CASES "tcs"
|
||||
.Fn ATF_PASS
|
||||
.Fn ATF_REQUIRE "expression"
|
||||
.Fn ATF_REQUIRE_EQ "expression_1" "expression_2"
|
||||
.Fn ATF_REQUIRE_ERRNO "exp_errno" "bool_expression"
|
||||
.Fn ATF_REQUIRE_EQ "expected_expression" "actual_expression"
|
||||
.Fn ATF_REQUIRE_ERRNO "expected_errno" "bool_expression"
|
||||
.Fn ATF_REQUIRE_IN "element" "collection"
|
||||
.Fn ATF_REQUIRE_MATCH "regexp" "string_expression"
|
||||
.Fn ATF_REQUIRE_NOT_IN "element" "collection"
|
||||
|
|
@ -145,17 +141,8 @@
|
|||
.Fa "const std::string& expected_stderr"
|
||||
.Fc
|
||||
.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:
|
||||
ATF provides a C++ programming interface to implement test programs.
|
||||
C++-based test programs follow this template:
|
||||
.Bd -literal -offset indent
|
||||
extern "C" {
|
||||
.Ns ... C-specific includes go here ...
|
||||
|
|
@ -339,9 +326,8 @@ If
|
|||
.Va exitcode
|
||||
is not
|
||||
.Sq -1 ,
|
||||
.Xr atf-run 1
|
||||
will validate that the exit code of the test case matches the one provided
|
||||
in this call.
|
||||
the runtime engine will validate that the exit code of the test case
|
||||
matches the one provided in this call.
|
||||
Otherwise, the exact value will be ignored.
|
||||
.It Fn expect_fail "reason"
|
||||
Any failure (be it fatal or non-fatal) raised in this mode is recorded.
|
||||
|
|
@ -377,9 +363,8 @@ If
|
|||
.Va signo
|
||||
is not
|
||||
.Sq -1 ,
|
||||
.Xr atf-run 1
|
||||
will validate that the signal that terminated the test case matches the one
|
||||
provided in this call.
|
||||
the runtime engine will validate that the signal that terminated the test
|
||||
case matches the one provided in this call.
|
||||
Otherwise, the exact value will be ignored.
|
||||
.It Fn expect_timeout "reason"
|
||||
Expects the test case to execute for longer than its timeout.
|
||||
|
|
@ -399,6 +384,8 @@ takes an expression and raises a failure if it evaluates to false.
|
|||
.Fn ATF_REQUIRE_EQ
|
||||
takes two expressions and raises a failure if the two do not evaluate to
|
||||
the same exact value.
|
||||
The common style is to put the expected value in the first parameter and the
|
||||
actual value in the second parameter.
|
||||
.Pp
|
||||
.Fn ATF_REQUIRE_IN
|
||||
takes an element and a collection and validates that the element is present in
|
||||
|
|
@ -440,7 +427,7 @@ In particular, these are useful to write tests for command-line interfaces.
|
|||
.Fa "const std::string& path"
|
||||
.Fa "const std::string& prefix"
|
||||
.Fc
|
||||
.Bd -offset indent
|
||||
.Bd -ragged -offset indent
|
||||
Prints the contents of
|
||||
.Fa path
|
||||
to the standard output, prefixing every line with the string in
|
||||
|
|
@ -452,7 +439,7 @@ to the standard output, prefixing every line with the string in
|
|||
.Fa "const std::string& path"
|
||||
.Fa "const std::string& contents"
|
||||
.Fc
|
||||
.Bd -offset indent
|
||||
.Bd -ragged -offset indent
|
||||
Returns true if the given
|
||||
.Fa path
|
||||
matches exactly the expected inlined
|
||||
|
|
@ -464,7 +451,7 @@ matches exactly the expected inlined
|
|||
.Fa "const std::string& source"
|
||||
.Fa "const std::string& destination"
|
||||
.Fc
|
||||
.Bd -offset indent
|
||||
.Bd -ragged -offset indent
|
||||
Copies the file
|
||||
.Fa source
|
||||
to
|
||||
|
|
@ -477,7 +464,7 @@ The permissions of the file are preserved during the code.
|
|||
.Fa "const std::string& path"
|
||||
.Fa "const std::string& contents"
|
||||
.Fc
|
||||
.Bd -offset indent
|
||||
.Bd -ragged -offset indent
|
||||
Creates
|
||||
.Fa file
|
||||
with the text given in
|
||||
|
|
@ -488,7 +475,7 @@ with the text given in
|
|||
.Fo atf::utils::file_exists
|
||||
.Fa "const std::string& path"
|
||||
.Fc
|
||||
.Bd -offset indent
|
||||
.Bd -ragged -offset indent
|
||||
Checks if
|
||||
.Fa path
|
||||
exists.
|
||||
|
|
@ -498,7 +485,7 @@ exists.
|
|||
.Fo atf::utils::fork
|
||||
.Fa "void"
|
||||
.Fc
|
||||
.Bd -offset indent
|
||||
.Bd -ragged -offset indent
|
||||
Forks a process and redirects the standard output and standard error of the
|
||||
child to files for later validation with
|
||||
.Fn atf::utils::wait .
|
||||
|
|
@ -510,7 +497,7 @@ Fails the test case if the fork fails, so this does not return an error.
|
|||
.Fa "const std::string& regexp"
|
||||
.Fa "const Collection& collection"
|
||||
.Fc
|
||||
.Bd -offset indent
|
||||
.Bd -ragged -offset indent
|
||||
Searches for the regular expression
|
||||
.Fa regexp
|
||||
in any of the strings contained in the
|
||||
|
|
@ -523,7 +510,7 @@ This is a template that accepts any one-dimensional container of strings.
|
|||
.Fa "const std::string& regexp"
|
||||
.Fa "const std::string& path"
|
||||
.Fc
|
||||
.Bd -offset indent
|
||||
.Bd -ragged -offset indent
|
||||
Searches for the regular expression
|
||||
.Fa regexp
|
||||
in the file
|
||||
|
|
@ -536,7 +523,7 @@ The variable arguments are used to construct the regular expression.
|
|||
.Fa "const std::string& regexp"
|
||||
.Fa "const std::string& str"
|
||||
.Fc
|
||||
.Bd -offset indent
|
||||
.Bd -ragged -offset indent
|
||||
Searches for the regular expression
|
||||
.Fa regexp
|
||||
in the string
|
||||
|
|
@ -547,7 +534,7 @@ in the string
|
|||
.Fa "const int fd"
|
||||
.Fa "const std::string& path"
|
||||
.Fc
|
||||
.Bd -offset indent
|
||||
.Bd -ragged -offset indent
|
||||
Redirects the given file descriptor
|
||||
.Fa fd
|
||||
to the file
|
||||
|
|
@ -566,7 +553,7 @@ those spawned by
|
|||
.Fa "const std::string& expected_stdout"
|
||||
.Fa "const std::string& expected_stderr"
|
||||
.Fc
|
||||
.Bd -offset indent
|
||||
.Bd -ragged -offset indent
|
||||
Waits and validates the result of a subprocess spawned with
|
||||
.Fn atf::utils::wait .
|
||||
The validation involves checking that the subprocess exited cleanly and returned
|
||||
|
|
@ -586,6 +573,25 @@ strings are prefixed with
|
|||
then they specify the name of the file into which to store the stdout or stderr
|
||||
of the subprocess, and no comparison is performed.
|
||||
.Ed
|
||||
.Sh ENVIRONMENT
|
||||
The following variables are recognized by
|
||||
.Nm
|
||||
but should not be overridden other than for testing purposes:
|
||||
.Pp
|
||||
.Bl -tag -width ATFXBUILDXCXXFLAGSXX -compact
|
||||
.It Va ATF_BUILD_CC
|
||||
Path to the C compiler.
|
||||
.It Va ATF_BUILD_CFLAGS
|
||||
C compiler flags.
|
||||
.It Va ATF_BUILD_CPP
|
||||
Path to the C/C++ preprocessor.
|
||||
.It Va ATF_BUILD_CPPFLAGS
|
||||
C/C++ preprocessor flags.
|
||||
.It Va ATF_BUILD_CXX
|
||||
Path to the C++ compiler.
|
||||
.It Va ATF_BUILD_CXXFLAGS
|
||||
C++ compiler flags.
|
||||
.El
|
||||
.Sh EXAMPLES
|
||||
The following shows a complete test program with a single test case that
|
||||
validates the addition operator:
|
||||
|
|
@ -599,13 +605,13 @@ ATF_TEST_CASE_HEAD(addition)
|
|||
}
|
||||
ATF_TEST_CASE_BODY(addition)
|
||||
{
|
||||
ATF_REQUIRE_EQ(0 + 0, 0);
|
||||
ATF_REQUIRE_EQ(0 + 1, 1);
|
||||
ATF_REQUIRE_EQ(1 + 0, 1);
|
||||
ATF_REQUIRE_EQ(0, 0 + 0);
|
||||
ATF_REQUIRE_EQ(1, 0 + 1);
|
||||
ATF_REQUIRE_EQ(1, 1 + 0);
|
||||
|
||||
ATF_REQUIRE_EQ(1 + 1, 2);
|
||||
ATF_REQUIRE_EQ(2, 1 + 1);
|
||||
|
||||
ATF_REQUIRE_EQ(100 + 200, 300);
|
||||
ATF_REQUIRE_EQ(300, 100 + 200);
|
||||
}
|
||||
|
||||
ATF_TEST_CASE(open_failure);
|
||||
|
|
@ -640,5 +646,4 @@ ATF_INIT_TEST_CASES(tcs)
|
|||
.Ed
|
||||
.Sh SEE ALSO
|
||||
.Xr atf-test-program 1 ,
|
||||
.Xr atf-test-case 4 ,
|
||||
.Xr atf 7
|
||||
.Xr atf-test-case 4
|
||||
|
|
@ -1,6 +1,3 @@
|
|||
dnl
|
||||
dnl Automated Testing Framework (atf)
|
||||
dnl
|
||||
dnl Copyright 2011 Google Inc.
|
||||
dnl All rights reserved.
|
||||
dnl
|
||||
|
|
@ -28,7 +25,6 @@ dnl DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|||
dnl THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
dnl (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
dnl OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
dnl
|
||||
|
||||
dnl ATF_CHECK_CXX([version-spec])
|
||||
dnl
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2009 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,11 +22,10 @@
|
|||
// 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 "macros.hpp"
|
||||
#include <atf-c++.hpp>
|
||||
|
||||
#include "detail/test_helpers.hpp"
|
||||
#include "atf-c++/detail/test_helpers.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Tests cases for the header file.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2009 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,7 +22,8 @@
|
|||
// 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 "atf-c++/build.hpp"
|
||||
|
||||
extern "C" {
|
||||
#include "atf-c/build.h"
|
||||
|
|
@ -33,10 +31,8 @@ extern "C" {
|
|||
#include "atf-c/utils.h"
|
||||
}
|
||||
|
||||
#include "build.hpp"
|
||||
|
||||
#include "detail/exceptions.hpp"
|
||||
#include "detail/process.hpp"
|
||||
#include "atf-c++/detail/exceptions.hpp"
|
||||
#include "atf-c++/detail/process.hpp"
|
||||
|
||||
namespace impl = atf::build;
|
||||
#define IMPL_NAME "atf::build"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2009 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,10 +22,9 @@
|
|||
// 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_CXX_BUILD_HPP_)
|
||||
#define _ATF_CXX_BUILD_HPP_
|
||||
#if !defined(ATF_CXX_BUILD_HPP)
|
||||
#define ATF_CXX_BUILD_HPP
|
||||
|
||||
#include <string>
|
||||
|
||||
|
|
@ -54,4 +50,4 @@ process::argv_array cxx_o(const std::string&, const std::string&,
|
|||
} // namespace build
|
||||
} // namespace atf
|
||||
|
||||
#endif // !defined(_ATF_CXX_BUILD_HPP_)
|
||||
#endif // !defined(ATF_CXX_BUILD_HPP)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2009 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,31 +22,25 @@
|
|||
// 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 "atf-c++/build.hpp"
|
||||
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
|
||||
#include "../atf-c/h_build.h"
|
||||
#include <atf-c++.hpp>
|
||||
|
||||
#include "build.hpp"
|
||||
#include "config.hpp"
|
||||
#include "macros.hpp"
|
||||
extern "C" {
|
||||
#include "atf-c/h_build.h"
|
||||
}
|
||||
|
||||
#include "detail/env.hpp"
|
||||
#include "detail/process.hpp"
|
||||
#include "detail/test_helpers.hpp"
|
||||
#include "atf-c++/detail/env.hpp"
|
||||
#include "atf-c++/detail/process.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Auxiliary functions.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace atf {
|
||||
namespace config {
|
||||
void __reinit(void);
|
||||
}
|
||||
}
|
||||
|
||||
template< class C >
|
||||
void
|
||||
print_col(const char* prefix, const C& c)
|
||||
|
|
@ -168,7 +159,6 @@ ATF_TEST_CASE_BODY(c_o)
|
|||
verbose_set_env("ATF_BUILD_CC", test->cc);
|
||||
verbose_set_env("ATF_BUILD_CFLAGS", test->cflags);
|
||||
verbose_set_env("ATF_BUILD_CPPFLAGS", test->cppflags);
|
||||
atf::config::__reinit();
|
||||
|
||||
atf::process::argv_array argv =
|
||||
atf::build::c_o(test->sfile, test->ofile,
|
||||
|
|
@ -190,7 +180,6 @@ ATF_TEST_CASE_BODY(cpp)
|
|||
|
||||
verbose_set_env("ATF_BUILD_CPP", test->cpp);
|
||||
verbose_set_env("ATF_BUILD_CPPFLAGS", test->cppflags);
|
||||
atf::config::__reinit();
|
||||
|
||||
atf::process::argv_array argv =
|
||||
atf::build::cpp(test->sfile, test->ofile,
|
||||
|
|
@ -213,7 +202,6 @@ ATF_TEST_CASE_BODY(cxx_o)
|
|||
verbose_set_env("ATF_BUILD_CXX", test->cxx);
|
||||
verbose_set_env("ATF_BUILD_CXXFLAGS", test->cxxflags);
|
||||
verbose_set_env("ATF_BUILD_CPPFLAGS", test->cppflags);
|
||||
atf::config::__reinit();
|
||||
|
||||
atf::process::argv_array argv =
|
||||
atf::build::cxx_o(test->sfile, test->ofile,
|
||||
|
|
@ -222,12 +210,6 @@ ATF_TEST_CASE_BODY(cxx_o)
|
|||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Tests cases for the header file.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
HEADER_TC(include, "atf-c++/build.hpp");
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Main.
|
||||
// ------------------------------------------------------------------------
|
||||
|
|
@ -241,7 +223,4 @@ ATF_INIT_TEST_CASES(tcs)
|
|||
ATF_ADD_TEST_CASE(tcs, c_o);
|
||||
ATF_ADD_TEST_CASE(tcs, cpp);
|
||||
ATF_ADD_TEST_CASE(tcs, cxx_o);
|
||||
|
||||
// Add the test cases for the header file.
|
||||
ATF_ADD_TEST_CASE(tcs, include);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,7 +22,8 @@
|
|||
// 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 "atf-c++/check.hpp"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
|
|
@ -34,11 +32,9 @@ extern "C" {
|
|||
#include "atf-c/error.h"
|
||||
}
|
||||
|
||||
#include "check.hpp"
|
||||
|
||||
#include "detail/exceptions.hpp"
|
||||
#include "detail/process.hpp"
|
||||
#include "detail/sanity.hpp"
|
||||
#include "atf-c++/detail/exceptions.hpp"
|
||||
#include "atf-c++/detail/process.hpp"
|
||||
#include "atf-c++/detail/sanity.hpp"
|
||||
|
||||
namespace impl = atf::check;
|
||||
#define IMPL_NAME "atf::check"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,10 +22,9 @@
|
|||
// 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_CXX_CHECK_HPP_)
|
||||
#define _ATF_CXX_CHECK_HPP_
|
||||
#if !defined(ATF_CXX_CHECK_HPP)
|
||||
#define ATF_CXX_CHECK_HPP
|
||||
|
||||
extern "C" {
|
||||
#include <atf-c/check.h>
|
||||
|
|
@ -39,8 +35,6 @@ extern "C" {
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <atf-c++/noncopyable.hpp>
|
||||
|
||||
namespace atf {
|
||||
|
||||
namespace process {
|
||||
|
|
@ -60,7 +54,11 @@ namespace check {
|
|||
//! of executing arbitrary command and manages files containing
|
||||
//! its output.
|
||||
//!
|
||||
class check_result : noncopyable {
|
||||
class check_result {
|
||||
// Non-copyable.
|
||||
check_result(const check_result&);
|
||||
check_result& operator=(const check_result&);
|
||||
|
||||
//!
|
||||
//! \brief Internal representation of a result.
|
||||
//!
|
||||
|
|
@ -130,4 +128,4 @@ check_result test_constructor(void);
|
|||
} // namespace check
|
||||
} // namespace atf
|
||||
|
||||
#endif // !defined(_ATF_CXX_CHECK_HPP_)
|
||||
#endif // !defined(ATF_CXX_CHECK_HPP)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,7 +22,8 @@
|
|||
// 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 "atf-c++/check.hpp"
|
||||
|
||||
extern "C" {
|
||||
#include <fcntl.h>
|
||||
|
|
@ -43,14 +41,11 @@ extern "C" {
|
|||
|
||||
#include <atf-c++.hpp>
|
||||
|
||||
#include "check.hpp"
|
||||
#include "config.hpp"
|
||||
#include "utils.hpp"
|
||||
|
||||
#include "detail/fs.hpp"
|
||||
#include "detail/process.hpp"
|
||||
#include "detail/test_helpers.hpp"
|
||||
#include "detail/text.hpp"
|
||||
#include "atf-c++/detail/fs.hpp"
|
||||
#include "atf-c++/detail/process.hpp"
|
||||
#include "atf-c++/detail/test_helpers.hpp"
|
||||
#include "atf-c++/detail/text.hpp"
|
||||
#include "atf-c++/utils.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Auxiliary functions.
|
||||
|
|
@ -61,7 +56,7 @@ std::auto_ptr< atf::check::check_result >
|
|||
do_exec(const atf::tests::tc* tc, const char* helper_name)
|
||||
{
|
||||
std::vector< std::string > argv;
|
||||
argv.push_back(get_process_helpers_path(*tc).str());
|
||||
argv.push_back(get_process_helpers_path(*tc, false).str());
|
||||
argv.push_back(helper_name);
|
||||
std::cout << "Executing " << argv[0] << " " << argv[1] << "\n";
|
||||
|
||||
|
|
@ -74,7 +69,7 @@ std::auto_ptr< atf::check::check_result >
|
|||
do_exec(const atf::tests::tc* tc, const char* helper_name, const char *carg2)
|
||||
{
|
||||
std::vector< std::string > argv;
|
||||
argv.push_back(get_process_helpers_path(*tc).str());
|
||||
argv.push_back(get_process_helpers_path(*tc, false).str());
|
||||
argv.push_back(helper_name);
|
||||
argv.push_back(carg2);
|
||||
std::cout << "Executing " << argv[0] << " " << argv[1] << " "
|
||||
|
|
@ -374,7 +369,7 @@ ATF_TEST_CASE_HEAD(exec_unknown)
|
|||
ATF_TEST_CASE_BODY(exec_unknown)
|
||||
{
|
||||
std::vector< std::string > argv;
|
||||
argv.push_back(atf::config::get("atf_workdir") + "/non-existent");
|
||||
argv.push_back("/foo/bar/non-existent");
|
||||
|
||||
atf::process::argv_array argva(argv);
|
||||
std::auto_ptr< atf::check::check_result > r = atf::check::exec(argva);
|
||||
|
|
@ -382,12 +377,6 @@ ATF_TEST_CASE_BODY(exec_unknown)
|
|||
ATF_REQUIRE_EQ(r->exitcode(), 127);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Tests cases for the header file.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
HEADER_TC(include, "atf-c++/check.hpp");
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Main.
|
||||
// ------------------------------------------------------------------------
|
||||
|
|
@ -402,7 +391,4 @@ ATF_INIT_TEST_CASES(tcs)
|
|||
ATF_ADD_TEST_CASE(tcs, exec_exitstatus);
|
||||
ATF_ADD_TEST_CASE(tcs, exec_stdout_stderr);
|
||||
ATF_ADD_TEST_CASE(tcs, exec_unknown);
|
||||
|
||||
// Add the test cases for the header file.
|
||||
ATF_ADD_TEST_CASE(tcs, include);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,9 +6,5 @@ tp: application_test
|
|||
tp: auto_array_test
|
||||
tp: env_test
|
||||
tp: exceptions_test
|
||||
tp: expand_test
|
||||
tp: fs_test
|
||||
tp: parser_test
|
||||
tp: sanity_test
|
||||
tp: text_test
|
||||
tp: ui_test
|
||||
|
|
|
|||
|
|
@ -6,9 +6,6 @@ atf_test_program{name="application_test"}
|
|||
atf_test_program{name="auto_array_test"}
|
||||
atf_test_program{name="env_test"}
|
||||
atf_test_program{name="exceptions_test"}
|
||||
atf_test_program{name="expand_test"}
|
||||
atf_test_program{name="fs_test"}
|
||||
atf_test_program{name="parser_test"}
|
||||
atf_test_program{name="sanity_test"}
|
||||
atf_test_program{name="process_test"}
|
||||
atf_test_program{name="text_test"}
|
||||
atf_test_program{name="ui_test"}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
#
|
||||
# Automated Testing Framework (atf)
|
||||
#
|
||||
# Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
|
|
@ -25,7 +22,6 @@
|
|||
# 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.
|
||||
#
|
||||
|
||||
libatf_c___la_SOURCES += atf-c++/detail/application.cpp \
|
||||
atf-c++/detail/application.hpp \
|
||||
|
|
@ -34,19 +30,13 @@ libatf_c___la_SOURCES += atf-c++/detail/application.cpp \
|
|||
atf-c++/detail/env.hpp \
|
||||
atf-c++/detail/exceptions.cpp \
|
||||
atf-c++/detail/exceptions.hpp \
|
||||
atf-c++/detail/expand.cpp \
|
||||
atf-c++/detail/expand.hpp \
|
||||
atf-c++/detail/fs.cpp \
|
||||
atf-c++/detail/fs.hpp \
|
||||
atf-c++/detail/parser.cpp \
|
||||
atf-c++/detail/parser.hpp \
|
||||
atf-c++/detail/process.cpp \
|
||||
atf-c++/detail/process.hpp \
|
||||
atf-c++/detail/sanity.hpp \
|
||||
atf-c++/detail/text.cpp \
|
||||
atf-c++/detail/text.hpp \
|
||||
atf-c++/detail/ui.cpp \
|
||||
atf-c++/detail/ui.hpp
|
||||
atf-c++/detail/text.hpp
|
||||
|
||||
tests_atf_c___detail_DATA = atf-c++/detail/Atffile \
|
||||
atf-c++/detail/Kyuafile
|
||||
|
|
@ -56,6 +46,7 @@ EXTRA_DIST += $(tests_atf_c___detail_DATA)
|
|||
noinst_LTLIBRARIES += atf-c++/detail/libtest_helpers.la
|
||||
atf_c___detail_libtest_helpers_la_SOURCES = atf-c++/detail/test_helpers.cpp \
|
||||
atf-c++/detail/test_helpers.hpp
|
||||
atf_c___detail_libtest_helpers_la_CPPFLAGS = -DATF_INCLUDEDIR=\"$(includedir)\"
|
||||
|
||||
tests_atf_c___detail_PROGRAMS = atf-c++/detail/application_test
|
||||
atf_c___detail_application_test_SOURCES = atf-c++/detail/application_test.cpp
|
||||
|
|
@ -73,32 +64,19 @@ tests_atf_c___detail_PROGRAMS += atf-c++/detail/exceptions_test
|
|||
atf_c___detail_exceptions_test_SOURCES = atf-c++/detail/exceptions_test.cpp
|
||||
atf_c___detail_exceptions_test_LDADD = atf-c++/detail/libtest_helpers.la $(ATF_CXX_LIBS)
|
||||
|
||||
tests_atf_c___detail_PROGRAMS += atf-c++/detail/expand_test
|
||||
atf_c___detail_expand_test_SOURCES = atf-c++/detail/expand_test.cpp
|
||||
atf_c___detail_expand_test_LDADD = atf-c++/detail/libtest_helpers.la $(ATF_CXX_LIBS)
|
||||
|
||||
tests_atf_c___detail_PROGRAMS += atf-c++/detail/fs_test
|
||||
atf_c___detail_fs_test_SOURCES = atf-c++/detail/fs_test.cpp
|
||||
atf_c___detail_fs_test_LDADD = atf-c++/detail/libtest_helpers.la $(ATF_CXX_LIBS)
|
||||
|
||||
tests_atf_c___detail_PROGRAMS += atf-c++/detail/parser_test
|
||||
atf_c___detail_parser_test_SOURCES = atf-c++/detail/parser_test.cpp
|
||||
atf_c___detail_parser_test_LDADD = atf-c++/detail/libtest_helpers.la $(ATF_CXX_LIBS)
|
||||
|
||||
tests_atf_c___detail_PROGRAMS += atf-c++/detail/process_test
|
||||
atf_c___detail_process_test_SOURCES = atf-c++/detail/process_test.cpp
|
||||
atf_c___detail_process_test_LDADD = atf-c++/detail/libtest_helpers.la $(ATF_CXX_LIBS)
|
||||
|
||||
tests_atf_c___detail_PROGRAMS += atf-c++/detail/sanity_test
|
||||
atf_c___detail_sanity_test_SOURCES = atf-c++/detail/sanity_test.cpp
|
||||
atf_c___detail_sanity_test_LDADD = atf-c++/detail/libtest_helpers.la $(ATF_CXX_LIBS)
|
||||
|
||||
tests_atf_c___detail_PROGRAMS += atf-c++/detail/text_test
|
||||
atf_c___detail_text_test_SOURCES = atf-c++/detail/text_test.cpp
|
||||
atf_c___detail_text_test_LDADD = atf-c++/detail/libtest_helpers.la $(ATF_CXX_LIBS)
|
||||
|
||||
tests_atf_c___detail_PROGRAMS += atf-c++/detail/ui_test
|
||||
atf_c___detail_ui_test_SOURCES = atf-c++/detail/ui_test.cpp
|
||||
atf_c___detail_ui_test_LDADD = atf-c++/detail/libtest_helpers.la $(ATF_CXX_LIBS)
|
||||
tests_atf_c___detail_PROGRAMS += atf-c++/detail/version_helper
|
||||
atf_c___detail_version_helper_SOURCES = atf-c++/detail/version_helper.cpp
|
||||
|
||||
# vim: syntax=make:noexpandtab:shiftwidth=8:softtabstop=8
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,10 +22,11 @@
|
|||
// 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 "atf-c++/detail/application.hpp"
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "bconfig.h"
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
|
|
@ -45,9 +43,7 @@ extern "C" {
|
|||
#include "atf-c/defs.h"
|
||||
}
|
||||
|
||||
#include "application.hpp"
|
||||
#include "sanity.hpp"
|
||||
#include "ui.hpp"
|
||||
#include "atf-c++/detail/sanity.hpp"
|
||||
|
||||
#if !defined(HAVE_VSNPRINTF_IN_STD)
|
||||
namespace std {
|
||||
|
|
@ -106,17 +102,12 @@ impl::option::operator<(const impl::option& o)
|
|||
}
|
||||
|
||||
impl::app::app(const std::string& description,
|
||||
const std::string& manpage,
|
||||
const std::string& global_manpage,
|
||||
const bool use_ui) :
|
||||
m_hflag(false),
|
||||
const std::string& manpage) :
|
||||
m_argc(-1),
|
||||
m_argv(NULL),
|
||||
m_prog_name(NULL),
|
||||
m_description(description),
|
||||
m_manpage(manpage),
|
||||
m_global_manpage(global_manpage),
|
||||
m_use_ui(use_ui)
|
||||
m_manpage(manpage)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -133,11 +124,7 @@ impl::app::inited(void)
|
|||
impl::app::options_set
|
||||
impl::app::options(void)
|
||||
{
|
||||
options_set opts = specific_options();
|
||||
if (m_use_ui) {
|
||||
opts.insert(option('h', "", "Shows this help message"));
|
||||
}
|
||||
return opts;
|
||||
return specific_options();
|
||||
}
|
||||
|
||||
std::string
|
||||
|
|
@ -187,11 +174,6 @@ impl::app::process_options(void)
|
|||
::opterr = 0;
|
||||
while ((ch = ::getopt(m_argc, m_argv, optstr.c_str())) != -1) {
|
||||
switch (ch) {
|
||||
case 'h':
|
||||
INV(m_use_ui);
|
||||
m_hflag = true;
|
||||
break;
|
||||
|
||||
case ':':
|
||||
throw usage_error("Option -%c requires an argument.",
|
||||
::optopt);
|
||||
|
|
@ -214,51 +196,6 @@ impl::app::process_options(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
impl::app::usage(std::ostream& os)
|
||||
{
|
||||
PRE(inited());
|
||||
|
||||
std::string args = specific_args();
|
||||
if (!args.empty())
|
||||
args = " " + args;
|
||||
os << ui::format_text_with_tag(std::string(m_prog_name) + " [options]" +
|
||||
args, "Usage: ", false) << "\n\n"
|
||||
<< ui::format_text(m_description) << "\n\n";
|
||||
|
||||
options_set opts = options();
|
||||
INV(!opts.empty());
|
||||
os << "Available options:\n";
|
||||
size_t coldesc = 0;
|
||||
for (options_set::const_iterator iter = opts.begin();
|
||||
iter != opts.end(); iter++) {
|
||||
const option& opt = (*iter);
|
||||
|
||||
if (opt.m_argument.length() + 1 > coldesc)
|
||||
coldesc = opt.m_argument.length() + 1;
|
||||
}
|
||||
for (options_set::const_iterator iter = opts.begin();
|
||||
iter != opts.end(); iter++) {
|
||||
const option& opt = (*iter);
|
||||
|
||||
std::string tag = std::string(" -") + opt.m_character;
|
||||
if (opt.m_argument.empty())
|
||||
tag += " ";
|
||||
else
|
||||
tag += " " + opt.m_argument + " ";
|
||||
os << ui::format_text_with_tag(opt.m_description, tag, false,
|
||||
coldesc + 10) << "\n";
|
||||
}
|
||||
os << "\n";
|
||||
|
||||
std::string gmp;
|
||||
if (!m_global_manpage.empty())
|
||||
gmp = " and " + m_global_manpage;
|
||||
os << ui::format_text("For more details please see " + m_manpage +
|
||||
gmp + ".")
|
||||
<< "\n";
|
||||
}
|
||||
|
||||
int
|
||||
impl::app::run(int argc, char* const* argv)
|
||||
{
|
||||
|
|
@ -290,55 +227,22 @@ impl::app::run(int argc, char* const* argv)
|
|||
|
||||
int errcode;
|
||||
try {
|
||||
int oldargc = m_argc;
|
||||
|
||||
process_options();
|
||||
|
||||
if (m_hflag) {
|
||||
INV(m_use_ui);
|
||||
if (oldargc != 2)
|
||||
throw usage_error("-h must be given alone.");
|
||||
|
||||
usage(std::cout);
|
||||
errcode = EXIT_SUCCESS;
|
||||
} else
|
||||
errcode = main();
|
||||
errcode = main();
|
||||
} catch (const usage_error& e) {
|
||||
if (m_use_ui) {
|
||||
std::cerr << ui::format_error(m_prog_name, e.what()) << "\n"
|
||||
<< ui::format_info(m_prog_name, std::string("Type `") +
|
||||
m_prog_name + " -h' for more details.")
|
||||
<< "\n";
|
||||
} else {
|
||||
std::cerr << m_prog_name << ": ERROR: " << e.what() << "\n";
|
||||
std::cerr << m_prog_name << ": See " << m_manpage << " for usage "
|
||||
"details.\n";
|
||||
}
|
||||
std::cerr << m_prog_name << ": ERROR: " << e.what() << "\n";
|
||||
std::cerr << m_prog_name << ": See " << m_manpage << " for usage "
|
||||
"details.\n";
|
||||
errcode = EXIT_FAILURE;
|
||||
} catch (const std::runtime_error& e) {
|
||||
if (m_use_ui) {
|
||||
std::cerr << ui::format_error(m_prog_name, std::string(e.what()))
|
||||
<< "\n";
|
||||
} else {
|
||||
std::cerr << m_prog_name << ": ERROR: " << e.what() << "\n";
|
||||
}
|
||||
std::cerr << m_prog_name << ": ERROR: " << e.what() << "\n";
|
||||
errcode = EXIT_FAILURE;
|
||||
} catch (const std::exception& e) {
|
||||
if (m_use_ui) {
|
||||
std::cerr << ui::format_error(m_prog_name, std::string("Caught "
|
||||
"unexpected error: ") + e.what() + "\n" + bug) << "\n";
|
||||
} else {
|
||||
std::cerr << m_prog_name << ": ERROR: Caught unexpected error: "
|
||||
<< e.what() << "\n";
|
||||
}
|
||||
std::cerr << m_prog_name << ": ERROR: Caught unexpected error: "
|
||||
<< e.what() << "\n";
|
||||
errcode = EXIT_FAILURE;
|
||||
} catch (...) {
|
||||
if (m_use_ui) {
|
||||
std::cerr << ui::format_error(m_prog_name, std::string("Caught "
|
||||
"unknown error\n") + bug) << "\n";
|
||||
} else {
|
||||
std::cerr << m_prog_name << ": ERROR: Caught unknown error\n";
|
||||
}
|
||||
std::cerr << m_prog_name << ": ERROR: Caught unknown error\n";
|
||||
errcode = EXIT_FAILURE;
|
||||
}
|
||||
return errcode;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,10 +22,9 @@
|
|||
// 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_CXX_APPLICATION_HPP_)
|
||||
#define _ATF_CXX_APPLICATION_HPP_
|
||||
#if !defined(ATF_CXX_DETAIL_APPLICATION_HPP)
|
||||
#define ATF_CXX_DETAIL_APPLICATION_HPP
|
||||
|
||||
#include <ostream>
|
||||
#include <set>
|
||||
|
|
@ -74,8 +70,6 @@ public:
|
|||
// ------------------------------------------------------------------------
|
||||
|
||||
class app {
|
||||
bool m_hflag;
|
||||
|
||||
void process_options(void);
|
||||
void usage(std::ostream&);
|
||||
|
||||
|
|
@ -90,8 +84,7 @@ protected:
|
|||
const char* m_argv0;
|
||||
const char* m_prog_name;
|
||||
std::string m_description;
|
||||
std::string m_manpage, m_global_manpage;
|
||||
const bool m_use_ui;
|
||||
std::string m_manpage;
|
||||
|
||||
options_set options(void);
|
||||
|
||||
|
|
@ -102,8 +95,7 @@ protected:
|
|||
virtual int main(void) = 0;
|
||||
|
||||
public:
|
||||
app(const std::string&, const std::string&, const std::string&,
|
||||
bool = true);
|
||||
app(const std::string&, const std::string&);
|
||||
virtual ~app(void);
|
||||
|
||||
int run(int, char* const*);
|
||||
|
|
@ -112,4 +104,4 @@ public:
|
|||
} // namespace application
|
||||
} // namespace atf
|
||||
|
||||
#endif // !defined(_ATF_CXX_APPLICATION_HPP_)
|
||||
#endif // !defined(ATF_CXX_DETAIL_APPLICATION_HPP)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2009 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,19 +22,18 @@
|
|||
// 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 "atf-c++/detail/application.hpp"
|
||||
|
||||
extern "C" {
|
||||
#include <unistd.h>
|
||||
}
|
||||
|
||||
#include "application.hpp"
|
||||
|
||||
#include "../macros.hpp"
|
||||
#include <atf-c++.hpp>
|
||||
|
||||
class getopt_app : public atf::application::app {
|
||||
public:
|
||||
getopt_app(void) : app("description", "manpage", "other") {}
|
||||
getopt_app(void) : app("description", "manpage") {}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,10 +22,9 @@
|
|||
// 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_CXX_AUTO_ARRAY_HPP_)
|
||||
#define _ATF_CXX_AUTO_ARRAY_HPP_
|
||||
#if !defined(ATF_CXX_DETAIL_AUTO_ARRAY_HPP)
|
||||
#define ATF_CXX_DETAIL_AUTO_ARRAY_HPP
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
|
|
@ -176,4 +172,4 @@ auto_array< T >::operator auto_array_ref< T >(void)
|
|||
|
||||
} // namespace atf
|
||||
|
||||
#endif // !defined(_ATF_CXX_AUTO_ARRAY_HPP_)
|
||||
#endif // !defined(ATF_CXX_DETAIL_AUTO_ARRAY_HPP)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,7 +22,8 @@
|
|||
// 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 "atf-c++/detail/auto_array.hpp"
|
||||
|
||||
extern "C" {
|
||||
#include <sys/types.h>
|
||||
|
|
@ -33,11 +31,11 @@ extern "C" {
|
|||
|
||||
#include <iostream>
|
||||
|
||||
#include <atf-c++.hpp>
|
||||
|
||||
extern "C" {
|
||||
#include "atf-c/defs.h"
|
||||
|
||||
#include "../macros.hpp"
|
||||
|
||||
#include "auto_array.hpp"
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Tests for the "auto_array" class.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,17 +22,16 @@
|
|||
// 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 "atf-c++/detail/env.hpp"
|
||||
|
||||
extern "C" {
|
||||
#include "../../atf-c/error.h"
|
||||
|
||||
#include "../../atf-c/detail/env.h"
|
||||
#include "atf-c/detail/env.h"
|
||||
#include "atf-c/error.h"
|
||||
}
|
||||
|
||||
#include "env.hpp"
|
||||
#include "exceptions.hpp"
|
||||
#include "sanity.hpp"
|
||||
#include "atf-c++/detail/exceptions.hpp"
|
||||
#include "atf-c++/detail/sanity.hpp"
|
||||
|
||||
namespace impl = atf::env;
|
||||
#define IMPL_NAME "atf::env"
|
||||
|
|
@ -50,6 +46,12 @@ impl::get(const std::string& name)
|
|||
return atf_env_get(name.c_str());
|
||||
}
|
||||
|
||||
std::string
|
||||
impl::get(const std::string& name, const std::string& default_value)
|
||||
{
|
||||
return atf_env_get_with_default(name.c_str(), default_value.c_str());
|
||||
}
|
||||
|
||||
bool
|
||||
impl::has(const std::string& name)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,10 +22,9 @@
|
|||
// 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_CXX_ENV_HPP_)
|
||||
#define _ATF_CXX_ENV_HPP_
|
||||
#if !defined(ATF_CXX_DETAIL_ENV_HPP)
|
||||
#define ATF_CXX_DETAIL_ENV_HPP
|
||||
|
||||
#include <string>
|
||||
|
||||
|
|
@ -47,6 +43,11 @@ namespace env {
|
|||
//!
|
||||
std::string get(const std::string&);
|
||||
|
||||
//!
|
||||
//! \brief Returns the value of an environment variable with a default.
|
||||
//!
|
||||
std::string get(const std::string&, const std::string&);
|
||||
|
||||
//!
|
||||
//! \brief Checks if the environment has a variable.
|
||||
//!
|
||||
|
|
@ -81,4 +82,4 @@ void unset(const std::string&);
|
|||
} // namespace env
|
||||
} // namespace atf
|
||||
|
||||
#endif // !defined(_ATF_CXX_ENV_HPP_)
|
||||
#endif // !defined(ATF_CXX_DETAIL_ENV_HPP)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,11 +22,10 @@
|
|||
// 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 "../macros.hpp"
|
||||
#include "atf-c++/detail/env.hpp"
|
||||
|
||||
#include "env.hpp"
|
||||
#include <atf-c++.hpp>
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Test cases for the free functions.
|
||||
|
|
@ -48,6 +44,19 @@ ATF_TEST_CASE_BODY(has_get)
|
|||
ATF_REQUIRE(!atf::env::has("_UNDEFINED_VARIABLE_"));
|
||||
}
|
||||
|
||||
ATF_TEST_CASE(get_with_default);
|
||||
ATF_TEST_CASE_HEAD(get_with_default)
|
||||
{
|
||||
set_md_var("descr", "Tests the get function with a default value");
|
||||
}
|
||||
ATF_TEST_CASE_BODY(get_with_default)
|
||||
{
|
||||
ATF_REQUIRE(atf::env::has("PATH"));
|
||||
ATF_REQUIRE(atf::env::get("PATH", "default value") != "default value");
|
||||
|
||||
ATF_REQUIRE_EQ(atf::env::get("_UNDEFINED_VARIABLE_", "foo bar"), "foo bar");
|
||||
}
|
||||
|
||||
ATF_TEST_CASE(set);
|
||||
ATF_TEST_CASE_HEAD(set)
|
||||
{
|
||||
|
|
@ -86,6 +95,7 @@ ATF_INIT_TEST_CASES(tcs)
|
|||
{
|
||||
// Add the test cases for the free functions.
|
||||
ATF_ADD_TEST_CASE(tcs, has_get);
|
||||
ATF_ADD_TEST_CASE(tcs, get_with_default);
|
||||
ATF_ADD_TEST_CASE(tcs, set);
|
||||
ATF_ADD_TEST_CASE(tcs, unset);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,10 +22,11 @@
|
|||
// 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 "atf-c++/detail/exceptions.hpp"
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "bconfig.h"
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <cstdarg>
|
||||
|
|
@ -37,11 +35,10 @@
|
|||
#include <new>
|
||||
|
||||
extern "C" {
|
||||
#include "../../atf-c/error.h"
|
||||
};
|
||||
#include "atf-c/error.h"
|
||||
}
|
||||
|
||||
#include "exceptions.hpp"
|
||||
#include "sanity.hpp"
|
||||
#include "atf-c++/detail/sanity.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// The "system_error" type.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,10 +22,9 @@
|
|||
// 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_CXX_EXCEPTIONS_HPP_)
|
||||
#define _ATF_CXX_EXCEPTIONS_HPP_
|
||||
#if !defined(ATF_CXX_DETAIL_EXCEPTIONS_HPP)
|
||||
#define ATF_CXX_DETAIL_EXCEPTIONS_HPP
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
|
@ -39,47 +35,6 @@ struct atf_error;
|
|||
|
||||
namespace atf {
|
||||
|
||||
template< class T >
|
||||
class not_found_error :
|
||||
public std::runtime_error
|
||||
{
|
||||
T m_value;
|
||||
|
||||
public:
|
||||
not_found_error(const std::string& message, const T& value) throw();
|
||||
|
||||
virtual ~not_found_error(void) throw();
|
||||
|
||||
const T& get_value(void) const throw();
|
||||
};
|
||||
|
||||
template< class T >
|
||||
inline
|
||||
not_found_error< T >::not_found_error(const std::string& message,
|
||||
const T& value)
|
||||
throw() :
|
||||
std::runtime_error(message),
|
||||
m_value(value)
|
||||
{
|
||||
}
|
||||
|
||||
template< class T >
|
||||
inline
|
||||
not_found_error< T >::~not_found_error(void)
|
||||
throw()
|
||||
{
|
||||
}
|
||||
|
||||
template< class T >
|
||||
inline
|
||||
const T&
|
||||
not_found_error< T >::get_value(void)
|
||||
const
|
||||
throw()
|
||||
{
|
||||
return m_value;
|
||||
}
|
||||
|
||||
class system_error : public std::runtime_error {
|
||||
int m_sys_err;
|
||||
mutable std::string m_message;
|
||||
|
|
@ -96,4 +51,4 @@ void throw_atf_error(struct atf_error *);
|
|||
|
||||
} // namespace atf
|
||||
|
||||
#endif // !defined(_ATF_CXX_EXCEPTIONS_HPP_)
|
||||
#endif // !defined(ATF_CXX_DETAIL_EXCEPTIONS_HPP)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2009 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,19 +22,19 @@
|
|||
// 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 "atf-c++/detail/exceptions.hpp"
|
||||
|
||||
extern "C" {
|
||||
#include "../../atf-c/error.h"
|
||||
#include "atf-c/error.h"
|
||||
}
|
||||
|
||||
#include <cstdio>
|
||||
#include <new>
|
||||
|
||||
#include "../macros.hpp"
|
||||
#include <atf-c++.hpp>
|
||||
|
||||
#include "exceptions.hpp"
|
||||
#include "sanity.hpp"
|
||||
#include "atf-c++/detail/sanity.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// The "test" error.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,10 +22,11 @@
|
|||
// 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 "atf-c++/detail/fs.hpp"
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "bconfig.h"
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
|
|
@ -47,17 +45,15 @@ extern "C" {
|
|||
#include <cstring>
|
||||
|
||||
extern "C" {
|
||||
#include "../../atf-c/error.h"
|
||||
#include "atf-c/error.h"
|
||||
}
|
||||
|
||||
#include "../utils.hpp"
|
||||
|
||||
#include "exceptions.hpp"
|
||||
#include "env.hpp"
|
||||
#include "fs.hpp"
|
||||
#include "process.hpp"
|
||||
#include "sanity.hpp"
|
||||
#include "text.hpp"
|
||||
#include "atf-c++/detail/env.hpp"
|
||||
#include "atf-c++/detail/exceptions.hpp"
|
||||
#include "atf-c++/detail/process.hpp"
|
||||
#include "atf-c++/detail/sanity.hpp"
|
||||
#include "atf-c++/detail/text.hpp"
|
||||
#include "atf-c++/utils.hpp"
|
||||
|
||||
namespace impl = atf::fs;
|
||||
#define IMPL_NAME "atf::fs"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,10 +22,9 @@
|
|||
// 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_CXX_FS_HPP_)
|
||||
#define _ATF_CXX_FS_HPP_
|
||||
#if !defined(ATF_CXX_DETAIL_FS_HPP)
|
||||
#define ATF_CXX_DETAIL_FS_HPP
|
||||
|
||||
extern "C" {
|
||||
#include <sys/types.h>
|
||||
|
|
@ -42,7 +38,7 @@ extern "C" {
|
|||
#include <string>
|
||||
|
||||
extern "C" {
|
||||
#include "../../atf-c/detail/fs.h"
|
||||
#include "atf-c/detail/fs.h"
|
||||
}
|
||||
|
||||
namespace atf {
|
||||
|
|
@ -388,4 +384,4 @@ void rmdir(const path&);
|
|||
} // namespace fs
|
||||
} // namespace atf
|
||||
|
||||
#endif // !defined(_ATF_CXX_FS_HPP_)
|
||||
#endif // !defined(ATF_CXX_DETAIL_FS_HPP)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,7 +22,8 @@
|
|||
// 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 "atf-c++/detail/fs.hpp"
|
||||
|
||||
extern "C" {
|
||||
#include <sys/types.h>
|
||||
|
|
@ -36,10 +34,9 @@ extern "C" {
|
|||
#include <cerrno>
|
||||
#include <cstdio>
|
||||
|
||||
#include "../macros.hpp"
|
||||
#include <atf-c++.hpp>
|
||||
|
||||
#include "exceptions.hpp"
|
||||
#include "fs.hpp"
|
||||
#include "atf-c++/detail/exceptions.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Auxiliary functions.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,21 +22,20 @@
|
|||
// 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 "atf-c++/detail/process.hpp"
|
||||
|
||||
extern "C" {
|
||||
#include <signal.h>
|
||||
|
||||
#include "../../atf-c/error.h"
|
||||
|
||||
#include "../../atf-c/detail/process.h"
|
||||
#include "atf-c/detail/process.h"
|
||||
#include "atf-c/error.h"
|
||||
}
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "exceptions.hpp"
|
||||
#include "process.hpp"
|
||||
#include "sanity.hpp"
|
||||
#include "atf-c++/detail/exceptions.hpp"
|
||||
#include "atf-c++/detail/sanity.hpp"
|
||||
|
||||
namespace detail = atf::process::detail;
|
||||
namespace impl = atf::process;
|
||||
|
|
@ -341,11 +337,6 @@ impl::child::stderr_fd(void)
|
|||
void
|
||||
detail::flush_streams(void)
|
||||
{
|
||||
// This is a weird hack to ensure that the output of the parent process
|
||||
// is flushed before executing a child which prevents, for example, the
|
||||
// output of the atf-run hooks to appear before the output of atf-run
|
||||
// itself.
|
||||
//
|
||||
// TODO: This should only be executed when inheriting the stdout or
|
||||
// stderr file descriptors. However, the flushing is specific to the
|
||||
// iostreams, so we cannot do it from the C library where all the process
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,25 +22,23 @@
|
|||
// 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_CXX_PROCESS_HPP_)
|
||||
#define _ATF_CXX_PROCESS_HPP_
|
||||
#if !defined(ATF_CXX_DETAIL_PROCESS_HPP)
|
||||
#define ATF_CXX_DETAIL_PROCESS_HPP
|
||||
|
||||
extern "C" {
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "../../atf-c/error.h"
|
||||
|
||||
#include "../../atf-c/detail/process.h"
|
||||
#include <atf-c/detail/process.h>
|
||||
#include <atf-c/error.h>
|
||||
}
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "auto_array.hpp"
|
||||
#include "exceptions.hpp"
|
||||
#include "fs.hpp"
|
||||
#include <atf-c++/detail/auto_array.hpp>
|
||||
#include <atf-c++/detail/exceptions.hpp>
|
||||
#include <atf-c++/detail/fs.hpp>
|
||||
|
||||
namespace atf {
|
||||
namespace process {
|
||||
|
|
@ -276,4 +271,4 @@ exec(const atf::fs::path& prog, const argv_array& argv,
|
|||
} // namespace process
|
||||
} // namespace atf
|
||||
|
||||
#endif // !defined(_ATF_CXX_PROCESS_HPP_)
|
||||
#endif // !defined(ATF_CXX_DETAIL_PROCESS_HPP)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,15 +22,15 @@
|
|||
// 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 "atf-c++/detail/process.hpp"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
#include "../macros.hpp"
|
||||
#include <atf-c++.hpp>
|
||||
|
||||
#include "process.hpp"
|
||||
#include "test_helpers.hpp"
|
||||
#include "atf-c++/detail/test_helpers.hpp"
|
||||
|
||||
// TODO: Testing the fork function is a huge task and I'm afraid of
|
||||
// copy/pasting tons of stuff from the C version. I'd rather not do that
|
||||
|
|
@ -64,10 +61,10 @@ exec_process_helpers(const atf::tests::tc& tc, const char* helper_name)
|
|||
using atf::process::exec;
|
||||
|
||||
std::vector< std::string > argv;
|
||||
argv.push_back(get_process_helpers_path(tc).leaf_name());
|
||||
argv.push_back(get_process_helpers_path(tc, true).leaf_name());
|
||||
argv.push_back(helper_name);
|
||||
|
||||
return exec(get_process_helpers_path(tc),
|
||||
return exec(get_process_helpers_path(tc, true),
|
||||
atf::process::argv_array(argv),
|
||||
atf::process::stream_inherit(),
|
||||
atf::process::stream_inherit());
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,13 +22,12 @@
|
|||
// 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_CXX_SANITY_HPP_)
|
||||
#define _ATF_CXX_SANITY_HPP_
|
||||
#if !defined(ATF_CXX_DETAIL_SANITY_HPP)
|
||||
#define ATF_CXX_DETAIL_SANITY_HPP
|
||||
|
||||
extern "C" {
|
||||
#include "../../atf-c/detail/sanity.h"
|
||||
#include <atf-c/detail/sanity.h>
|
||||
}
|
||||
|
||||
#endif // !defined(_ATF_CXX_SANITY_HPP_)
|
||||
#endif // !defined(ATF_CXX_DETAIL_SANITY_HPP)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2009 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,95 +22,79 @@
|
|||
// 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 "atf-c++/detail/test_helpers.hpp"
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "../check.hpp"
|
||||
#include "../config.hpp"
|
||||
#include "../macros.hpp"
|
||||
#include <atf-c++.hpp>
|
||||
|
||||
#include "fs.hpp"
|
||||
#include "process.hpp"
|
||||
#include "test_helpers.hpp"
|
||||
#include "atf-c++/check.hpp"
|
||||
#include "atf-c++/detail/env.hpp"
|
||||
#include "atf-c++/detail/fs.hpp"
|
||||
#include "atf-c++/detail/process.hpp"
|
||||
|
||||
void
|
||||
build_check_cxx_o_aux(const atf::fs::path& sfile, const char* failmsg,
|
||||
const bool expect_pass)
|
||||
// Path to the directory containing the libatf-c tests, used to locate the
|
||||
// process_helpers program. If NULL (the default), the code will use a
|
||||
// relative path. Otherwise, the provided path will be used; this is so
|
||||
// that we can locate the helpers binary if the installation uses a
|
||||
// different layout than the one we provide (as is the case in FreeBSD).
|
||||
#if defined(ATF_C_TESTS_BASE)
|
||||
static const char* atf_c_tests_base = ATF_C_TESTS_BASE;
|
||||
#else
|
||||
static const char* atf_c_tests_base = NULL;
|
||||
#endif
|
||||
#undef ATF_C_TESTS_BASE
|
||||
|
||||
bool
|
||||
build_check_cxx_o(const char* sfile)
|
||||
{
|
||||
std::vector< std::string > optargs;
|
||||
optargs.push_back("-I" + atf::config::get("atf_includedir"));
|
||||
optargs.push_back("-I" + atf::env::get("ATF_INCLUDEDIR", ATF_INCLUDEDIR));
|
||||
optargs.push_back("-Wall");
|
||||
optargs.push_back("-Werror");
|
||||
|
||||
const bool result = atf::check::build_cxx_o(
|
||||
sfile.str(), "test.o", atf::process::argv_array(optargs));
|
||||
if ((expect_pass && !result) || (!expect_pass && result))
|
||||
ATF_FAIL(failmsg);
|
||||
return atf::check::build_cxx_o(sfile, "test.o",
|
||||
atf::process::argv_array(optargs));
|
||||
}
|
||||
|
||||
void
|
||||
build_check_cxx_o(const atf::tests::tc& tc, const char* sfile,
|
||||
const char* failmsg, const bool expect_pass)
|
||||
bool
|
||||
build_check_cxx_o_srcdir(const atf::tests::tc& tc, const char* sfile)
|
||||
{
|
||||
const atf::fs::path sfilepath =
|
||||
atf::fs::path(tc.get_config_var("srcdir")) / sfile;
|
||||
build_check_cxx_o_aux(sfilepath, failmsg, expect_pass);
|
||||
return build_check_cxx_o(sfilepath.c_str());
|
||||
}
|
||||
|
||||
void
|
||||
header_check(const char *hdrname)
|
||||
{
|
||||
std::ofstream srcfile("test.c");
|
||||
std::ofstream srcfile("test.cpp");
|
||||
ATF_REQUIRE(srcfile);
|
||||
srcfile << "#include <" << hdrname << ">\n";
|
||||
srcfile.close();
|
||||
|
||||
const std::string failmsg = std::string("Header check failed; ") +
|
||||
hdrname + " is not self-contained";
|
||||
build_check_cxx_o_aux(atf::fs::path("test.c"), failmsg.c_str(), true);
|
||||
if (!build_check_cxx_o("test.cpp"))
|
||||
ATF_FAIL(failmsg);
|
||||
}
|
||||
|
||||
atf::fs::path
|
||||
get_process_helpers_path(const atf::tests::tc& tc)
|
||||
get_process_helpers_path(const atf::tests::tc& tc, bool is_detail)
|
||||
{
|
||||
return atf::fs::path(tc.get_config_var("srcdir")) /
|
||||
".." / "atf-c" / "detail" / "process_helpers";
|
||||
}
|
||||
|
||||
void
|
||||
test_helpers_detail::check_equal(const char* expected[],
|
||||
const string_vector& actual)
|
||||
{
|
||||
const char** expected_iter = expected;
|
||||
string_vector::const_iterator actual_iter = actual.begin();
|
||||
|
||||
bool equals = true;
|
||||
while (equals && *expected_iter != NULL && actual_iter != actual.end()) {
|
||||
if (*expected_iter != *actual_iter) {
|
||||
equals = false;
|
||||
} else {
|
||||
expected_iter++;
|
||||
actual_iter++;
|
||||
}
|
||||
}
|
||||
if (equals && ((*expected_iter == NULL && actual_iter != actual.end()) ||
|
||||
(*expected_iter != NULL && actual_iter == actual.end())))
|
||||
equals = false;
|
||||
|
||||
if (!equals) {
|
||||
std::cerr << "EXPECTED:\n";
|
||||
for (expected_iter = expected; *expected_iter != NULL; expected_iter++)
|
||||
std::cerr << *expected_iter << "\n";
|
||||
|
||||
std::cerr << "ACTUAL:\n";
|
||||
for (actual_iter = actual.begin(); actual_iter != actual.end();
|
||||
actual_iter++)
|
||||
std::cerr << *actual_iter << "\n";
|
||||
|
||||
ATF_FAIL("Expected results differ to actual values");
|
||||
const char* helper = "detail/process_helpers";
|
||||
if (atf_c_tests_base == NULL) {
|
||||
if (is_detail)
|
||||
return atf::fs::path(tc.get_config_var("srcdir")) /
|
||||
".." / ".." / "atf-c" / helper;
|
||||
else
|
||||
return atf::fs::path(tc.get_config_var("srcdir")) /
|
||||
".." / "atf-c" / helper;
|
||||
} else {
|
||||
return atf::fs::path(atf_c_tests_base) / helper;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2009 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,12 +22,11 @@
|
|||
// 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(TESTS_ATF_ATF_CXX_TEST_HELPERS_H)
|
||||
#if defined(ATF_CXX_DETAIL_TEST_HELPERS_H)
|
||||
# error "Cannot include test_helpers.hpp more than once."
|
||||
#else
|
||||
# define TESTS_ATF_ATF_CXX_TEST_HELPERS_H
|
||||
# define ATF_CXX_DETAIL_TEST_HELPERS_H
|
||||
#endif
|
||||
|
||||
#include <cstdlib>
|
||||
|
|
@ -38,11 +34,9 @@
|
|||
#include <sstream>
|
||||
#include <utility>
|
||||
|
||||
#include "../macros.hpp"
|
||||
#include "../tests.hpp"
|
||||
#include "parser.hpp"
|
||||
#include "process.hpp"
|
||||
#include "text.hpp"
|
||||
#include <atf-c++.hpp>
|
||||
|
||||
#include <atf-c++/detail/process.hpp>
|
||||
|
||||
#define HEADER_TC(name, hdrname) \
|
||||
ATF_TEST_CASE(name); \
|
||||
|
|
@ -64,18 +58,8 @@
|
|||
} \
|
||||
ATF_TEST_CASE_BODY(name) \
|
||||
{ \
|
||||
build_check_cxx_o(*this, sfile, failmsg, true); \
|
||||
}
|
||||
|
||||
#define BUILD_TC_FAIL(name, sfile, descr, failmsg) \
|
||||
ATF_TEST_CASE(name); \
|
||||
ATF_TEST_CASE_HEAD(name) \
|
||||
{ \
|
||||
set_md_var("descr", descr); \
|
||||
} \
|
||||
ATF_TEST_CASE_BODY(name) \
|
||||
{ \
|
||||
build_check_cxx_o(*this, sfile, failmsg, false); \
|
||||
if (!build_check_cxx_o_srcdir(*this, sfile)) \
|
||||
ATF_FAIL(failmsg); \
|
||||
}
|
||||
|
||||
namespace atf {
|
||||
|
|
@ -85,8 +69,9 @@ class tc;
|
|||
}
|
||||
|
||||
void header_check(const char*);
|
||||
void build_check_cxx_o(const atf::tests::tc&, const char*, const char*, bool);
|
||||
atf::fs::path get_process_helpers_path(const atf::tests::tc&);
|
||||
bool build_check_cxx_o(const char*);
|
||||
bool build_check_cxx_o_srcdir(const atf::tests::tc&, const char*);
|
||||
atf::fs::path get_process_helpers_path(const atf::tests::tc&, bool);
|
||||
|
||||
struct run_h_tc_data {
|
||||
const atf::tests::vars_map& m_config;
|
||||
|
|
@ -120,45 +105,3 @@ run_h_tc(atf::tests::vars_map config = atf::tests::vars_map())
|
|||
const atf::process::status s = c.wait();
|
||||
ATF_REQUIRE(s.exited());
|
||||
}
|
||||
|
||||
namespace test_helpers_detail {
|
||||
|
||||
typedef std::vector< std::string > string_vector;
|
||||
|
||||
template< class Reader >
|
||||
std::pair< string_vector, string_vector >
|
||||
do_read(const char* input)
|
||||
{
|
||||
string_vector errors;
|
||||
|
||||
std::istringstream is(input);
|
||||
Reader reader(is);
|
||||
try {
|
||||
reader.read();
|
||||
} catch (const atf::parser::parse_errors& pes) {
|
||||
for (std::vector< atf::parser::parse_error >::const_iterator iter =
|
||||
pes.begin(); iter != pes.end(); iter++)
|
||||
errors.push_back(*iter);
|
||||
} catch (const atf::parser::parse_error& pe) {
|
||||
ATF_FAIL("Raised a lonely parse error: " +
|
||||
atf::text::to_string(pe.first) + ": " + pe.second);
|
||||
}
|
||||
|
||||
return std::make_pair(reader.m_calls, errors);
|
||||
}
|
||||
|
||||
void check_equal(const char*[], const string_vector&);
|
||||
|
||||
} // namespace test_helpers_detail
|
||||
|
||||
template< class Reader >
|
||||
void
|
||||
do_parser_test(const char* input, const char* exp_calls[],
|
||||
const char* exp_errors[])
|
||||
{
|
||||
const std::pair< test_helpers_detail::string_vector,
|
||||
test_helpers_detail::string_vector >
|
||||
actual = test_helpers_detail::do_read< Reader >(input);
|
||||
test_helpers_detail::check_equal(exp_calls, actual.first);
|
||||
test_helpers_detail::check_equal(exp_errors, actual.second);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,7 +22,8 @@
|
|||
// 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 "atf-c++/detail/text.hpp"
|
||||
|
||||
extern "C" {
|
||||
#include <regex.h>
|
||||
|
|
@ -35,13 +33,11 @@ extern "C" {
|
|||
#include <cstring>
|
||||
|
||||
extern "C" {
|
||||
#include "../../atf-c/error.h"
|
||||
|
||||
#include "../../atf-c/detail/text.h"
|
||||
#include "atf-c/detail/text.h"
|
||||
#include "atf-c/error.h"
|
||||
}
|
||||
|
||||
#include "exceptions.hpp"
|
||||
#include "text.hpp"
|
||||
#include "atf-c++/detail/exceptions.hpp"
|
||||
|
||||
namespace impl = atf::text;
|
||||
#define IMPL_NAME "atf::text"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,10 +22,9 @@
|
|||
// 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_CXX_TEXT_HPP_)
|
||||
#define _ATF_CXX_TEXT_HPP_
|
||||
#if !defined(ATF_CXX_DETAIL_TEXT_HPP)
|
||||
#define ATF_CXX_DETAIL_TEXT_HPP
|
||||
|
||||
extern "C" {
|
||||
#include <stdint.h>
|
||||
|
|
@ -150,4 +146,4 @@ to_type(const std::string& str)
|
|||
} // namespace text
|
||||
} // namespace atf
|
||||
|
||||
#endif // !defined(_ATF_CXX_TEXT_HPP_)
|
||||
#endif // !defined(ATF_CXX_DETAIL_TEXT_HPP)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,15 +22,14 @@
|
|||
// 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 "atf-c++/detail/text.hpp"
|
||||
|
||||
#include <cstring>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
#include "../macros.hpp"
|
||||
|
||||
#include "text.hpp"
|
||||
#include <atf-c++.hpp>
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Test cases for the free functions.
|
||||
|
|
|
|||
41
unit/atf-src/atf-c++/detail/version_helper.cpp
Normal file
41
unit/atf-src/atf-c++/detail/version_helper.cpp
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
// Copyright 2014 Google 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:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * 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.
|
||||
// * Neither the name of Google Inc. 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 COPYRIGHT HOLDERS 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 COPYRIGHT
|
||||
// OWNER 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(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
std::cout << PACKAGE_VERSION << "\n";
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,10 +22,9 @@
|
|||
// 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_CXX_MACROS_HPP_)
|
||||
#define _ATF_CXX_MACROS_HPP_
|
||||
#if !defined(ATF_CXX_MACROS_HPP)
|
||||
#define ATF_CXX_MACROS_HPP
|
||||
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
|
|
@ -99,21 +95,23 @@
|
|||
|
||||
#define ATF_PASS() atf::tests::tc::pass()
|
||||
|
||||
#define ATF_REQUIRE(x) \
|
||||
#define ATF_REQUIRE(expression) \
|
||||
do { \
|
||||
if (!(x)) { \
|
||||
if (!(expression)) { \
|
||||
std::ostringstream atfu_ss; \
|
||||
atfu_ss << "Line " << __LINE__ << ": " << #x << " not met"; \
|
||||
atfu_ss << "Line " << __LINE__ << ": " << #expression \
|
||||
<< " not met"; \
|
||||
atf::tests::tc::fail(atfu_ss.str()); \
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
#define ATF_REQUIRE_EQ(x, y) \
|
||||
#define ATF_REQUIRE_EQ(expected, actual) \
|
||||
do { \
|
||||
if ((x) != (y)) { \
|
||||
if ((expected) != (actual)) { \
|
||||
std::ostringstream atfu_ss; \
|
||||
atfu_ss << "Line " << __LINE__ << ": " << #x << " != " << #y \
|
||||
<< " (" << (x) << " != " << (y) << ")"; \
|
||||
atfu_ss << "Line " << __LINE__ << ": " \
|
||||
<< #expected << " != " << #actual \
|
||||
<< " (" << (expected) << " != " << (actual) << ")"; \
|
||||
atf::tests::tc::fail(atfu_ss.str()); \
|
||||
} \
|
||||
} while (false)
|
||||
|
|
@ -134,69 +132,74 @@
|
|||
} \
|
||||
} while (false)
|
||||
|
||||
#define ATF_REQUIRE_THROW(e, x) \
|
||||
#define ATF_REQUIRE_THROW(expected_exception, statement) \
|
||||
do { \
|
||||
try { \
|
||||
x; \
|
||||
statement; \
|
||||
std::ostringstream atfu_ss; \
|
||||
atfu_ss << "Line " << __LINE__ << ": " #x " did not throw " \
|
||||
#e " as expected"; \
|
||||
atfu_ss << "Line " << __LINE__ \
|
||||
<< ": " #statement " did not throw " #expected_exception \
|
||||
" as expected"; \
|
||||
atf::tests::tc::fail(atfu_ss.str()); \
|
||||
} catch (const e&) { \
|
||||
} catch (const expected_exception&) { \
|
||||
} catch (const std::exception& atfu_e) { \
|
||||
std::ostringstream atfu_ss; \
|
||||
atfu_ss << "Line " << __LINE__ << ": " #x " threw an " \
|
||||
"unexpected error (not " #e "): " << atfu_e.what(); \
|
||||
atfu_ss << "Line " << __LINE__ << ": " #statement " threw an " \
|
||||
"unexpected error (not " #expected_exception "): " \
|
||||
<< atfu_e.what(); \
|
||||
atf::tests::tc::fail(atfu_ss.str()); \
|
||||
} catch (...) { \
|
||||
std::ostringstream atfu_ss; \
|
||||
atfu_ss << "Line " << __LINE__ << ": " #x " threw an " \
|
||||
"unexpected error (not " #e ")"; \
|
||||
atfu_ss << "Line " << __LINE__ << ": " #statement " threw an " \
|
||||
"unexpected error (not " #expected_exception ")"; \
|
||||
atf::tests::tc::fail(atfu_ss.str()); \
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
#define ATF_REQUIRE_THROW_RE(type, regexp, x) \
|
||||
#define ATF_REQUIRE_THROW_RE(expected_exception, regexp, statement) \
|
||||
do { \
|
||||
try { \
|
||||
x; \
|
||||
statement; \
|
||||
std::ostringstream atfu_ss; \
|
||||
atfu_ss << "Line " << __LINE__ << ": " #x " did not throw " \
|
||||
#type " as expected"; \
|
||||
atfu_ss << "Line " << __LINE__ \
|
||||
<< ": " #statement " did not throw " #expected_exception \
|
||||
" as expected"; \
|
||||
atf::tests::tc::fail(atfu_ss.str()); \
|
||||
} catch (const type& e) { \
|
||||
} catch (const expected_exception& e) { \
|
||||
if (!atf::tests::detail::match(regexp, e.what())) { \
|
||||
std::ostringstream atfu_ss; \
|
||||
atfu_ss << "Line " << __LINE__ << ": " #x " threw " #type "(" \
|
||||
atfu_ss << "Line " << __LINE__ \
|
||||
<< ": " #statement " threw " #expected_exception "(" \
|
||||
<< e.what() << "), but does not match '" << regexp \
|
||||
<< "'"; \
|
||||
atf::tests::tc::fail(atfu_ss.str()); \
|
||||
} \
|
||||
} catch (const std::exception& atfu_e) { \
|
||||
std::ostringstream atfu_ss; \
|
||||
atfu_ss << "Line " << __LINE__ << ": " #x " threw an " \
|
||||
"unexpected error (not " #type "): " << atfu_e.what(); \
|
||||
atfu_ss << "Line " << __LINE__ << ": " #statement " threw an " \
|
||||
"unexpected error (not " #expected_exception "): " \
|
||||
<< atfu_e.what(); \
|
||||
atf::tests::tc::fail(atfu_ss.str()); \
|
||||
} catch (...) { \
|
||||
std::ostringstream atfu_ss; \
|
||||
atfu_ss << "Line " << __LINE__ << ": " #x " threw an " \
|
||||
"unexpected error (not " #type ")"; \
|
||||
atfu_ss << "Line " << __LINE__ << ": " #statement " threw an " \
|
||||
"unexpected error (not " #expected_exception ")"; \
|
||||
atf::tests::tc::fail(atfu_ss.str()); \
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
#define ATF_CHECK_ERRNO(exp_errno, bool_expr) \
|
||||
atf::tests::tc::check_errno(__FILE__, __LINE__, exp_errno, #bool_expr, \
|
||||
bool_expr)
|
||||
#define ATF_CHECK_ERRNO(expected_errno, bool_expr) \
|
||||
atf::tests::tc::check_errno(__FILE__, __LINE__, expected_errno, \
|
||||
#bool_expr, bool_expr)
|
||||
|
||||
#define ATF_REQUIRE_ERRNO(exp_errno, bool_expr) \
|
||||
atf::tests::tc::require_errno(__FILE__, __LINE__, exp_errno, #bool_expr, \
|
||||
bool_expr)
|
||||
#define ATF_REQUIRE_ERRNO(expected_errno, bool_expr) \
|
||||
atf::tests::tc::require_errno(__FILE__, __LINE__, expected_errno, \
|
||||
#bool_expr, bool_expr)
|
||||
|
||||
#define ATF_INIT_TEST_CASES(tcs) \
|
||||
namespace atf { \
|
||||
namespace tests { \
|
||||
int run_tp(int, char* const*, \
|
||||
int run_tp(int, char**, \
|
||||
void (*)(std::vector< atf::tests::tc * >&)); \
|
||||
} \
|
||||
} \
|
||||
|
|
@ -204,7 +207,7 @@
|
|||
static void atfu_init_tcs(std::vector< atf::tests::tc * >&); \
|
||||
\
|
||||
int \
|
||||
main(int argc, char* const* argv) \
|
||||
main(int argc, char** argv) \
|
||||
{ \
|
||||
return atf::tests::run_tp(argc, argv, atfu_init_tcs); \
|
||||
} \
|
||||
|
|
@ -219,4 +222,4 @@
|
|||
(tcs).push_back(atfu_tcptr_ ## tcname); \
|
||||
} while (0);
|
||||
|
||||
#endif // !defined(_ATF_CXX_MACROS_HPP_)
|
||||
#endif // !defined(ATF_CXX_MACROS_HPP)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,12 +22,11 @@
|
|||
// 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-c++/macros.hpp>
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
void
|
||||
atf_check_errno_semicolons(void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,7 +22,8 @@
|
|||
// 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 "atf-c++/macros.hpp"
|
||||
|
||||
extern "C" {
|
||||
#include <fcntl.h>
|
||||
|
|
@ -37,14 +35,14 @@ extern "C" {
|
|||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "macros.hpp"
|
||||
#include "utils.hpp"
|
||||
#include <atf-c++.hpp>
|
||||
|
||||
#include "detail/fs.hpp"
|
||||
#include "detail/process.hpp"
|
||||
#include "detail/sanity.hpp"
|
||||
#include "detail/test_helpers.hpp"
|
||||
#include "detail/text.hpp"
|
||||
#include "atf-c++/detail/fs.hpp"
|
||||
#include "atf-c++/detail/process.hpp"
|
||||
#include "atf-c++/detail/sanity.hpp"
|
||||
#include "atf-c++/detail/test_helpers.hpp"
|
||||
#include "atf-c++/detail/text.hpp"
|
||||
#include "atf-c++/utils.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Auxiliary functions.
|
||||
|
|
@ -757,17 +755,35 @@ ATF_TEST_CASE_BODY(require_errno)
|
|||
// Tests cases for the header file.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
HEADER_TC(include, "atf-c++/macros.hpp");
|
||||
BUILD_TC(use, "macros_hpp_test.cpp",
|
||||
"Tests that the macros provided by the atf-c++/macros.hpp file "
|
||||
"do not cause syntax errors when used",
|
||||
"Build of macros_hpp_test.cpp failed; some macros in "
|
||||
"atf-c++/macros.hpp are broken");
|
||||
BUILD_TC_FAIL(detect_unused_tests, "unused_test.cpp",
|
||||
"Tests that defining an unused test case raises a warning (and thus "
|
||||
"an error)",
|
||||
"Build of unused_test.cpp passed; unused test cases are not properly "
|
||||
"detected");
|
||||
|
||||
ATF_TEST_CASE(detect_unused_tests);
|
||||
ATF_TEST_CASE_HEAD(detect_unused_tests)
|
||||
{
|
||||
set_md_var("descr",
|
||||
"Tests that defining an unused test case raises a warning (and "
|
||||
"thus an error)");
|
||||
}
|
||||
ATF_TEST_CASE_BODY(detect_unused_tests)
|
||||
{
|
||||
const char* validate_compiler =
|
||||
"class test_class { public: int dummy; };\n"
|
||||
"#define define_unused static test_class unused\n"
|
||||
"define_unused;\n";
|
||||
|
||||
atf::utils::create_file("compiler_test.cpp", validate_compiler);
|
||||
if (build_check_cxx_o("compiler_test.cpp"))
|
||||
expect_fail("Compiler does not raise a warning on an unused "
|
||||
"static global variable declared by a macro");
|
||||
|
||||
if (build_check_cxx_o_srcdir(*this, "unused_test.cpp"))
|
||||
ATF_FAIL("Build of unused_test.cpp passed; unused test cases are "
|
||||
"not properly detected");
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Main.
|
||||
|
|
@ -790,7 +806,6 @@ ATF_INIT_TEST_CASES(tcs)
|
|||
ATF_ADD_TEST_CASE(tcs, require_errno);
|
||||
|
||||
// Add the test cases for the header file.
|
||||
ATF_ADD_TEST_CASE(tcs, include);
|
||||
ATF_ADD_TEST_CASE(tcs, use);
|
||||
ATF_ADD_TEST_CASE(tcs, detect_unused_tests);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
#
|
||||
# Automated Testing Framework (atf)
|
||||
#
|
||||
# Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
|
|
@ -25,7 +22,6 @@
|
|||
# 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 atfc++.pc file is installed in a
|
||||
# directory that is known by pkg-config. Otherwise they will fail,
|
||||
|
|
@ -43,10 +39,8 @@ require_pc()
|
|||
|
||||
check_version()
|
||||
{
|
||||
atf_check -s eq:0 -o save:stdout -e empty -x \
|
||||
"atf-version | head -n 1 | cut -d ' ' -f 4"
|
||||
ver1=$(cat stdout)
|
||||
echo "Version reported by atf-version: ${ver1}"
|
||||
ver1=$($(atf_get_srcdir)/detail/version_helper)
|
||||
echo "Version reported by builtin PACKAGE_VERSION: ${ver1}"
|
||||
|
||||
atf_check -s eq:0 -o save:stdout -e empty pkg-config --modversion "${1}"
|
||||
ver2=$(cat stdout)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,7 +22,12 @@
|
|||
// 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 "atf-c++/tests.hpp"
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
#include <sys/types.h>
|
||||
|
|
@ -55,22 +57,26 @@ extern "C" {
|
|||
#include "atf-c/utils.h"
|
||||
}
|
||||
|
||||
#include "noncopyable.hpp"
|
||||
#include "tests.hpp"
|
||||
#include "atf-c++/detail/application.hpp"
|
||||
#include "atf-c++/detail/auto_array.hpp"
|
||||
#include "atf-c++/detail/env.hpp"
|
||||
#include "atf-c++/detail/exceptions.hpp"
|
||||
#include "atf-c++/detail/fs.hpp"
|
||||
#include "atf-c++/detail/sanity.hpp"
|
||||
#include "atf-c++/detail/text.hpp"
|
||||
|
||||
#include "detail/application.hpp"
|
||||
#include "detail/auto_array.hpp"
|
||||
#include "detail/env.hpp"
|
||||
#include "detail/exceptions.hpp"
|
||||
#include "detail/fs.hpp"
|
||||
#include "detail/parser.hpp"
|
||||
#include "detail/sanity.hpp"
|
||||
#include "detail/text.hpp"
|
||||
#if defined(HAVE_GNU_GETOPT)
|
||||
# define GETOPT_POSIX "+"
|
||||
#else
|
||||
# define GETOPT_POSIX ""
|
||||
#endif
|
||||
|
||||
namespace impl = atf::tests;
|
||||
namespace detail = atf::tests::detail;
|
||||
#define IMPL_NAME "atf::tests"
|
||||
|
||||
using atf::application::usage_error;
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// The "atf_tp_writer" class.
|
||||
// ------------------------------------------------------------------------
|
||||
|
|
@ -79,12 +85,7 @@ detail::atf_tp_writer::atf_tp_writer(std::ostream& os) :
|
|||
m_os(os),
|
||||
m_is_first(true)
|
||||
{
|
||||
atf::parser::headers_map hm;
|
||||
atf::parser::attrs_map ct_attrs;
|
||||
ct_attrs["version"] = "1";
|
||||
hm["Content-Type"] = atf::parser::header_entry("Content-Type",
|
||||
"application/X-atf-tp", ct_attrs);
|
||||
atf::parser::write_headers(hm, m_os);
|
||||
m_os << "Content-Type: application/X-atf-tp; version=\"1\"\n\n";
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -116,6 +117,21 @@ detail::atf_tp_writer::tc_meta_data(const std::string& name,
|
|||
// Free helper functions.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
std::string Program_Name;
|
||||
|
||||
static void
|
||||
set_program_name(const char* argv0)
|
||||
{
|
||||
const std::string program_name = atf::fs::path(argv0).leaf_name();
|
||||
// Libtool workaround: if running from within the source tree (binaries
|
||||
// that are not installed yet), skip the "lt-" prefix added to files in
|
||||
// the ".libs" directory to show the real (not temporary) name.
|
||||
if (program_name.substr(0, 3) == "lt-")
|
||||
Program_Name = program_name.substr(3);
|
||||
else
|
||||
Program_Name = program_name;
|
||||
}
|
||||
|
||||
bool
|
||||
detail::match(const std::string& regexp, const std::string& str)
|
||||
{
|
||||
|
|
@ -129,7 +145,13 @@ detail::match(const std::string& regexp, const std::string& str)
|
|||
static std::map< atf_tc_t*, impl::tc* > wraps;
|
||||
static std::map< const atf_tc_t*, const impl::tc* > cwraps;
|
||||
|
||||
struct impl::tc_impl : atf::noncopyable {
|
||||
struct impl::tc_impl {
|
||||
private:
|
||||
// Non-copyable.
|
||||
tc_impl(const tc_impl&);
|
||||
tc_impl& operator=(const tc_impl&);
|
||||
|
||||
public:
|
||||
std::string m_ident;
|
||||
atf_tc_t m_tc;
|
||||
bool m_has_cleanup;
|
||||
|
|
@ -154,14 +176,7 @@ struct impl::tc_impl : atf::noncopyable {
|
|||
std::map< const atf_tc_t*, const impl::tc* >::const_iterator iter =
|
||||
cwraps.find(tc);
|
||||
INV(iter != cwraps.end());
|
||||
try {
|
||||
(*iter).second->body();
|
||||
} catch (const std::exception& e) {
|
||||
(*iter).second->fail("Caught unhandled exception: " + std::string(
|
||||
e.what()));
|
||||
} catch (...) {
|
||||
(*iter).second->fail("Caught unknown exception");
|
||||
}
|
||||
(*iter).second->body();
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -385,197 +400,70 @@ impl::tc::expect_timeout(const std::string& reason)
|
|||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// The "tp" class.
|
||||
// Test program main code.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
class tp : public atf::application::app {
|
||||
public:
|
||||
typedef std::vector< impl::tc * > tc_vector;
|
||||
namespace {
|
||||
|
||||
private:
|
||||
static const char* m_description;
|
||||
typedef std::vector< impl::tc * > tc_vector;
|
||||
|
||||
bool m_lflag;
|
||||
atf::fs::path m_resfile;
|
||||
std::string m_srcdir_arg;
|
||||
atf::fs::path m_srcdir;
|
||||
enum tc_part { BODY, CLEANUP };
|
||||
|
||||
atf::tests::vars_map m_vars;
|
||||
|
||||
std::string specific_args(void) const;
|
||||
options_set specific_options(void) const;
|
||||
void process_option(int, const char*);
|
||||
|
||||
void (*m_add_tcs)(tc_vector&);
|
||||
tc_vector m_tcs;
|
||||
|
||||
void parse_vflag(const std::string&);
|
||||
void handle_srcdir(void);
|
||||
|
||||
tc_vector init_tcs(void);
|
||||
|
||||
enum tc_part {
|
||||
BODY,
|
||||
CLEANUP,
|
||||
};
|
||||
|
||||
void list_tcs(void);
|
||||
impl::tc* find_tc(tc_vector, const std::string&);
|
||||
static std::pair< std::string, tc_part > process_tcarg(const std::string&);
|
||||
int run_tc(const std::string&);
|
||||
|
||||
public:
|
||||
tp(void (*)(tc_vector&));
|
||||
~tp(void);
|
||||
|
||||
int main(void);
|
||||
};
|
||||
|
||||
const char* tp::m_description =
|
||||
"This is an independent atf test program.";
|
||||
|
||||
tp::tp(void (*add_tcs)(tc_vector&)) :
|
||||
app(m_description, "atf-test-program(1)", "atf(7)", false),
|
||||
m_lflag(false),
|
||||
m_resfile("/dev/stdout"),
|
||||
m_srcdir("."),
|
||||
m_add_tcs(add_tcs)
|
||||
{
|
||||
}
|
||||
|
||||
tp::~tp(void)
|
||||
{
|
||||
for (tc_vector::iterator iter = m_tcs.begin();
|
||||
iter != m_tcs.end(); iter++) {
|
||||
impl::tc* tc = *iter;
|
||||
|
||||
delete tc;
|
||||
}
|
||||
}
|
||||
|
||||
std::string
|
||||
tp::specific_args(void)
|
||||
const
|
||||
{
|
||||
return "test_case";
|
||||
}
|
||||
|
||||
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', "resfile", "The file to which the test program "
|
||||
"will write the results of the "
|
||||
"executed test case"));
|
||||
opts.insert(option('s', "srcdir", "Directory where the test's data "
|
||||
"files are located"));
|
||||
opts.insert(option('v', "var=value", "Sets the configuration variable "
|
||||
"`var' to `value'"));
|
||||
return opts;
|
||||
}
|
||||
|
||||
void
|
||||
tp::process_option(int ch, const char* arg)
|
||||
{
|
||||
switch (ch) {
|
||||
case 'l':
|
||||
m_lflag = true;
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
m_resfile = atf::fs::path(arg);
|
||||
break;
|
||||
|
||||
case 's':
|
||||
m_srcdir_arg = arg;
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
parse_vflag(arg);
|
||||
break;
|
||||
|
||||
default:
|
||||
UNREACHABLE;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
tp::parse_vflag(const std::string& str)
|
||||
static void
|
||||
parse_vflag(const std::string& str, atf::tests::vars_map& vars)
|
||||
{
|
||||
if (str.empty())
|
||||
throw std::runtime_error("-v requires a non-empty argument");
|
||||
|
||||
std::vector< std::string > ws = atf::text::split(str, "=");
|
||||
if (ws.size() == 1 && str[str.length() - 1] == '=') {
|
||||
m_vars[ws[0]] = "";
|
||||
vars[ws[0]] = "";
|
||||
} else {
|
||||
if (ws.size() != 2)
|
||||
throw std::runtime_error("-v requires an argument of the form "
|
||||
"var=value");
|
||||
|
||||
m_vars[ws[0]] = ws[1];
|
||||
vars[ws[0]] = ws[1];
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
tp::handle_srcdir(void)
|
||||
static atf::fs::path
|
||||
handle_srcdir(const char* argv0, const std::string& srcdir_arg)
|
||||
{
|
||||
if (m_srcdir_arg.empty()) {
|
||||
m_srcdir = atf::fs::path(m_argv0).branch_path();
|
||||
if (m_srcdir.leaf_name() == ".libs")
|
||||
m_srcdir = m_srcdir.branch_path();
|
||||
atf::fs::path srcdir(".");
|
||||
|
||||
if (srcdir_arg.empty()) {
|
||||
srcdir = atf::fs::path(argv0).branch_path();
|
||||
if (srcdir.leaf_name() == ".libs")
|
||||
srcdir = srcdir.branch_path();
|
||||
} else
|
||||
m_srcdir = atf::fs::path(m_srcdir_arg);
|
||||
srcdir = atf::fs::path(srcdir_arg);
|
||||
|
||||
if (!atf::fs::exists(m_srcdir / m_prog_name))
|
||||
throw std::runtime_error("Cannot find the test program in the "
|
||||
"source directory `" + m_srcdir.str() + "'");
|
||||
if (!atf::fs::exists(srcdir / Program_Name))
|
||||
throw usage_error("Cannot find the test program in the source "
|
||||
"directory `%s'", srcdir.c_str());
|
||||
|
||||
if (!m_srcdir.is_absolute())
|
||||
m_srcdir = m_srcdir.to_absolute();
|
||||
if (!srcdir.is_absolute())
|
||||
srcdir = srcdir.to_absolute();
|
||||
|
||||
m_vars["srcdir"] = m_srcdir.str();
|
||||
return srcdir;
|
||||
}
|
||||
|
||||
tp::tc_vector
|
||||
tp::init_tcs(void)
|
||||
static void
|
||||
init_tcs(void (*add_tcs)(tc_vector&), tc_vector& tcs,
|
||||
const atf::tests::vars_map& vars)
|
||||
{
|
||||
m_add_tcs(m_tcs);
|
||||
for (tc_vector::iterator iter = m_tcs.begin();
|
||||
iter != m_tcs.end(); iter++) {
|
||||
add_tcs(tcs);
|
||||
for (tc_vector::iterator iter = tcs.begin(); iter != tcs.end(); iter++) {
|
||||
impl::tc* tc = *iter;
|
||||
|
||||
tc->init(m_vars);
|
||||
tc->init(vars);
|
||||
}
|
||||
return m_tcs;
|
||||
}
|
||||
|
||||
//
|
||||
// An auxiliary unary predicate that compares the given test case's
|
||||
// identifier to the identifier stored in it.
|
||||
//
|
||||
class tc_equal_to_ident {
|
||||
const std::string& m_ident;
|
||||
|
||||
public:
|
||||
tc_equal_to_ident(const std::string& i) :
|
||||
m_ident(i)
|
||||
{
|
||||
}
|
||||
|
||||
bool operator()(const impl::tc* tc)
|
||||
{
|
||||
return tc->get_md_var("ident") == m_ident;
|
||||
}
|
||||
};
|
||||
|
||||
void
|
||||
tp::list_tcs(void)
|
||||
static int
|
||||
list_tcs(const tc_vector& tcs)
|
||||
{
|
||||
tc_vector tcs = init_tcs();
|
||||
detail::atf_tp_writer writer(std::cout);
|
||||
|
||||
for (tc_vector::const_iterator iter = tcs.begin();
|
||||
|
|
@ -597,10 +485,12 @@ tp::list_tcs(void)
|
|||
|
||||
writer.end_tc();
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
impl::tc*
|
||||
tp::find_tc(tc_vector tcs, const std::string& name)
|
||||
static impl::tc*
|
||||
find_tc(tc_vector tcs, const std::string& name)
|
||||
{
|
||||
std::vector< std::string > ids;
|
||||
for (tc_vector::iterator iter = tcs.begin();
|
||||
|
|
@ -610,12 +500,11 @@ tp::find_tc(tc_vector tcs, const std::string& name)
|
|||
if (tc->get_md_var("ident") == name)
|
||||
return tc;
|
||||
}
|
||||
throw atf::application::usage_error("Unknown test case `%s'",
|
||||
name.c_str());
|
||||
throw usage_error("Unknown test case `%s'", name.c_str());
|
||||
}
|
||||
|
||||
std::pair< std::string, tp::tc_part >
|
||||
tp::process_tcarg(const std::string& tcarg)
|
||||
static std::pair< std::string, tc_part >
|
||||
process_tcarg(const std::string& tcarg)
|
||||
{
|
||||
const std::string::size_type pos = tcarg.find(':');
|
||||
if (pos == std::string::npos) {
|
||||
|
|
@ -629,83 +518,141 @@ tp::process_tcarg(const std::string& tcarg)
|
|||
else if (partname == "cleanup")
|
||||
return std::make_pair(tcname, CLEANUP);
|
||||
else {
|
||||
using atf::application::usage_error;
|
||||
throw usage_error("Invalid test case part `%s'", partname.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
tp::run_tc(const std::string& tcarg)
|
||||
static int
|
||||
run_tc(tc_vector& tcs, const std::string& tcarg, const atf::fs::path& resfile)
|
||||
{
|
||||
const std::pair< std::string, tc_part > fields = process_tcarg(tcarg);
|
||||
|
||||
impl::tc* tc = find_tc(init_tcs(), fields.first);
|
||||
impl::tc* tc = find_tc(tcs, fields.first);
|
||||
|
||||
if (!atf::env::has("__RUNNING_INSIDE_ATF_RUN") || atf::env::get(
|
||||
"__RUNNING_INSIDE_ATF_RUN") != "internal-yes-value")
|
||||
{
|
||||
std::cerr << m_prog_name << ": WARNING: Running test cases without "
|
||||
"atf-run(1) is unsupported\n";
|
||||
std::cerr << m_prog_name << ": WARNING: No isolation nor timeout "
|
||||
std::cerr << Program_Name << ": WARNING: Running test cases outside "
|
||||
"of kyua(1) is unsupported\n";
|
||||
std::cerr << Program_Name << ": WARNING: No isolation nor timeout "
|
||||
"control is being applied; you may get unexpected failures; see "
|
||||
"atf-test-case(4)\n";
|
||||
}
|
||||
|
||||
try {
|
||||
switch (fields.second) {
|
||||
case BODY:
|
||||
tc->run(m_resfile.str());
|
||||
break;
|
||||
case CLEANUP:
|
||||
tc->run_cleanup();
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE;
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
} catch (const std::runtime_error& e) {
|
||||
std::cerr << "ERROR: " << e.what() << "\n";
|
||||
return EXIT_FAILURE;
|
||||
switch (fields.second) {
|
||||
case BODY:
|
||||
tc->run(resfile.str());
|
||||
break;
|
||||
case CLEANUP:
|
||||
tc->run_cleanup();
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE;
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
int
|
||||
tp::main(void)
|
||||
static int
|
||||
safe_main(int argc, char** argv, void (*add_tcs)(tc_vector&))
|
||||
{
|
||||
using atf::application::usage_error;
|
||||
const char* argv0 = argv[0];
|
||||
|
||||
bool lflag = false;
|
||||
atf::fs::path resfile("/dev/stdout");
|
||||
std::string srcdir_arg;
|
||||
atf::tests::vars_map vars;
|
||||
|
||||
int ch;
|
||||
int old_opterr;
|
||||
|
||||
old_opterr = opterr;
|
||||
::opterr = 0;
|
||||
while ((ch = ::getopt(argc, argv, GETOPT_POSIX ":lr:s:v:")) != -1) {
|
||||
switch (ch) {
|
||||
case 'l':
|
||||
lflag = true;
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
resfile = atf::fs::path(::optarg);
|
||||
break;
|
||||
|
||||
case 's':
|
||||
srcdir_arg = ::optarg;
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
parse_vflag(::optarg, vars);
|
||||
break;
|
||||
|
||||
case ':':
|
||||
throw usage_error("Option -%c requires an argument.", ::optopt);
|
||||
break;
|
||||
|
||||
case '?':
|
||||
default:
|
||||
throw usage_error("Unknown option -%c.", ::optopt);
|
||||
}
|
||||
}
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
// Clear getopt state just in case the test wants to use it.
|
||||
::opterr = old_opterr;
|
||||
::optind = 1;
|
||||
#if defined(HAVE_OPTRESET)
|
||||
::optreset = 1;
|
||||
#endif
|
||||
|
||||
vars["srcdir"] = handle_srcdir(argv0, srcdir_arg).str();
|
||||
|
||||
int errcode;
|
||||
|
||||
handle_srcdir();
|
||||
|
||||
if (m_lflag) {
|
||||
if (m_argc > 0)
|
||||
tc_vector tcs;
|
||||
if (lflag) {
|
||||
if (argc > 0)
|
||||
throw usage_error("Cannot provide test case names with -l");
|
||||
|
||||
list_tcs();
|
||||
errcode = EXIT_SUCCESS;
|
||||
init_tcs(add_tcs, tcs, vars);
|
||||
errcode = list_tcs(tcs);
|
||||
} else {
|
||||
if (m_argc == 0)
|
||||
if (argc == 0)
|
||||
throw usage_error("Must provide a test case name");
|
||||
else if (m_argc > 1)
|
||||
else if (argc > 1)
|
||||
throw usage_error("Cannot provide more than one test case name");
|
||||
INV(m_argc == 1);
|
||||
INV(argc == 1);
|
||||
|
||||
errcode = run_tc(m_argv[0]);
|
||||
init_tcs(add_tcs, tcs, vars);
|
||||
errcode = run_tc(tcs, argv[0], resfile);
|
||||
}
|
||||
for (tc_vector::iterator iter = tcs.begin(); iter != tcs.end(); iter++) {
|
||||
impl::tc* tc = *iter;
|
||||
|
||||
delete tc;
|
||||
}
|
||||
|
||||
return errcode;
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
namespace atf {
|
||||
namespace tests {
|
||||
int run_tp(int, char* const*, void (*)(tp::tc_vector&));
|
||||
int run_tp(int, char**, void (*)(tc_vector&));
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
impl::run_tp(int argc, char* const* argv, void (*add_tcs)(tp::tc_vector&))
|
||||
impl::run_tp(int argc, char** argv, void (*add_tcs)(tc_vector&))
|
||||
{
|
||||
return tp(add_tcs).run(argc, argv);
|
||||
try {
|
||||
set_program_name(argv[0]);
|
||||
return ::safe_main(argc, argv, add_tcs);
|
||||
} catch (const usage_error& e) {
|
||||
std::cerr
|
||||
<< Program_Name << ": ERROR: " << e.what() << '\n'
|
||||
<< Program_Name << ": See atf-test-program(1) for usage details.\n";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,10 +22,9 @@
|
|||
// 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_CXX_TESTS_HPP_)
|
||||
#define _ATF_CXX_TESTS_HPP_
|
||||
#if !defined(ATF_CXX_TESTS_HPP)
|
||||
#define ATF_CXX_TESTS_HPP
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
|
|
@ -38,8 +34,6 @@ extern "C" {
|
|||
#include <atf-c/defs.h>
|
||||
}
|
||||
|
||||
#include <atf-c++/noncopyable.hpp>
|
||||
|
||||
namespace atf {
|
||||
namespace tests {
|
||||
|
||||
|
|
@ -74,7 +68,11 @@ typedef std::map< std::string, std::string > vars_map;
|
|||
|
||||
struct tc_impl;
|
||||
|
||||
class tc : noncopyable {
|
||||
class tc {
|
||||
// Non-copyable.
|
||||
tc(const tc&);
|
||||
tc& operator=(const tc&);
|
||||
|
||||
std::auto_ptr< tc_impl > pimpl;
|
||||
|
||||
protected:
|
||||
|
|
@ -124,4 +122,4 @@ public:
|
|||
} // namespace tests
|
||||
} // namespace atf
|
||||
|
||||
#endif // !defined(_ATF_CXX_TESTS_HPP_)
|
||||
#endif // !defined(ATF_CXX_TESTS_HPP)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,7 +22,8 @@
|
|||
// 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 "atf-c++/tests.hpp"
|
||||
|
||||
extern "C" {
|
||||
#include <sys/types.h>
|
||||
|
|
@ -36,12 +34,12 @@ extern "C" {
|
|||
}
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#include "macros.hpp"
|
||||
#include <atf-c++.hpp>
|
||||
|
||||
#include "detail/parser.hpp"
|
||||
#include "detail/test_helpers.hpp"
|
||||
#include "atf-c++/detail/text.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Tests for the "atf_tp_writer" class.
|
||||
|
|
@ -181,12 +179,6 @@ ATF_TEST_CASE_BODY(atf_tp_writer)
|
|||
#undef RESET
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Tests cases for the header file.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
HEADER_TC(include, "atf-c++/tests.hpp");
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Main.
|
||||
// ------------------------------------------------------------------------
|
||||
|
|
@ -195,7 +187,4 @@ ATF_INIT_TEST_CASES(tcs)
|
|||
{
|
||||
// Add tests for the "atf_tp_writer" class.
|
||||
ATF_ADD_TEST_CASE(tcs, atf_tp_writer);
|
||||
|
||||
// Add the test cases for the header file.
|
||||
ATF_ADD_TEST_CASE(tcs, include);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2012 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,9 +22,8 @@
|
|||
// 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 <atf-c++/macros.hpp>
|
||||
#include <atf-c++.hpp>
|
||||
|
||||
ATF_TEST_CASE(this_is_used);
|
||||
ATF_TEST_CASE_HEAD(this_is_used)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,7 +22,8 @@
|
|||
// 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 "atf-c++/utils.hpp"
|
||||
|
||||
extern "C" {
|
||||
#include "atf-c/utils.h"
|
||||
|
|
@ -34,8 +32,6 @@ extern "C" {
|
|||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
|
||||
#include "utils.hpp"
|
||||
|
||||
void
|
||||
atf::utils::cat_file(const std::string& path, const std::string& prefix)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,10 +22,9 @@
|
|||
// 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_CXX_UTILS_HPP_)
|
||||
#define _ATF_CXX_UTILS_HPP_
|
||||
#if !defined(ATF_CXX_UTILS_HPP)
|
||||
#define ATF_CXX_UTILS_HPP
|
||||
|
||||
extern "C" {
|
||||
#include <unistd.h>
|
||||
|
|
@ -65,4 +61,4 @@ grep_collection(const std::string& regexp, const Collection& collection)
|
|||
} // namespace utils
|
||||
} // namespace atf
|
||||
|
||||
#endif // !defined(_ATF_CXX_UTILS_HPP_)
|
||||
#endif // !defined(ATF_CXX_UTILS_HPP)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
//
|
||||
// Automated Testing Framework (atf)
|
||||
//
|
||||
// Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -25,7 +22,8 @@
|
|||
// 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 "atf-c++/utils.hpp"
|
||||
|
||||
extern "C" {
|
||||
#include <sys/stat.h>
|
||||
|
|
@ -38,22 +36,20 @@ extern "C" {
|
|||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "macros.hpp"
|
||||
#include "utils.hpp"
|
||||
|
||||
#include "detail/test_helpers.hpp"
|
||||
#include <atf-c++.hpp>
|
||||
|
||||
static std::string
|
||||
read_file(const char *path)
|
||||
read_file(const std::string& path)
|
||||
{
|
||||
char buffer[1024];
|
||||
|
||||
const int fd = open(path, O_RDONLY);
|
||||
const int fd = open(path.c_str(), O_RDONLY);
|
||||
if (fd == -1)
|
||||
ATF_FAIL("Cannot open " + std::string(path));
|
||||
ATF_FAIL("Cannot open " + path);
|
||||
const ssize_t length = read(fd, buffer, sizeof(buffer) - 1);
|
||||
close(fd);
|
||||
ATF_REQUIRE(length != -1);
|
||||
|
|
@ -238,8 +234,13 @@ ATF_TEST_CASE_BODY(fork)
|
|||
ATF_REQUIRE(WIFEXITED(status));
|
||||
ATF_REQUIRE_EQ(EXIT_SUCCESS, WEXITSTATUS(status));
|
||||
|
||||
ATF_REQUIRE_EQ("Child stdout\n", read_file("atf_utils_fork_out.txt"));
|
||||
ATF_REQUIRE_EQ("Child stderr\n", read_file("atf_utils_fork_err.txt"));
|
||||
std::ostringstream out_name;
|
||||
out_name << "atf_utils_fork_" << pid << "_out.txt";
|
||||
std::ostringstream err_name;
|
||||
err_name << "atf_utils_fork_" << pid << "_err.txt";
|
||||
|
||||
ATF_REQUIRE_EQ("Child stdout\n", read_file(out_name.str()));
|
||||
ATF_REQUIRE_EQ("Child stderr\n", read_file(err_name.str()));
|
||||
}
|
||||
|
||||
ATF_TEST_CASE_WITHOUT_HEAD(grep_collection__set);
|
||||
|
|
@ -353,6 +354,35 @@ ATF_TEST_CASE_BODY(wait__ok)
|
|||
}
|
||||
}
|
||||
|
||||
ATF_TEST_CASE_WITHOUT_HEAD(wait__ok_nested);
|
||||
ATF_TEST_CASE_BODY(wait__ok_nested)
|
||||
{
|
||||
const pid_t parent = atf::utils::fork();
|
||||
ATF_REQUIRE(parent != -1);
|
||||
if (parent == 0) {
|
||||
const pid_t child = atf::utils::fork();
|
||||
ATF_REQUIRE(child != -1);
|
||||
if (child == 0) {
|
||||
std::cerr.flush();
|
||||
std::cout << "Child output\n";
|
||||
std::cout.flush();
|
||||
std::cerr << "Child error\n";
|
||||
std::exit(50);
|
||||
} else {
|
||||
std::cout << "Parent output\n";
|
||||
std::cerr << "Parent error\n";
|
||||
atf::utils::wait(child, 50, "Child output\n", "Child error\n");
|
||||
std::exit(40);
|
||||
}
|
||||
} else {
|
||||
atf::utils::wait(parent, 40,
|
||||
"Parent output\n"
|
||||
"subprocess stdout: Child output\n"
|
||||
"subprocess stderr: Child error\n",
|
||||
"Parent error\n");
|
||||
}
|
||||
}
|
||||
|
||||
ATF_TEST_CASE_WITHOUT_HEAD(wait__invalid_exitstatus);
|
||||
ATF_TEST_CASE_BODY(wait__invalid_exitstatus)
|
||||
{
|
||||
|
|
@ -432,12 +462,6 @@ ATF_TEST_CASE_BODY(wait__save_stderr)
|
|||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Tests cases for the header file.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
HEADER_TC(include, "atf-c++/utils.hpp");
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Main.
|
||||
// ------------------------------------------------------------------------
|
||||
|
|
@ -476,12 +500,10 @@ ATF_INIT_TEST_CASES(tcs)
|
|||
ATF_ADD_TEST_CASE(tcs, redirect__other);
|
||||
|
||||
ATF_ADD_TEST_CASE(tcs, wait__ok);
|
||||
ATF_ADD_TEST_CASE(tcs, wait__ok_nested);
|
||||
ATF_ADD_TEST_CASE(tcs, wait__invalid_exitstatus);
|
||||
ATF_ADD_TEST_CASE(tcs, wait__invalid_stdout);
|
||||
ATF_ADD_TEST_CASE(tcs, wait__invalid_stderr);
|
||||
ATF_ADD_TEST_CASE(tcs, wait__save_stdout);
|
||||
ATF_ADD_TEST_CASE(tcs, wait__save_stderr);
|
||||
|
||||
// Add the test cases for the header file.
|
||||
ATF_ADD_TEST_CASE(tcs, include);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
/*
|
||||
* Automated Testing Framework (atf)
|
||||
*
|
||||
* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
/* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -24,8 +21,7 @@
|
|||
* 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 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
|
||||
|
||||
#if !defined(ATF_C_H)
|
||||
#define ATF_C_H
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ tp: detail
|
|||
tp: atf_c_test
|
||||
tp: build_test
|
||||
tp: check_test
|
||||
tp: config_test
|
||||
tp: error_test
|
||||
tp: macros_test
|
||||
tp: pkg_config_test
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ test_suite("atf")
|
|||
atf_test_program{name="atf_c_test"}
|
||||
atf_test_program{name="build_test"}
|
||||
atf_test_program{name="check_test"}
|
||||
atf_test_program{name="config_test"}
|
||||
atf_test_program{name="error_test"}
|
||||
atf_test_program{name="macros_test"}
|
||||
atf_test_program{name="pkg_config_test"}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
#
|
||||
# Automated Testing Framework (atf)
|
||||
#
|
||||
# Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
|
|
@ -25,15 +22,12 @@
|
|||
# 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.
|
||||
#
|
||||
|
||||
lib_LTLIBRARIES += libatf-c.la
|
||||
libatf_c_la_SOURCES = atf-c/build.c \
|
||||
atf-c/build.h \
|
||||
atf-c/check.c \
|
||||
atf-c/check.h \
|
||||
atf-c/config.c \
|
||||
atf-c/config.h \
|
||||
atf-c/error.c \
|
||||
atf-c/error.h \
|
||||
atf-c/error_fwd.h \
|
||||
|
|
@ -45,45 +39,44 @@ libatf_c_la_SOURCES = atf-c/build.c \
|
|||
atf-c/utils.c \
|
||||
atf-c/utils.h
|
||||
nodist_libatf_c_la_SOURCES = atf-c/defs.h
|
||||
libatf_c_la_CPPFLAGS = "-DATF_ARCH=\"$(atf_arch)\"" \
|
||||
"-DATF_BUILD_CC=\"$(ATF_BUILD_CC)\"" \
|
||||
#libatf_c_la_CPPFLAGS = "-DATF_BUILD_CC=\"$(ATF_BUILD_CC)\"" \
|
||||
# "-DATF_BUILD_CFLAGS=\"$(ATF_BUILD_CFLAGS)\"" \
|
||||
# "-DATF_BUILD_CPP=\"$(ATF_BUILD_CPP)\"" \
|
||||
# "-DATF_BUILD_CPPFLAGS=\"$(ATF_BUILD_CPPFLAGS)\"" \
|
||||
# "-DATF_BUILD_CXX=\"$(ATF_BUILD_CXX)\"" \
|
||||
# "-DATF_BUILD_CXXFLAGS=\"$(ATF_BUILD_CXXFLAGS)\"" \
|
||||
# "-DATF_INCLUDEDIR=\"$(includedir)\"" \
|
||||
# "-DATF_LIBEXECDIR=\"$(libexecdir)\"" \
|
||||
# "-DATF_PKGDATADIR=\"$(pkgdatadir)\"" \
|
||||
# "-DATF_SHELL=\"$(ATF_SHELL)\"" \
|
||||
# "-DATF_WORKDIR=\"$(ATF_WORKDIR)\""
|
||||
libatf_c_la_CPPFLAGS = "-DATF_BUILD_CC=\"$(ATF_BUILD_CC)\"" \
|
||||
"-DATF_BUILD_CFLAGS=\"$(ATF_BUILD_CFLAGS)\"" \
|
||||
"-DATF_BUILD_CPP=\"$(ATF_BUILD_CPP)\"" \
|
||||
"-DATF_BUILD_CPPFLAGS=\"$(ATF_BUILD_CPPFLAGS)\"" \
|
||||
"-DATF_BUILD_CXX=\"$(ATF_BUILD_CXX)\"" \
|
||||
"-DATF_BUILD_CXXFLAGS=\"$(ATF_BUILD_CXXFLAGS)\"" \
|
||||
"-DATF_CONFDIR=\"$(atf_confdir)\"" \
|
||||
"-DATF_INCLUDEDIR=\"$(includedir)\"" \
|
||||
"-DATF_LIBDIR=\"$(libdir)\"" \
|
||||
"-DATF_LIBEXECDIR=\"$(libexecdir)\"" \
|
||||
"-DATF_MACHINE=\"$(atf_machine)\"" \
|
||||
"-DATF_M4=\"$(ATF_M4)\"" \
|
||||
"-DATF_PKGDATADIR=\"$(pkgdatadir)\"" \
|
||||
"-DATF_SHELL=\"$(ATF_SHELL)\"" \
|
||||
"-DATF_WORKDIR=\"$(ATF_WORKDIR)\"" \
|
||||
-I$(srcdir)/atf-c
|
||||
libatf_c_la_LDFLAGS = -version-info 0:0:0
|
||||
"-DATF_BUILD_CXXFLAGS=\"$(ATF_BUILD_CXXFLAGS)\""
|
||||
libatf_c_la_LDFLAGS = -version-info 1:0:0
|
||||
|
||||
# XXX For some reason, the nodist line above does not work as expected.
|
||||
# Work this problem around.
|
||||
dist-hook: kill-defs-h
|
||||
DIST_HOOKS += kill-defs-h
|
||||
kill-defs-h:
|
||||
rm -f $(distdir)/atf-c/defs.h
|
||||
|
||||
include_HEADERS += atf-c.h
|
||||
atf_c_HEADERS = atf-c/build.h \
|
||||
atf-c/check.h \
|
||||
atf-c/config.h \
|
||||
atf-c/defs.h \
|
||||
atf-c/error.h \
|
||||
atf-c/error_fwd.h \
|
||||
atf-c/macros.h \
|
||||
atf-c/tc.h \
|
||||
atf-c/tp.h \
|
||||
atf-c/utils.h
|
||||
nodist_atf_c_HEADERS = atf-c/defs.h
|
||||
atf_cdir = $(includedir)/atf-c
|
||||
|
||||
dist_man_MANS += atf-c/atf-c-api.3
|
||||
dist_man_MANS += atf-c/atf-c.3
|
||||
|
||||
atf_aclocal_DATA += atf-c/atf-common.m4 atf-c/atf-c.m4
|
||||
EXTRA_DIST += atf-c/atf-common.m4 atf-c/atf-c.m4
|
||||
|
|
@ -93,12 +86,12 @@ atf_cpkgconfig_DATA = atf-c/atf-c.pc
|
|||
CLEANFILES += atf-c/atf-c.pc
|
||||
EXTRA_DIST += atf-c/atf-c.pc.in
|
||||
atf-c/atf-c.pc: $(srcdir)/atf-c/atf-c.pc.in Makefile
|
||||
test -d atf-c || mkdir -p atf-c
|
||||
$(AM_V_GEN)test -d atf-c || mkdir -p atf-c; \
|
||||
sed -e 's#__ATF_VERSION__#$(PACKAGE_VERSION)#g' \
|
||||
-e 's#__CC__#$(CC)#g' \
|
||||
-e 's#__INCLUDEDIR__#$(includedir)#g' \
|
||||
-e 's#__LIBDIR__#$(libdir)#g' \
|
||||
<$(srcdir)/atf-c/atf-c.pc.in >atf-c/atf-c.pc.tmp
|
||||
<$(srcdir)/atf-c/atf-c.pc.in >atf-c/atf-c.pc.tmp; \
|
||||
mv atf-c/atf-c.pc.tmp atf-c/atf-c.pc
|
||||
|
||||
tests_atf_c_DATA = atf-c/Atffile \
|
||||
|
|
@ -120,10 +113,6 @@ tests_atf_c_PROGRAMS += atf-c/check_test
|
|||
atf_c_check_test_SOURCES = atf-c/check_test.c
|
||||
atf_c_check_test_LDADD = atf-c/detail/libtest_helpers.la libatf-c.la
|
||||
|
||||
tests_atf_c_PROGRAMS += atf-c/config_test
|
||||
atf_c_config_test_SOURCES = atf-c/config_test.c
|
||||
atf_c_config_test_LDADD = atf-c/detail/libtest_helpers.la libatf-c.la
|
||||
|
||||
tests_atf_c_PROGRAMS += atf-c/error_test
|
||||
atf_c_error_test_SOURCES = atf-c/error_test.c
|
||||
atf_c_error_test_LDADD = atf-c/detail/libtest_helpers.la libatf-c.la
|
||||
|
|
@ -136,8 +125,7 @@ tests_atf_c_SCRIPTS = atf-c/pkg_config_test
|
|||
CLEANFILES += atf-c/pkg_config_test
|
||||
EXTRA_DIST += atf-c/pkg_config_test.sh
|
||||
atf-c/pkg_config_test: $(srcdir)/atf-c/pkg_config_test.sh
|
||||
test -d atf-c || mkdir -p atf-c
|
||||
@src="$(srcdir)/atf-c/pkg_config_test.sh"; \
|
||||
$(AM_V_GEN)src="$(srcdir)/atf-c/pkg_config_test.sh"; \
|
||||
dst="atf-c/pkg_config_test"; $(BUILD_SH_TP)
|
||||
|
||||
tests_atf_c_PROGRAMS += atf-c/tc_test
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
.\"
|
||||
.\" Automated Testing Framework (atf)
|
||||
.\"
|
||||
.\" Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
|
|
@ -25,12 +22,11 @@
|
|||
.\" 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 November 30, 2012
|
||||
.Dt ATF-C-API 3
|
||||
.Dd October 13, 2014
|
||||
.Dt ATF-C 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm atf-c-api ,
|
||||
.Nm atf-c ,
|
||||
.Nm ATF_CHECK ,
|
||||
.Nm ATF_CHECK_MSG ,
|
||||
.Nm ATF_CHECK_EQ ,
|
||||
|
|
@ -93,24 +89,26 @@
|
|||
.Nd C API to write ATF-based test programs
|
||||
.Sh SYNOPSIS
|
||||
.In atf-c.h
|
||||
.\" NO_CHECK_STYLE_BEGIN
|
||||
.Fn ATF_CHECK "expression"
|
||||
.Fn ATF_CHECK_MSG "expression" "fail_msg_fmt" ...
|
||||
.Fn ATF_CHECK_EQ "expression_1" "expression_2"
|
||||
.Fn ATF_CHECK_EQ_MSG "expression_1" "expression_2" "fail_msg_fmt" ...
|
||||
.Fn ATF_CHECK_EQ "expected_expression" "actual_expression"
|
||||
.Fn ATF_CHECK_EQ_MSG "expected_expression" "actual_expression" "fail_msg_fmt" ...
|
||||
.Fn ATF_CHECK_MATCH "regexp" "string"
|
||||
.Fn ATF_CHECK_MATCH_MSG "regexp" "string" "fail_msg_fmt" ...
|
||||
.Fn ATF_CHECK_STREQ "string_1" "string_2"
|
||||
.Fn ATF_CHECK_STREQ_MSG "string_1" "string_2" "fail_msg_fmt" ...
|
||||
.Fn ATF_CHECK_ERRNO "exp_errno" "bool_expression"
|
||||
.Fn ATF_CHECK_ERRNO "expected_errno" "bool_expression"
|
||||
.Fn ATF_REQUIRE "expression"
|
||||
.Fn ATF_REQUIRE_MSG "expression" "fail_msg_fmt" ...
|
||||
.Fn ATF_REQUIRE_EQ "expression_1" "expression_2"
|
||||
.Fn ATF_REQUIRE_EQ_MSG "expression_1" "expression_2" "fail_msg_fmt" ...
|
||||
.Fn ATF_REQUIRE_EQ "expected_expression" "actual_expression"
|
||||
.Fn ATF_REQUIRE_EQ_MSG "expected_expression" "actual_expression" "fail_msg_fmt" ...
|
||||
.Fn ATF_REQUIRE_MATCH "regexp" "string"
|
||||
.Fn ATF_REQUIRE_MATCH_MSG "regexp" "string" "fail_msg_fmt" ...
|
||||
.Fn ATF_REQUIRE_STREQ "string_1" "string_2"
|
||||
.Fn ATF_REQUIRE_STREQ_MSG "string_1" "string_2" "fail_msg_fmt" ...
|
||||
.Fn ATF_REQUIRE_ERRNO "exp_errno" "bool_expression"
|
||||
.Fn ATF_REQUIRE_STREQ "expected_string" "actual_string"
|
||||
.Fn ATF_REQUIRE_STREQ_MSG "expected_string" "actual_string" "fail_msg_fmt" ...
|
||||
.Fn ATF_REQUIRE_ERRNO "expected_errno" "bool_expression"
|
||||
.\" NO_CHECK_STYLE_END
|
||||
.Fn ATF_TC "name"
|
||||
.Fn ATF_TC_BODY "name" "tc"
|
||||
.Fn ATF_TC_BODY_NAME "name"
|
||||
|
|
@ -202,9 +200,8 @@
|
|||
.Fa "const char *expected_stderr"
|
||||
.Fc
|
||||
.Sh DESCRIPTION
|
||||
The ATF
|
||||
.Pp
|
||||
C-based test programs always follow this template:
|
||||
ATF provides a C programming interface to implement test programs.
|
||||
C-based test programs follow this template:
|
||||
.Bd -literal -offset indent
|
||||
.Ns ... C-specific includes go here ...
|
||||
|
||||
|
|
@ -410,9 +407,8 @@ If
|
|||
.Va exitcode
|
||||
is not
|
||||
.Sq -1 ,
|
||||
.Xr atf-run 1
|
||||
will validate that the exit code of the test case matches the one provided
|
||||
in this call.
|
||||
the runtime engine will validate that the exit code of the test case
|
||||
matches the one provided in this call.
|
||||
Otherwise, the exact value will be ignored.
|
||||
.It Fn atf_tc_expect_fail "reason" "..."
|
||||
Any failure (be it fatal or non-fatal) raised in this mode is recorded.
|
||||
|
|
@ -444,9 +440,8 @@ If
|
|||
.Va signo
|
||||
is not
|
||||
.Sq -1 ,
|
||||
.Xr atf-run 1
|
||||
will validate that the signal that terminated the test case matches the one
|
||||
provided in this call.
|
||||
the runtime engine will validate that the signal that terminated the test
|
||||
case matches the one provided in this call.
|
||||
Otherwise, the exact value will be ignored.
|
||||
.It Fn atf_tc_expect_timeout "reason" "..."
|
||||
Expects the test case to execute for longer than its timeout.
|
||||
|
|
@ -498,6 +493,8 @@ take an expression and fail if the expression evaluates to false.
|
|||
and
|
||||
.Fn ATF_REQUIRE_EQ_MSG
|
||||
take two expressions and fail if the two evaluated values are not equal.
|
||||
The common style is to put the expected value in the first parameter and the
|
||||
actual value in the second parameter.
|
||||
.Pp
|
||||
.Fn ATF_CHECK_MATCH ,
|
||||
.Fn ATF_CHECK_MATCH_MSG ,
|
||||
|
|
@ -515,6 +512,8 @@ the string.
|
|||
and
|
||||
.Fn ATF_REQUIRE_STREQ_MSG
|
||||
take two strings and fail if the two are not equal character by character.
|
||||
The common style is to put the expected string in the first parameter and the
|
||||
actual string in the second parameter.
|
||||
.Pp
|
||||
.Fn ATF_CHECK_ERRNO
|
||||
and
|
||||
|
|
@ -536,7 +535,7 @@ In particular, these are useful to write tests for command-line interfaces.
|
|||
.Fa "const char *file"
|
||||
.Fa "const char *prefix"
|
||||
.Fc
|
||||
.Bd -offset indent
|
||||
.Bd -ragged -offset indent
|
||||
Prints the contents of
|
||||
.Fa file
|
||||
to the standard output, prefixing every line with the string in
|
||||
|
|
@ -548,7 +547,7 @@ to the standard output, prefixing every line with the string in
|
|||
.Fa "const char *file"
|
||||
.Fa "const char *contents"
|
||||
.Fc
|
||||
.Bd -offset indent
|
||||
.Bd -ragged -offset indent
|
||||
Returns true if the given
|
||||
.Fa file
|
||||
matches exactly the expected inlined
|
||||
|
|
@ -560,7 +559,7 @@ matches exactly the expected inlined
|
|||
.Fa "const char *source"
|
||||
.Fa "const char *destination"
|
||||
.Fc
|
||||
.Bd -offset indent
|
||||
.Bd -ragged -offset indent
|
||||
Copies the file
|
||||
.Fa source
|
||||
to
|
||||
|
|
@ -574,7 +573,7 @@ The permissions of the file are preserved during the code.
|
|||
.Fa "const char *contents"
|
||||
.Fa "..."
|
||||
.Fc
|
||||
.Bd -offset indent
|
||||
.Bd -ragged -offset indent
|
||||
Creates
|
||||
.Fa file
|
||||
with the text given in
|
||||
|
|
@ -586,7 +585,7 @@ which is a formatting string that uses the rest of the variable arguments.
|
|||
.Fo atf_utils_file_exists
|
||||
.Fa "const char *file"
|
||||
.Fc
|
||||
.Bd -offset indent
|
||||
.Bd -ragged -offset indent
|
||||
Checks if
|
||||
.Fa file
|
||||
exists.
|
||||
|
|
@ -596,7 +595,7 @@ exists.
|
|||
.Fo atf_utils_fork
|
||||
.Fa "void"
|
||||
.Fc
|
||||
.Bd -offset indent
|
||||
.Bd -ragged -offset indent
|
||||
Forks a process and redirects the standard output and standard error of the
|
||||
child to files for later validation with
|
||||
.Fn atf_utils_wait .
|
||||
|
|
@ -607,7 +606,7 @@ Fails the test case if the fork fails, so this does not return an error.
|
|||
.Fo atf_utils_free_charpp
|
||||
.Fa "char **argv"
|
||||
.Fc
|
||||
.Bd -offset indent
|
||||
.Bd -ragged -offset indent
|
||||
Frees a dynamically-allocated array of dynamically-allocated strings.
|
||||
.Ed
|
||||
.Pp
|
||||
|
|
@ -617,7 +616,7 @@ Frees a dynamically-allocated array of dynamically-allocated strings.
|
|||
.Fa "const char *file"
|
||||
.Fa "..."
|
||||
.Fc
|
||||
.Bd -offset indent
|
||||
.Bd -ragged -offset indent
|
||||
Searches for the
|
||||
.Fa regexp ,
|
||||
which is a formatting string representing the regular expression,
|
||||
|
|
@ -632,7 +631,7 @@ The variable arguments are used to construct the regular expression.
|
|||
.Fa "const char *str"
|
||||
.Fa "..."
|
||||
.Fc
|
||||
.Bd -offset indent
|
||||
.Bd -ragged -offset indent
|
||||
Searches for the
|
||||
.Fa regexp ,
|
||||
which is a formatting string representing the regular expression,
|
||||
|
|
@ -645,7 +644,7 @@ The variable arguments are used to construct the regular expression.
|
|||
.Fo atf_utils_readline
|
||||
.Fa "int fd"
|
||||
.Fc
|
||||
.Bd -offset indent
|
||||
.Bd -ragged -offset indent
|
||||
Reads a line from the file descriptor
|
||||
.Fa fd .
|
||||
The line, if any, is returned as a dynamically-allocated buffer that must be
|
||||
|
|
@ -660,7 +659,7 @@ If there was nothing to read, returns
|
|||
.Fa "const int fd"
|
||||
.Fa "const char *file"
|
||||
.Fc
|
||||
.Bd -offset indent
|
||||
.Bd -ragged -offset indent
|
||||
Redirects the given file descriptor
|
||||
.Fa fd
|
||||
to
|
||||
|
|
@ -679,7 +678,7 @@ those spawned by
|
|||
.Fa "const char *expected_stdout"
|
||||
.Fa "const char *expected_stderr"
|
||||
.Fc
|
||||
.Bd -offset indent
|
||||
.Bd -ragged -offset indent
|
||||
Waits and validates the result of a subprocess spawned with
|
||||
.Fn atf_utils_wait .
|
||||
The validation involves checking that the subprocess exited cleanly and returned
|
||||
|
|
@ -699,6 +698,25 @@ strings are prefixed with
|
|||
then they specify the name of the file into which to store the stdout or stderr
|
||||
of the subprocess, and no comparison is performed.
|
||||
.Ed
|
||||
.Sh ENVIRONMENT
|
||||
The following variables are recognized by
|
||||
.Nm
|
||||
but should not be overridden other than for testing purposes:
|
||||
.Pp
|
||||
.Bl -tag -width ATFXBUILDXCXXFLAGSXX -compact
|
||||
.It Va ATF_BUILD_CC
|
||||
Path to the C compiler.
|
||||
.It Va ATF_BUILD_CFLAGS
|
||||
C compiler flags.
|
||||
.It Va ATF_BUILD_CPP
|
||||
Path to the C/C++ preprocessor.
|
||||
.It Va ATF_BUILD_CPPFLAGS
|
||||
C/C++ preprocessor flags.
|
||||
.It Va ATF_BUILD_CXX
|
||||
Path to the C++ compiler.
|
||||
.It Va ATF_BUILD_CXXFLAGS
|
||||
C++ compiler flags.
|
||||
.El
|
||||
.Sh EXAMPLES
|
||||
The following shows a complete test program with a single test case that
|
||||
validates the addition operator:
|
||||
|
|
@ -713,13 +731,13 @@ ATF_TC_HEAD(addition, tc)
|
|||
}
|
||||
ATF_TC_BODY(addition, tc)
|
||||
{
|
||||
ATF_CHECK_EQ(0 + 0, 0);
|
||||
ATF_CHECK_EQ(0 + 1, 1);
|
||||
ATF_CHECK_EQ(1 + 0, 1);
|
||||
ATF_CHECK_EQ(0, 0 + 0);
|
||||
ATF_CHECK_EQ(1, 0 + 1);
|
||||
ATF_CHECK_EQ(1, 1 + 0);
|
||||
|
||||
ATF_CHECK_EQ(1 + 1, 2);
|
||||
ATF_CHECK_EQ(2, 1 + 1);
|
||||
|
||||
ATF_CHECK_EQ(100 + 200, 300);
|
||||
ATF_CHECK_EQ(300, 100 + 200);
|
||||
}
|
||||
|
||||
ATF_TC(string_formatting);
|
||||
|
|
@ -772,5 +790,4 @@ ATF_TP_ADD_TCS(tp)
|
|||
.Ed
|
||||
.Sh SEE ALSO
|
||||
.Xr atf-test-program 1 ,
|
||||
.Xr atf-test-case 4 ,
|
||||
.Xr atf 7
|
||||
.Xr atf-test-case 4
|
||||
|
|
@ -1,6 +1,3 @@
|
|||
dnl
|
||||
dnl Automated Testing Framework (atf)
|
||||
dnl
|
||||
dnl Copyright 2011 Google Inc.
|
||||
dnl All rights reserved.
|
||||
dnl
|
||||
|
|
@ -28,7 +25,6 @@ dnl DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|||
dnl THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
dnl (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
dnl OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
dnl
|
||||
|
||||
dnl ATF_CHECK_C([version-spec])
|
||||
dnl
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
dnl
|
||||
dnl Automated Testing Framework (atf)
|
||||
dnl
|
||||
dnl Copyright 2011 Google Inc.
|
||||
dnl All rights reserved.
|
||||
dnl
|
||||
|
|
@ -28,7 +25,6 @@ dnl DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|||
dnl THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
dnl (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
dnl OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
dnl
|
||||
|
||||
dnl ATF_ARG_WITH
|
||||
dnl
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
/*
|
||||
* Automated Testing Framework (atf)
|
||||
*
|
||||
* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
/* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -24,12 +21,11 @@
|
|||
* 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 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
|
||||
|
||||
#include <atf-c.h>
|
||||
|
||||
#include "detail/test_helpers.h"
|
||||
#include "atf-c/detail/test_helpers.h"
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* Tests cases for the header file.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
/*
|
||||
* Automated Testing Framework (atf)
|
||||
*
|
||||
* Copyright (c) 2009 The NetBSD Foundation, Inc.
|
||||
/* Copyright (c) 2009 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -24,31 +21,31 @@
|
|||
* 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 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
|
||||
|
||||
#include "atf-c/build.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "atf-c/build.h"
|
||||
#include "atf-c/config.h"
|
||||
#include "atf-c/detail/env.h"
|
||||
#include "atf-c/detail/sanity.h"
|
||||
#include "atf-c/detail/text.h"
|
||||
#include "atf-c/error.h"
|
||||
|
||||
#include "detail/sanity.h"
|
||||
#include "detail/text.h"
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* Auxiliary functions.
|
||||
* --------------------------------------------------------------------- */
|
||||
|
||||
static
|
||||
atf_error_t
|
||||
append_config_var(const char *var, atf_list_t *argv)
|
||||
append_config_var(const char *var, const char *default_value, atf_list_t *argv)
|
||||
{
|
||||
atf_error_t err;
|
||||
atf_list_t words;
|
||||
|
||||
err = atf_text_split(atf_config_get(var), " ", &words);
|
||||
err = atf_text_split(atf_env_get_with_default(var, default_value),
|
||||
" ", &words);
|
||||
if (atf_is_error(err))
|
||||
goto out;
|
||||
|
||||
|
|
@ -158,15 +155,16 @@ atf_build_c_o(const char *sfile,
|
|||
if (atf_is_error(err))
|
||||
goto out;
|
||||
|
||||
err = append_config_var("atf_build_cc", &argv_list);
|
||||
err = append_config_var("ATF_BUILD_CC", ATF_BUILD_CC, &argv_list);
|
||||
if (atf_is_error(err))
|
||||
goto out_list;
|
||||
|
||||
err = append_config_var("atf_build_cppflags", &argv_list);
|
||||
err = append_config_var("ATF_BUILD_CPPFLAGS", ATF_BUILD_CPPFLAGS,
|
||||
&argv_list);
|
||||
if (atf_is_error(err))
|
||||
goto out_list;
|
||||
|
||||
err = append_config_var("atf_build_cflags", &argv_list);
|
||||
err = append_config_var("ATF_BUILD_CFLAGS", ATF_BUILD_CFLAGS, &argv_list);
|
||||
if (atf_is_error(err))
|
||||
goto out_list;
|
||||
|
||||
|
|
@ -203,11 +201,12 @@ atf_build_cpp(const char *sfile,
|
|||
if (atf_is_error(err))
|
||||
goto out;
|
||||
|
||||
err = append_config_var("atf_build_cpp", &argv_list);
|
||||
err = append_config_var("ATF_BUILD_CPP", ATF_BUILD_CPP, &argv_list);
|
||||
if (atf_is_error(err))
|
||||
goto out_list;
|
||||
|
||||
err = append_config_var("atf_build_cppflags", &argv_list);
|
||||
err = append_config_var("ATF_BUILD_CPPFLAGS", ATF_BUILD_CPPFLAGS,
|
||||
&argv_list);
|
||||
if (atf_is_error(err))
|
||||
goto out_list;
|
||||
|
||||
|
|
@ -248,15 +247,17 @@ atf_build_cxx_o(const char *sfile,
|
|||
if (atf_is_error(err))
|
||||
goto out;
|
||||
|
||||
err = append_config_var("atf_build_cxx", &argv_list);
|
||||
err = append_config_var("ATF_BUILD_CXX", ATF_BUILD_CXX, &argv_list);
|
||||
if (atf_is_error(err))
|
||||
goto out_list;
|
||||
|
||||
err = append_config_var("atf_build_cppflags", &argv_list);
|
||||
err = append_config_var("ATF_BUILD_CPPFLAGS", ATF_BUILD_CPPFLAGS,
|
||||
&argv_list);
|
||||
if (atf_is_error(err))
|
||||
goto out_list;
|
||||
|
||||
err = append_config_var("atf_build_cxxflags", &argv_list);
|
||||
err = append_config_var("ATF_BUILD_CXXFLAGS", ATF_BUILD_CXXFLAGS,
|
||||
&argv_list);
|
||||
if (atf_is_error(err))
|
||||
goto out_list;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
/*
|
||||
* Automated Testing Framework (atf)
|
||||
*
|
||||
* Copyright (c) 2009 The NetBSD Foundation, Inc.
|
||||
/* Copyright (c) 2009 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -24,8 +21,7 @@
|
|||
* 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 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
|
||||
|
||||
#if !defined(ATF_C_BUILD_H)
|
||||
#define ATF_C_BUILD_H
|
||||
|
|
@ -39,4 +35,4 @@ atf_error_t atf_build_cpp(const char *, const char *, const char *const [],
|
|||
atf_error_t atf_build_cxx_o(const char *, const char *, const char *const [],
|
||||
char ***);
|
||||
|
||||
#endif /* ATF_C_BUILD_H */
|
||||
#endif /* !defined(ATF_C_BUILD_H) */
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
/*
|
||||
* Automated Testing Framework (atf)
|
||||
*
|
||||
* Copyright (c) 2009 The NetBSD Foundation, Inc.
|
||||
/* Copyright (c) 2009 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -24,8 +21,9 @@
|
|||
* 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 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
|
||||
|
||||
#include "atf-c/build.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
|
@ -33,20 +31,15 @@
|
|||
|
||||
#include <atf-c.h>
|
||||
|
||||
#include "atf-c/build.h"
|
||||
#include "atf-c/config.h"
|
||||
#include "atf-c/detail/env.h"
|
||||
#include "atf-c/detail/test_helpers.h"
|
||||
#include "atf-c/h_build.h"
|
||||
#include "atf-c/utils.h"
|
||||
|
||||
#include "detail/env.h"
|
||||
#include "detail/test_helpers.h"
|
||||
#include "h_build.h"
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* Auxiliary functions.
|
||||
* --------------------------------------------------------------------- */
|
||||
|
||||
void __atf_config_reinit(void);
|
||||
|
||||
static
|
||||
bool
|
||||
equal_arrays(const char *const *exp_array, char **actual_array)
|
||||
|
|
@ -167,7 +160,6 @@ ATF_TC_BODY(c_o, tc)
|
|||
verbose_set_env("ATF_BUILD_CC", test->cc);
|
||||
verbose_set_env("ATF_BUILD_CFLAGS", test->cflags);
|
||||
verbose_set_env("ATF_BUILD_CPPFLAGS", test->cppflags);
|
||||
__atf_config_reinit();
|
||||
|
||||
{
|
||||
char **argv;
|
||||
|
|
@ -196,7 +188,6 @@ ATF_TC_BODY(cpp, tc)
|
|||
|
||||
verbose_set_env("ATF_BUILD_CPP", test->cpp);
|
||||
verbose_set_env("ATF_BUILD_CPPFLAGS", test->cppflags);
|
||||
__atf_config_reinit();
|
||||
|
||||
{
|
||||
char **argv;
|
||||
|
|
@ -226,7 +217,6 @@ ATF_TC_BODY(cxx_o, tc)
|
|||
verbose_set_env("ATF_BUILD_CXX", test->cxx);
|
||||
verbose_set_env("ATF_BUILD_CXXFLAGS", test->cxxflags);
|
||||
verbose_set_env("ATF_BUILD_CPPFLAGS", test->cppflags);
|
||||
__atf_config_reinit();
|
||||
|
||||
{
|
||||
char **argv;
|
||||
|
|
@ -241,12 +231,6 @@ ATF_TC_BODY(cxx_o, tc)
|
|||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* Tests cases for the header file.
|
||||
* --------------------------------------------------------------------- */
|
||||
|
||||
HEADER_TC(include, "atf-c/build.h");
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* Main.
|
||||
* --------------------------------------------------------------------- */
|
||||
|
|
@ -261,8 +245,5 @@ ATF_TP_ADD_TCS(tp)
|
|||
ATF_TP_ADD_TC(tp, cpp);
|
||||
ATF_TP_ADD_TC(tp, cxx_o);
|
||||
|
||||
/* Add the test cases for the header file. */
|
||||
ATF_TP_ADD_TC(tp, include);
|
||||
|
||||
return atf_no_error();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
/*
|
||||
* Automated Testing Framework (atf)
|
||||
*
|
||||
* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
/* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -24,8 +21,9 @@
|
|||
* 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 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
|
||||
|
||||
#include "atf-c/check.h"
|
||||
|
||||
#include <sys/wait.h>
|
||||
|
||||
|
|
@ -37,18 +35,16 @@
|
|||
#include <unistd.h>
|
||||
|
||||
#include "atf-c/build.h"
|
||||
#include "atf-c/check.h"
|
||||
#include "atf-c/config.h"
|
||||
#include "atf-c/defs.h"
|
||||
#include "atf-c/detail/dynstr.h"
|
||||
#include "atf-c/detail/env.h"
|
||||
#include "atf-c/detail/fs.h"
|
||||
#include "atf-c/detail/list.h"
|
||||
#include "atf-c/detail/process.h"
|
||||
#include "atf-c/detail/sanity.h"
|
||||
#include "atf-c/error.h"
|
||||
#include "atf-c/utils.h"
|
||||
|
||||
#include "detail/dynstr.h"
|
||||
#include "detail/fs.h"
|
||||
#include "detail/list.h"
|
||||
#include "detail/process.h"
|
||||
#include "detail/sanity.h"
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* Auxiliary functions.
|
||||
* --------------------------------------------------------------------- */
|
||||
|
|
@ -60,7 +56,7 @@ create_tmpdir(atf_fs_path_t *dir)
|
|||
atf_error_t err;
|
||||
|
||||
err = atf_fs_path_init_fmt(dir, "%s/check.XXXXXX",
|
||||
atf_config_get("atf_workdir"));
|
||||
atf_env_get_with_default("TMPDIR", "/tmp"));
|
||||
if (atf_is_error(err))
|
||||
goto out;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
/*
|
||||
* Automated Testing Framework (atf)
|
||||
*
|
||||
* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
/* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -24,8 +21,7 @@
|
|||
* 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 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
|
||||
|
||||
#if !defined(ATF_C_CHECK_H)
|
||||
#define ATF_C_CHECK_H
|
||||
|
|
@ -70,4 +66,4 @@ atf_error_t atf_check_build_cxx_o(const char *, const char *,
|
|||
bool *);
|
||||
atf_error_t atf_check_exec_array(const char *const *, atf_check_result_t *);
|
||||
|
||||
#endif /* ATF_C_CHECK_H */
|
||||
#endif /* !defined(ATF_C_CHECK_H) */
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
/*
|
||||
* Automated Testing Framework (atf)
|
||||
*
|
||||
* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
/* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -24,8 +21,9 @@
|
|||
* 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 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
|
||||
|
||||
#include "atf-c/check.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <signal.h>
|
||||
|
|
@ -36,13 +34,10 @@
|
|||
|
||||
#include <atf-c.h>
|
||||
|
||||
#include "atf-c/check.h"
|
||||
#include "atf-c/config.h"
|
||||
|
||||
#include "detail/fs.h"
|
||||
#include "detail/map.h"
|
||||
#include "detail/process.h"
|
||||
#include "detail/test_helpers.h"
|
||||
#include "atf-c/detail/fs.h"
|
||||
#include "atf-c/detail/map.h"
|
||||
#include "atf-c/detail/process.h"
|
||||
#include "atf-c/detail/test_helpers.h"
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* Auxiliary functions.
|
||||
|
|
@ -494,12 +489,8 @@ ATF_TC_HEAD(exec_unknown, tc)
|
|||
}
|
||||
ATF_TC_BODY(exec_unknown, tc)
|
||||
{
|
||||
char buf[1024];
|
||||
snprintf(buf, sizeof(buf), "%s/non-existent",
|
||||
atf_config_get("atf_workdir"));
|
||||
|
||||
const char *argv[2];
|
||||
argv[0] = buf;
|
||||
argv[0] = "/foo/bar/non-existent";
|
||||
argv[1] = NULL;
|
||||
|
||||
atf_check_result_t result;
|
||||
|
|
@ -509,12 +500,6 @@ ATF_TC_BODY(exec_unknown, tc)
|
|||
atf_check_result_fini(&result);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* Tests cases for the header file.
|
||||
* --------------------------------------------------------------------- */
|
||||
|
||||
HEADER_TC(include, "atf-c/check.h");
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* Main.
|
||||
* --------------------------------------------------------------------- */
|
||||
|
|
@ -532,8 +517,5 @@ ATF_TP_ADD_TCS(tp)
|
|||
ATF_TP_ADD_TC(tp, exec_umask);
|
||||
ATF_TP_ADD_TC(tp, exec_unknown);
|
||||
|
||||
/* Add the test cases for the header file. */
|
||||
ATF_TP_ADD_TC(tp, include);
|
||||
|
||||
return atf_no_error();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,164 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*
|
||||
* 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 <ctype.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "atf-c/config.h"
|
||||
|
||||
#include "detail/env.h"
|
||||
#include "detail/sanity.h"
|
||||
|
||||
static bool initialized = false;
|
||||
|
||||
static struct var {
|
||||
const char *name;
|
||||
const char *default_value;
|
||||
const char *value;
|
||||
bool can_be_empty;
|
||||
} vars[] = {
|
||||
{ "atf_arch", ATF_ARCH, NULL, false, },
|
||||
{ "atf_build_cc", ATF_BUILD_CC, NULL, false, },
|
||||
{ "atf_build_cflags", ATF_BUILD_CFLAGS, NULL, true, },
|
||||
{ "atf_build_cpp", ATF_BUILD_CPP, NULL, false, },
|
||||
{ "atf_build_cppflags", ATF_BUILD_CPPFLAGS, NULL, true, },
|
||||
{ "atf_build_cxx", ATF_BUILD_CXX, NULL, false, },
|
||||
{ "atf_build_cxxflags", ATF_BUILD_CXXFLAGS, NULL, true, },
|
||||
{ "atf_confdir", ATF_CONFDIR, NULL, false, },
|
||||
{ "atf_includedir", ATF_INCLUDEDIR, NULL, false, },
|
||||
{ "atf_libdir", ATF_LIBDIR, NULL, false, },
|
||||
{ "atf_libexecdir", ATF_LIBEXECDIR, NULL, false, },
|
||||
{ "atf_machine", ATF_MACHINE, NULL, false, },
|
||||
{ "atf_pkgdatadir", ATF_PKGDATADIR, NULL, false, },
|
||||
{ "atf_shell", ATF_SHELL, NULL, false, },
|
||||
{ "atf_workdir", ATF_WORKDIR, NULL, false, },
|
||||
{ NULL, NULL, NULL, false, },
|
||||
};
|
||||
|
||||
/* Only used for unit testing, so this prototype is private. */
|
||||
void __atf_config_reinit(void);
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* Auxiliary functions.
|
||||
* --------------------------------------------------------------------- */
|
||||
|
||||
static
|
||||
char *
|
||||
string_to_upper(const char *str)
|
||||
{
|
||||
char *uc;
|
||||
|
||||
uc = (char *)malloc(strlen(str) + 1);
|
||||
if (uc != NULL) {
|
||||
char *ucptr = uc;
|
||||
while (*str != '\0') {
|
||||
*ucptr = toupper((int)*str);
|
||||
|
||||
str++;
|
||||
ucptr++;
|
||||
}
|
||||
*ucptr = '\0';
|
||||
}
|
||||
|
||||
return uc;
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
initialize_var(struct var *var, const char *envname)
|
||||
{
|
||||
PRE(var->value == NULL);
|
||||
|
||||
if (atf_env_has(envname)) {
|
||||
const char *val = atf_env_get(envname);
|
||||
if (strlen(val) > 0 || var->can_be_empty)
|
||||
var->value = val;
|
||||
else
|
||||
var->value = var->default_value;
|
||||
} else
|
||||
var->value = var->default_value;
|
||||
|
||||
POST(var->value != NULL);
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
initialize(void)
|
||||
{
|
||||
struct var *var;
|
||||
|
||||
PRE(!initialized);
|
||||
|
||||
for (var = vars; var->name != NULL; var++) {
|
||||
char *envname;
|
||||
|
||||
envname = string_to_upper(var->name);
|
||||
initialize_var(var, envname);
|
||||
free(envname);
|
||||
}
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* Free functions.
|
||||
* --------------------------------------------------------------------- */
|
||||
|
||||
const char *
|
||||
atf_config_get(const char *name)
|
||||
{
|
||||
const struct var *var;
|
||||
const char *value;
|
||||
|
||||
if (!initialized) {
|
||||
initialize();
|
||||
INV(initialized);
|
||||
}
|
||||
|
||||
value = NULL;
|
||||
for (var = vars; value == NULL && var->name != NULL; var++)
|
||||
if (strcmp(var->name, name) == 0)
|
||||
value = var->value;
|
||||
INV(value != NULL);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
void
|
||||
__atf_config_reinit(void)
|
||||
{
|
||||
struct var *var;
|
||||
|
||||
initialized = false;
|
||||
|
||||
for (var = vars; var->name != NULL; var++)
|
||||
var->value = NULL;
|
||||
}
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*
|
||||
* 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_C_CONFIG_H)
|
||||
#define ATF_C_CONFIG_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
const char *atf_config_get(const char *);
|
||||
|
||||
#endif /* !defined(ATF_C_CONFIG_H) */
|
||||
|
|
@ -1,156 +0,0 @@
|
|||
/*
|
||||
* Automated Testing Framework (atf)
|
||||
*
|
||||
* Copyright (c) 2007 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.
|
||||
*
|
||||
* 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 <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <atf-c.h>
|
||||
|
||||
#include "atf-c/config.h"
|
||||
|
||||
#include "detail/env.h"
|
||||
#include "detail/test_helpers.h"
|
||||
|
||||
static const char *test_value = "env-value";
|
||||
|
||||
static struct varnames {
|
||||
const char *lc;
|
||||
const char *uc;
|
||||
bool can_be_empty;
|
||||
} all_vars[] = {
|
||||
{ "atf_arch", "ATF_ARCH", false },
|
||||
{ "atf_build_cc", "ATF_BUILD_CC", false },
|
||||
{ "atf_build_cflags", "ATF_BUILD_CFLAGS", true },
|
||||
{ "atf_build_cpp", "ATF_BUILD_CPP", false },
|
||||
{ "atf_build_cppflags", "ATF_BUILD_CPPFLAGS", true },
|
||||
{ "atf_build_cxx", "ATF_BUILD_CXX", false },
|
||||
{ "atf_build_cxxflags", "ATF_BUILD_CXXFLAGS", true },
|
||||
{ "atf_confdir", "ATF_CONFDIR", false },
|
||||
{ "atf_includedir", "ATF_INCLUDEDIR", false },
|
||||
{ "atf_libdir", "ATF_LIBDIR", false },
|
||||
{ "atf_libexecdir", "ATF_LIBEXECDIR", false },
|
||||
{ "atf_machine", "ATF_MACHINE", false },
|
||||
{ "atf_pkgdatadir", "ATF_PKGDATADIR", false },
|
||||
{ "atf_shell", "ATF_SHELL", false },
|
||||
{ "atf_workdir", "ATF_WORKDIR", false },
|
||||
{ NULL, NULL, false }
|
||||
};
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* Auxiliary functions.
|
||||
* --------------------------------------------------------------------- */
|
||||
|
||||
void __atf_config_reinit(void);
|
||||
|
||||
static
|
||||
void
|
||||
unset_all(void)
|
||||
{
|
||||
const struct varnames *v;
|
||||
for (v = all_vars; v->lc != NULL; v++)
|
||||
RE(atf_env_unset(v->uc));
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
compare_one(const char *var, const char *expvalue)
|
||||
{
|
||||
const struct varnames *v;
|
||||
|
||||
printf("Checking that %s is set to %s\n", var, expvalue);
|
||||
|
||||
for (v = all_vars; v->lc != NULL; v++) {
|
||||
if (strcmp(v->lc, var) == 0)
|
||||
ATF_CHECK_STREQ(atf_config_get(v->lc), test_value);
|
||||
else
|
||||
ATF_CHECK(strcmp(atf_config_get(v->lc), test_value) != 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* Test cases for the free functions.
|
||||
* --------------------------------------------------------------------- */
|
||||
|
||||
ATF_TC(get);
|
||||
ATF_TC_HEAD(get, tc)
|
||||
{
|
||||
atf_tc_set_md_var(tc, "descr", "Tests the atf_config_get function");
|
||||
}
|
||||
ATF_TC_BODY(get, tc)
|
||||
{
|
||||
const struct varnames *v;
|
||||
|
||||
/* Unset all known environment variables and make sure the built-in
|
||||
* values do not match the bogus value we will use for testing. */
|
||||
unset_all();
|
||||
__atf_config_reinit();
|
||||
for (v = all_vars; v->lc != NULL; v++)
|
||||
ATF_CHECK(strcmp(atf_config_get(v->lc), test_value) != 0);
|
||||
|
||||
/* Test the behavior of empty values. */
|
||||
for (v = all_vars; v->lc != NULL; v++) {
|
||||
unset_all();
|
||||
if (strcmp(atf_config_get(v->lc), "") != 0) {
|
||||
RE(atf_env_set(v->uc, ""));
|
||||
__atf_config_reinit();
|
||||
if (v->can_be_empty)
|
||||
ATF_CHECK(strlen(atf_config_get(v->lc)) == 0);
|
||||
else
|
||||
ATF_CHECK(strlen(atf_config_get(v->lc)) > 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* Check if every variable is recognized individually. */
|
||||
for (v = all_vars; v->lc != NULL; v++) {
|
||||
unset_all();
|
||||
RE(atf_env_set(v->uc, test_value));
|
||||
__atf_config_reinit();
|
||||
compare_one(v->lc, test_value);
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* Tests cases for the header file.
|
||||
* --------------------------------------------------------------------- */
|
||||
|
||||
HEADER_TC(include, "atf-c/config.h");
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* Main.
|
||||
* --------------------------------------------------------------------- */
|
||||
|
||||
ATF_TP_ADD_TCS(tp)
|
||||
{
|
||||
ATF_TP_ADD_TC(tp, get);
|
||||
|
||||
/* Add the test cases for the header file. */
|
||||
ATF_TP_ADD_TC(tp, include);
|
||||
|
||||
return atf_no_error();
|
||||
}
|
||||
|
|
@ -1,7 +1,4 @@
|
|||
/*
|
||||
* Automated Testing Framework (atf)
|
||||
*
|
||||
* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
/* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -24,8 +21,7 @@
|
|||
* 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 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
|
||||
|
||||
#if !defined(ATF_C_DEFS_H)
|
||||
#define ATF_C_DEFS_H
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
#
|
||||
# Automated Testing Framework (atf)
|
||||
#
|
||||
# Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
|
|
@ -25,7 +22,6 @@
|
|||
# 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.
|
||||
#
|
||||
|
||||
libatf_c_la_SOURCES += atf-c/detail/dynstr.c \
|
||||
atf-c/detail/dynstr.h \
|
||||
|
|
@ -55,7 +51,8 @@ EXTRA_DIST += $(tests_atf_c_detail_DATA)
|
|||
noinst_LTLIBRARIES += atf-c/detail/libtest_helpers.la
|
||||
atf_c_detail_libtest_helpers_la_SOURCES = atf-c/detail/test_helpers.c \
|
||||
atf-c/detail/test_helpers.h
|
||||
atf_c_detail_libtest_helpers_la_CPPFLAGS = -I$(srcdir)/atf-c
|
||||
atf_c_detail_libtest_helpers_la_CPPFLAGS = -I$(srcdir)/atf-c \
|
||||
-DATF_INCLUDEDIR=\"$(includedir)\"
|
||||
|
||||
tests_atf_c_detail_PROGRAMS = atf-c/detail/dynstr_test
|
||||
atf_c_detail_dynstr_test_SOURCES = atf-c/detail/dynstr_test.c
|
||||
|
|
@ -96,4 +93,7 @@ tests_atf_c_detail_PROGRAMS += atf-c/detail/user_test
|
|||
atf_c_detail_user_test_SOURCES = atf-c/detail/user_test.c
|
||||
atf_c_detail_user_test_LDADD = atf-c/detail/libtest_helpers.la libatf-c.la
|
||||
|
||||
tests_atf_c_detail_PROGRAMS += atf-c/detail/version_helper
|
||||
atf_c_detail_version_helper_SOURCES = atf-c/detail/version_helper.c
|
||||
|
||||
# vim: syntax=make:noexpandtab:shiftwidth=8:softtabstop=8
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
/*
|
||||
* Automated Testing Framework (atf)
|
||||
*
|
||||
* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
/* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -24,8 +21,9 @@
|
|||
* 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 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
|
||||
|
||||
#include "atf-c/detail/dynstr.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdarg.h>
|
||||
|
|
@ -34,12 +32,10 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "atf-c/detail/sanity.h"
|
||||
#include "atf-c/detail/text.h"
|
||||
#include "atf-c/error.h"
|
||||
|
||||
#include "dynstr.h"
|
||||
#include "sanity.h"
|
||||
#include "text.h"
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* Auxiliary functions.
|
||||
* --------------------------------------------------------------------- */
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
/*
|
||||
* Automated Testing Framework (atf)
|
||||
*
|
||||
* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
/* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -24,11 +21,10 @@
|
|||
* 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 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
|
||||
|
||||
#if !defined(ATF_C_DYNSTR_H)
|
||||
#define ATF_C_DYNSTR_H
|
||||
#if !defined(ATF_C_DETAIL_DYNSTR_H)
|
||||
#define ATF_C_DETAIL_DYNSTR_H
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
|
|
@ -78,4 +74,4 @@ atf_error_t atf_dynstr_prepend_fmt(atf_dynstr_t *, const char *, ...);
|
|||
bool atf_equal_dynstr_cstring(const atf_dynstr_t *, const char *);
|
||||
bool atf_equal_dynstr_dynstr(const atf_dynstr_t *, const atf_dynstr_t *);
|
||||
|
||||
#endif /* ATF_C_DYNSTR_H */
|
||||
#endif /* !defined(ATF_C_DETAIL_DYNSTR_H) */
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
/*
|
||||
* Automated Testing Framework (atf)
|
||||
*
|
||||
* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
/* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -24,8 +21,9 @@
|
|||
* 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 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
|
||||
|
||||
#include "atf-c/detail/dynstr.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
|
@ -35,8 +33,7 @@
|
|||
|
||||
#include <atf-c.h>
|
||||
|
||||
#include "dynstr.h"
|
||||
#include "test_helpers.h"
|
||||
#include "atf-c/detail/test_helpers.h"
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* Tests for the "atf_dynstr" type.
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue