From owner-dev-commits-src-all@freebsd.org Thu Jan 28 17:37:18 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 380414E4435 for ; Thu, 28 Jan 2021 17:37:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DRSMy0vFvz3vpQ; Thu, 28 Jan 2021 17:37:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1183713CCC; Thu, 28 Jan 2021 17:37:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10SHbIkH056291; Thu, 28 Jan 2021 17:37:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10SHbIqN056290; Thu, 28 Jan 2021 17:37:18 GMT (envelope-from git) Date: Thu, 28 Jan 2021 17:37:18 GMT Message-Id: <202101281737.10SHbIqN056290@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Alex Richardson Subject: git: a3330ae73660 - vendor/atf - Vendor import of atf commit ca73d08c3fc1ecffc1f1c97458c31ab82c12bb01 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/vendor/atf X-Git-Reftype: branch X-Git-Commit: a3330ae736606c1812b9e9c4b9dcfdfb1a150dde Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jan 2021 17:37:18 -0000 The branch vendor/atf has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=a3330ae736606c1812b9e9c4b9dcfdfb1a150dde commit a3330ae736606c1812b9e9c4b9dcfdfb1a150dde Author: Alex Richardson AuthorDate: 2021-01-28 15:48:35 +0000 Commit: Alex Richardson CommitDate: 2021-01-28 15:48:53 +0000 Vendor import of atf commit ca73d08c3fc1ecffc1f1c97458c31ab82c12bb01 Updated from https://github.com/freebsd/atf --- .cirrus.yml | 26 ++++++++ .gitignore | 25 ++++++++ .travis.yml | 25 ++++++++ Makefile.am | 14 ++++- NEWS | 18 ++++++ README.md | 47 +++++++++++++++ admin/.gitignore | 8 +++ admin/clean-all.sh | 84 ++++++++++++++++++++++++++ admin/travis-build.sh | 78 ++++++++++++++++++++++++ admin/travis-install-deps.sh | 108 +++++++++++++++++++++++++++++++++ atf-c++/Makefile.am.inc | 29 ++++++--- atf-c++/atf-c++.3 | 14 ++--- atf-c++/detail/test_helpers.hpp | 5 ++ atf-c++/tests.hpp | 2 +- atf-c++/utils.cpp | 7 +++ atf-c++/utils.hpp | 1 + atf-c++/utils_test.cpp | 1 + atf-c/.gitignore | 1 + atf-c/Makefile.am.inc | 29 ++++++--- atf-c/atf-c.3 | 8 +-- atf-c/check.c | 3 +- atf-c/detail/fs_test.c | 9 ++- atf-c/detail/list.c | 2 +- atf-c/detail/process.c | 3 +- atf-c/detail/test_helpers.h | 7 +++ atf-c/tc.c | 116 +++++++++++++++++++++++++++--------- atf-c/utils.c | 10 ++++ atf-c/utils.h | 1 + atf-c/utils_test.c | 1 + atf-sh/.gitignore | 2 + atf-sh/atf-check.1 | 31 +++++++--- atf-sh/atf-check.cpp | 128 ++++++++++++++++++++++++++++++++++++---- atf-sh/atf-sh.1 | 2 +- atf-sh/atf-sh.3 | 17 ++++-- atf-sh/atf_check_test.sh | 24 ++++++++ atf-sh/libatf-sh.subr | 32 +++++++++- atf-sh/misc_helpers.sh | 48 +++++++++++++++ bootstrap/.gitignore | 11 ++++ bootstrap/h_tp_atf_check_sh.sh | 0 bootstrap/h_tp_basic_sh.sh | 0 bootstrap/h_tp_fail.sh | 0 bootstrap/h_tp_pass.sh | 0 configure.ac | 2 +- doc/.gitignore | 1 + doc/atf-test-case.4 | 23 +++++--- m4/.gitignore | 5 ++ 46 files changed, 913 insertions(+), 95 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml new file mode 100644 index 000000000000..fd9b6e4a47df --- /dev/null +++ b/.cirrus.yml @@ -0,0 +1,26 @@ +env: + CIRRUS_CLONE_DEPTH: 1 + ARCH: amd64 + +task: + matrix: + - name: 13.0-CURRENT + freebsd_instance: + image_family: freebsd-13-0-snap + - name: 12.2-STABLE + freebsd_instance: + image_family: freebsd-12-2-snap + - name: 12.1-RELEASE + freebsd_instance: + image_family: freebsd-12-1 + install_script: + - sed -i.bak -e 's,pkg+http://pkg.FreeBSD.org/\${ABI}/quarterly,pkg+http://pkg.FreeBSD.org/\${ABI}/latest,' /etc/pkg/FreeBSD.conf + - ASSUME_ALWAYS_YES=yes pkg bootstrap -f + - pkg install -y autoconf automake libtool kyua + script: + - env JUNIT_OUTPUT=$(pwd)/test-results.xml ./admin/travis-build.sh + always: + junit_artifacts: + path: "test-results.xml" + type: text/xml + format: junit diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..396785ce2052 --- /dev/null +++ b/.gitignore @@ -0,0 +1,25 @@ +*.la +*.lo +*.o +*.pc +*_helper +*_helpers +*_test +.deps +.dirstamp +.libs + +Makefile +Makefile.in +aclocal.m4 +autom4te.cache +config.h +config.h.in +config.h.in~ +config.log +config.status +configure +installcheck.log +libtool +stamp-h1 +testsuite.log diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000000..1949aae54468 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,25 @@ +language: cpp + +compiler: + - gcc + - clang + +before_install: + - ./admin/travis-install-deps.sh + +env: + - ARCH=amd64 AS_ROOT=no + - ARCH=amd64 AS_ROOT=yes + - ARCH=i386 AS_ROOT=no + +matrix: + exclude: + - compiler: clang + env: ARCH=i386 AS_ROOT=no + +script: + - ./admin/travis-build.sh + +notifications: + email: + - atf-log@googlegroups.com diff --git a/Makefile.am b/Makefile.am index 41c9a6bfb046..913910c274a3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -39,7 +39,6 @@ INSTALLCHECK_TARGETS = PHONY_TARGETS = ACLOCAL_AMFLAGS = -I m4 -AM_DISTCHECK_CONFIGURE_FLAGS = --enable-tools include admin/Makefile.am.inc include atf-c/Makefile.am.inc @@ -75,8 +74,19 @@ PHONY_TARGETS += installcheck-kyua if HAVE_KYUA INSTALLCHECK_TARGETS += installcheck-kyua installcheck-kyua: + set +e; cd $(pkgtestsdir) && $(TESTS_ENVIRONMENT) \ + $(KYUA) --config='$(KYUA_TEST_CONFIG_FILE)' test; \ + ret=$$?; \ + echo $$ret; \ + if [ -n "$$JUNIT_OUTPUT" ]; then \ + cd $(pkgtestsdir) && $(TESTS_ENVIRONMENT) \ + $(KYUA) --config='$(KYUA_TEST_CONFIG_FILE)' \ + report-junit --output="$$JUNIT_OUTPUT"; \ + sed -i '' 's/encoding="iso-8859-1"/econding="utf-8"/' "$$JUNIT_OUTPUT"; \ + fi; \ cd $(pkgtestsdir) && $(TESTS_ENVIRONMENT) \ - $(KYUA) --config='$(KYUA_TEST_CONFIG_FILE)' test + $(KYUA) --config='$(KYUA_TEST_CONFIG_FILE)' report --verbose; \ + exit $$ret endif installcheck-local: $(INSTALLCHECK_TARGETS) diff --git a/NEWS b/NEWS index 35b6e0c69238..548b069f3558 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,24 @@ Major changes between releases Automated Testing Framework =========================================================================== +Changes in version 0.22 +*********************** + +STILL UNDER DEVELOPMENT; NOT RELEASED YET. +DON'T FORGET TO BUMP THE -version-info PRE-RELEASE IF NECESSARY! + +* Issue #23: Fix double-free triggered by atf_map_insert in low memory + scenarios, caused by an overlook in the atf_list code. + +* Issue #29: Fixed various typos and formatting errors in manual pages. + +* Issue #31: Added require.progs metadata properties to the tests that + need a compiler to run. + +* Added the atf_check_not_equal function to atf-sh to check for + unequal values. + + Changes in version 0.21 *********************** diff --git a/README.md b/README.md new file mode 100644 index 000000000000..d245552f35c9 --- /dev/null +++ b/README.md @@ -0,0 +1,47 @@ +# 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. + +* OpenBSD: install the `devel/atf` package with `pkg_add atf`. + +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. diff --git a/admin/.gitignore b/admin/.gitignore new file mode 100644 index 000000000000..64f348c68ebf --- /dev/null +++ b/admin/.gitignore @@ -0,0 +1,8 @@ +ar-lib +compile +config.guess +config.sub +depcomp +install-sh +ltmain.sh +missing diff --git a/admin/clean-all.sh b/admin/clean-all.sh new file mode 100755 index 000000000000..e278d150d773 --- /dev/null +++ b/admin/clean-all.sh @@ -0,0 +1,84 @@ +#! /bin/sh +# 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. + +Prog_Name=${0##*/} + +if [ ! -f ./atf-c.h ]; then + echo "${Prog_Name}: must be run from atf source's top directory" 1>&2 + exit 1 +fi + +if [ ! -f configure ]; then + echo "${Prog_Name}: nothing to clean" 1>&2 + exit 1 +fi + +[ -f Makefile ] || ./configure +make distclean + +# Top-level directory. +rm -f .gdb_history +rm -f Makefile.in +rm -f aclocal.m4 +rm -rf autom4te.cache +rm -f config.h.in* +rm -f configure +rm -f mkinstalldirs +rm -f atf-*.tar.gz +rm -rf release-test + +# `admin' directory. +rm -f admin/compile +rm -f admin/config.guess +rm -f admin/config.sub +rm -f admin/depcomp +rm -f admin/install-sh +rm -f admin/ltmain.sh +rm -f admin/missing + +# `m4' directory. +rm -f m4/libtool.m4 +rm -f m4/lt*.m4 + +# `bootstrap' directory. +rm -f bootstrap/package.m4 +rm -f bootstrap/testsuite + +# Files and directories spread all around the tree. +find . -name '#*' | xargs rm -rf +find . -name '*~' | xargs rm -rf +find . -name .deps | xargs rm -rf +find . -name .gdb_history | xargs rm -rf +find . -name .libs | xargs rm -rf +find . -name .tmp | xargs rm -rf + +# Show remaining files +if [ -n "${GIT}" ]; then + echo ">>> untracked and ignored files" + "${GIT}" status --porcelain --ignored | grep -E '^(\?\?|!!)' +fi + +# vim: syntax=sh:expandtab:shiftwidth=4:softtabstop=4 diff --git a/admin/travis-build.sh b/admin/travis-build.sh new file mode 100755 index 000000000000..2c5fe756886d --- /dev/null +++ b/admin/travis-build.sh @@ -0,0 +1,78 @@ +#! /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 + +ret=0 +./configure || ret=${?} +if [ ${ret} -ne 0 ]; then + cat config.log || true + exit ${ret} +fi + +archflags= +[ "${ARCH?}" != i386 ] || archflags=-m32 + +f= + +if [ -n "${archflags}" ]; then + CC=${CC-"cc"} + CXX=${CXX-"c++"} + + f="${f} ATF_BUILD_CC='${CC} ${archflags}'" + f="${f} ATF_BUILD_CXX='${CXX} ${archflags}'" + f="${f} CFLAGS='${archflags}'" + f="${f} CXXFLAGS='${archflags}'" + f="${f} LDFLAGS='${archflags}'" +fi + +if [ "${AS_ROOT:-no}" = yes ]; then + cat >root-kyua.conf <&2 + exit 1 + ;; + esac + wget "http://dl.bintray.com/jmmv/kyua/${name}" || return 1 + sudo tar -xzvp -C / -f "${name}" + rm -f "${name}" +} + +install_deps +if ! install_from_bintray; then + install_from_github atf 0.21 + install_from_github lutok 0.4 + install_from_github kyua 0.12 +fi + +# vim: syntax=sh:expandtab:shiftwidth=4:softtabstop=4 diff --git a/atf-c++/Makefile.am.inc b/atf-c++/Makefile.am.inc index b131e555a06f..9d982b0f8c8d 100644 --- a/atf-c++/Makefile.am.inc +++ b/atf-c++/Makefile.am.inc @@ -58,7 +58,7 @@ EXTRA_DIST += atf-c++/atf-c++.pc.in atf-c++/atf-c++.pc: $(srcdir)/atf-c++/atf-c++.pc.in Makefile $(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#__CXX__#$(ATF_BUILD_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; \ @@ -70,18 +70,29 @@ tests_atf_c___DATA = atf-c++/Kyuafile \ tests_atf_c__dir = $(pkgtestsdir)/atf-c++ EXTRA_DIST += $(tests_atf_c___DATA) +ATF_CXX_TEST_HELPERS_CPPFLAGS = "-DATF_BUILD_CXX=\"$(ATF_BUILD_CXX)\"" +ATF_CXX_TEST_HELPERS_LDADD = atf-c++/detail/libtest_helpers.la + tests_atf_c___PROGRAMS = atf-c++/atf_c++_test atf_c___atf_c___test_SOURCES = atf-c++/atf_c++_test.cpp -atf_c___atf_c___test_LDADD = atf-c++/detail/libtest_helpers.la $(ATF_CXX_LIBS) +atf_c___atf_c___test_CPPFLAGS = $(ATF_CXX_TEST_HELPERS_CPPFLAGS) +atf_c___atf_c___test_LDADD = $(ATF_CXX_TEST_HELPERS_LDADD) $(ATF_CXX_LIBS) + tests_atf_c___PROGRAMS += atf-c++/build_test atf_c___build_test_SOURCES = atf-c++/build_test.cpp atf-c/h_build.h -atf_c___build_test_LDADD = atf-c++/detail/libtest_helpers.la $(ATF_CXX_LIBS) +atf_c___build_test_CPPFLAGS = $(ATF_CXX_TEST_HELPERS_CPPFLAGS) +atf_c___build_test_LDADD = $(ATF_CXX_TEST_HELPERS_LDADD) $(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) +atf_c___check_test_CPPFLAGS = $(ATF_CXX_TEST_HELPERS_CPPFLAGS) +atf_c___check_test_LDADD = $(ATF_CXX_TEST_HELPERS_LDADD) $(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) +atf_c___macros_test_CPPFLAGS = $(ATF_CXX_TEST_HELPERS_CPPFLAGS) +atf_c___macros_test_LDADD = $(ATF_CXX_TEST_HELPERS_LDADD) $(ATF_CXX_LIBS) + tests_atf_c___SCRIPTS = atf-c++/pkg_config_test CLEANFILES += atf-c++/pkg_config_test EXTRA_DIST += atf-c++/pkg_config_test.sh @@ -91,10 +102,14 @@ atf-c++/pkg_config_test: $(srcdir)/atf-c++/pkg_config_test.sh tests_atf_c___PROGRAMS += atf-c++/tests_test atf_c___tests_test_SOURCES = atf-c++/tests_test.cpp -atf_c___tests_test_LDADD = atf-c++/detail/libtest_helpers.la $(ATF_CXX_LIBS) +atf_c___tests_test_CPPFLAGS = $(ATF_CXX_TEST_HELPERS_CPPFLAGS) +atf_c___tests_test_LDADD = $(ATF_CXX_TEST_HELPERS_LDADD) $(ATF_CXX_LIBS) + tests_atf_c___PROGRAMS += atf-c++/utils_test atf_c___utils_test_SOURCES = atf-c++/utils_test.cpp -atf_c___utils_test_LDADD = atf-c++/detail/libtest_helpers.la $(ATF_CXX_LIBS) +atf_c___utils_test_CPPFLAGS = $(ATF_CXX_TEST_HELPERS_CPPFLAGS) +atf_c___utils_test_LDADD = $(ATF_CXX_TEST_HELPERS_LDADD) $(ATF_CXX_LIBS) + include atf-c++/detail/Makefile.am.inc # vim: syntax=make:noexpandtab:shiftwidth=8:softtabstop=8 diff --git a/atf-c++/atf-c++.3 b/atf-c++/atf-c++.3 index 984ec936446a..c39d905567b8 100644 --- a/atf-c++/atf-c++.3 +++ b/atf-c++/atf-c++.3 @@ -145,10 +145,10 @@ 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 ... +\&... C-specific includes go here ... } -.Ns ... C++-specific includes go here ... +\&... C++-specific includes go here ... #include @@ -182,7 +182,7 @@ ATF_TEST_CASE_BODY(tc3) ... third test case's body ... } -.Ns ... additional test cases ... +\&... additional test cases ... ATF_INIT_TEST_CASES(tcs) { @@ -202,7 +202,7 @@ To define test cases, one can use the .Fn ATF_TEST_CASE_WITH_CLEANUP or the .Fn ATF_TEST_CASE_WITHOUT_HEAD -macros, which take a single parameter specifiying the test case's +macros, which take a single parameter specifying the test case's name. .Fn ATF_TEST_CASE , requires to define a head and a body for the test case, @@ -232,7 +232,7 @@ opening and closing brackets. Additionally, the .Fn ATF_TEST_CASE_NAME macro can be used to obtain the name of the class corresponding to a -particular test case, as the name is internally manged by the library to +particular test case, as the name is internally managed by the library to prevent clashes with other user identifiers. Similarly, the .Fn ATF_TEST_CASE_USE @@ -403,8 +403,8 @@ in the collection. takes the name of an exception and a statement and raises a failure if the statement does not throw the specified exception. .Fn ATF_REQUIRE_THROW_RE -takes the name of an exception, a regular expresion and a statement and raises a -failure if the statement does not throw the specified exception and if the +takes the name of an exception, a regular expression and a statement, and raises +a failure if the statement does not throw the specified exception and if the message of the exception does not match the regular expression. .Pp .Fn ATF_CHECK_ERRNO diff --git a/atf-c++/detail/test_helpers.hpp b/atf-c++/detail/test_helpers.hpp index f166ee218a13..c1171801a3a7 100644 --- a/atf-c++/detail/test_helpers.hpp +++ b/atf-c++/detail/test_helpers.hpp @@ -36,6 +36,7 @@ #include +#include #include #define HEADER_TC(name, hdrname) \ @@ -44,6 +45,8 @@ { \ set_md_var("descr", "Tests that the " hdrname " file can be " \ "included on its own, without any prerequisites"); \ + const std::string cxx = atf::env::get("ATF_BUILD_CXX", ATF_BUILD_CXX); \ + set_md_var("require.progs", cxx); \ } \ ATF_TEST_CASE_BODY(name) \ { \ @@ -55,6 +58,8 @@ ATF_TEST_CASE_HEAD(name) \ { \ set_md_var("descr", descr); \ + const std::string cxx = atf::env::get("ATF_BUILD_CXX", ATF_BUILD_CXX); \ + set_md_var("require.progs", cxx); \ } \ ATF_TEST_CASE_BODY(name) \ { \ diff --git a/atf-c++/tests.hpp b/atf-c++/tests.hpp index ce2fb1d165c8..a03cc852dcf8 100644 --- a/atf-c++/tests.hpp +++ b/atf-c++/tests.hpp @@ -73,7 +73,7 @@ class tc { tc(const tc&); tc& operator=(const tc&); - std::auto_ptr< tc_impl > pimpl; + std::unique_ptr< tc_impl > pimpl; protected: virtual void head(void); diff --git a/atf-c++/utils.cpp b/atf-c++/utils.cpp index a6ab08f0d770..995d78c6542e 100644 --- a/atf-c++/utils.cpp +++ b/atf-c++/utils.cpp @@ -70,6 +70,13 @@ atf::utils::fork(void) return atf_utils_fork(); } +void +atf::utils::reset_resultsfile(void) +{ + + atf_utils_reset_resultsfile(); +} + bool atf::utils::grep_file(const std::string& regex, const std::string& path) { diff --git a/atf-c++/utils.hpp b/atf-c++/utils.hpp index 8f5c5e337455..34d77a126df7 100644 --- a/atf-c++/utils.hpp +++ b/atf-c++/utils.hpp @@ -41,6 +41,7 @@ void copy_file(const std::string&, const std::string&); void create_file(const std::string&, const std::string&); bool file_exists(const std::string&); pid_t fork(void); +void reset_resultsfile(void); bool grep_file(const std::string&, const std::string&); bool grep_string(const std::string&, const std::string&); void redirect(const int, const std::string&); diff --git a/atf-c++/utils_test.cpp b/atf-c++/utils_test.cpp index 34e0709f580a..93e16652bac1 100644 --- a/atf-c++/utils_test.cpp +++ b/atf-c++/utils_test.cpp @@ -335,6 +335,7 @@ fork_and_wait(const int exitstatus, const char* expout, const char* experr) std::cerr << "Some error\n"; exit(123); } + atf::utils::reset_resultsfile(); atf::utils::wait(pid, exitstatus, expout, experr); exit(EXIT_SUCCESS); } diff --git a/atf-c/.gitignore b/atf-c/.gitignore new file mode 100644 index 000000000000..e7f0fb647c32 --- /dev/null +++ b/atf-c/.gitignore @@ -0,0 +1 @@ +defs.h diff --git a/atf-c/Makefile.am.inc b/atf-c/Makefile.am.inc index bcb06da3a149..ec0e9e5d41ec 100644 --- a/atf-c/Makefile.am.inc +++ b/atf-c/Makefile.am.inc @@ -71,7 +71,7 @@ EXTRA_DIST += atf-c/atf-c.pc.in atf-c/atf-c.pc: $(srcdir)/atf-c/atf-c.pc.in Makefile $(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#__CC__#$(ATF_BUILD_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; \ @@ -83,25 +83,33 @@ tests_atf_c_DATA = atf-c/Kyuafile \ tests_atf_cdir = $(pkgtestsdir)/atf-c EXTRA_DIST += $(tests_atf_c_DATA) +ATF_C_TEST_HELPERS_CPPFLAGS = "-DATF_BUILD_CC=\"$(ATF_BUILD_CC)\"" +ATF_C_TEST_HELPERS_LDADD = atf-c/detail/libtest_helpers.la + tests_atf_c_PROGRAMS = atf-c/atf_c_test atf_c_atf_c_test_SOURCES = atf-c/atf_c_test.c -atf_c_atf_c_test_LDADD = atf-c/detail/libtest_helpers.la libatf-c.la +atf_c_atf_c_test_CPPFLAGS = $(ATF_C_TEST_HELPERS_CPPFLAGS) +atf_c_atf_c_test_LDADD = $(ATF_C_TEST_HELPERS_LDADD) libatf-c.la tests_atf_c_PROGRAMS += atf-c/build_test atf_c_build_test_SOURCES = atf-c/build_test.c atf-c/h_build.h -atf_c_build_test_LDADD = atf-c/detail/libtest_helpers.la libatf-c.la +atf_c_build_test_CPPFLAGS = $(ATF_C_TEST_HELPERS_CPPFLAGS) +atf_c_build_test_LDADD = $(ATF_C_TEST_HELPERS_LDADD) libatf-c.la 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 +atf_c_check_test_CPPFLAGS = $(ATF_C_TEST_HELPERS_CPPFLAGS) +atf_c_check_test_LDADD = $(ATF_C_TEST_HELPERS_LDADD) 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 +atf_c_error_test_CPPFLAGS = $(ATF_C_TEST_HELPERS_CPPFLAGS) +atf_c_error_test_LDADD = $(ATF_C_TEST_HELPERS_LDADD) libatf-c.la tests_atf_c_PROGRAMS += atf-c/macros_test atf_c_macros_test_SOURCES = atf-c/macros_test.c -atf_c_macros_test_LDADD = atf-c/detail/libtest_helpers.la libatf-c.la +atf_c_macros_test_CPPFLAGS = $(ATF_C_TEST_HELPERS_CPPFLAGS) +atf_c_macros_test_LDADD = $(ATF_C_TEST_HELPERS_LDADD) libatf-c.la tests_atf_c_SCRIPTS = atf-c/pkg_config_test CLEANFILES += atf-c/pkg_config_test @@ -112,15 +120,18 @@ atf-c/pkg_config_test: $(srcdir)/atf-c/pkg_config_test.sh tests_atf_c_PROGRAMS += atf-c/tc_test atf_c_tc_test_SOURCES = atf-c/tc_test.c -atf_c_tc_test_LDADD = atf-c/detail/libtest_helpers.la libatf-c.la +atf_c_tc_test_CPPFLAGS = $(ATF_C_TEST_HELPERS_CPPFLAGS) +atf_c_tc_test_LDADD = $(ATF_C_TEST_HELPERS_LDADD) libatf-c.la tests_atf_c_PROGRAMS += atf-c/tp_test atf_c_tp_test_SOURCES = atf-c/tp_test.c -atf_c_tp_test_LDADD = atf-c/detail/libtest_helpers.la libatf-c.la +atf_c_tp_test_CPPFLAGS = $(ATF_C_TEST_HELPERS_CPPFLAGS) +atf_c_tp_test_LDADD = $(ATF_C_TEST_HELPERS_LDADD) libatf-c.la tests_atf_c_PROGRAMS += atf-c/utils_test atf_c_utils_test_SOURCES = atf-c/utils_test.c atf-c/h_build.h -atf_c_utils_test_LDADD = atf-c/detail/libtest_helpers.la libatf-c.la +atf_c_utils_test_CPPFLAGS = $(ATF_C_TEST_HELPERS_CPPFLAGS) +atf_c_utils_test_LDADD = $(ATF_C_TEST_HELPERS_LDADD) libatf-c.la include atf-c/detail/Makefile.am.inc diff --git a/atf-c/atf-c.3 b/atf-c/atf-c.3 index edb7207d7cda..2e0de174c9a9 100644 --- a/atf-c/atf-c.3 +++ b/atf-c/atf-c.3 @@ -203,7 +203,7 @@ 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 ... +\&... C-specific includes go here ... #include @@ -237,7 +237,7 @@ ATF_TC_BODY(tc3, tc) ... third test case's body ... } -.Ns ... additional test cases ... +\&... additional test cases ... ATF_TP_ADD_TCS(tp) { @@ -259,7 +259,7 @@ To define test cases, one can use the .Fn ATF_TC_WITH_CLEANUP or the .Fn ATF_TC_WITHOUT_HEAD -macros, which take a single parameter specifiying the test case's name. +macros, which take a single parameter specifying the test case's name. .Fn ATF_TC , requires to define a head and a body for the test case, .Fn ATF_TC_WITH_CLEANUP @@ -299,7 +299,7 @@ library to do it for you. This is done by using the .Fn ATF_TP_ADD_TCS macro, which is passed the name of the object that will hold the test -cases; i.e. the test program instance. +cases, i.e., the test program instance. This name can be whatever you want as long as it is a valid variable identifier. .Pp diff --git a/atf-c/check.c b/atf-c/check.c index 38afdf3743a6..1aec01bcca6b 100644 --- a/atf-c/check.c +++ b/atf-c/check.c @@ -29,6 +29,7 @@ #include #include +#include #include #include #include @@ -106,7 +107,7 @@ static int const_execvp(const char *file, const char *const *argv) { -#define UNCONST(a) ((void *)(unsigned long)(const void *)(a)) +#define UNCONST(a) ((void *)(uintptr_t)(const void *)(a)) return execvp(file, UNCONST(argv)); #undef UNCONST } diff --git a/atf-c/detail/fs_test.c b/atf-c/detail/fs_test.c index 3dbc4d3ba7ef..7812be0334b8 100644 --- a/atf-c/detail/fs_test.c +++ b/atf-c/detail/fs_test.c @@ -779,7 +779,7 @@ ATF_TC_BODY(rmdir_enotempty, tc) atf_fs_path_fini(&p); } -ATF_TC(rmdir_eperm); +ATF_TC_WITH_CLEANUP(rmdir_eperm); ATF_TC_HEAD(rmdir_eperm, tc) { atf_tc_set_md_var(tc, "descr", "Tests the atf_fs_rmdir function"); @@ -808,6 +808,13 @@ ATF_TC_BODY(rmdir_eperm, tc) atf_fs_path_fini(&p); } +ATF_TC_CLEANUP(rmdir_eperm, tc) +{ + if (chmod("test-dir", 0755) == -1) { + fprintf(stderr, "Failed to unprotect test-dir; test directory " + "cleanup will fail\n"); + } +} ATF_TC(mkdtemp_ok); ATF_TC_HEAD(mkdtemp_ok, tc) diff --git a/atf-c/detail/list.c b/atf-c/detail/list.c index d14216eb409f..7ac9f1fc948b 100644 --- a/atf-c/detail/list.c +++ b/atf-c/detail/list.c @@ -74,7 +74,7 @@ new_entry(void *object, bool managed) le->m_prev = le->m_next = NULL; le->m_object = object; le->m_managed = managed; - } else + } else if (managed) free(object); return le; diff --git a/atf-c/detail/process.c b/atf-c/detail/process.c index 8e08b6c57466..a6189bf78e20 100644 --- a/atf-c/detail/process.c +++ b/atf-c/detail/process.c @@ -30,6 +30,7 @@ #include #include +#include #include #include #include @@ -552,7 +553,7 @@ static int const_execvp(const char *file, const char *const *argv) { -#define UNCONST(a) ((void *)(unsigned long)(const void *)(a)) +#define UNCONST(a) ((void *)(uintptr_t)(const void *)(a)) return execvp(file, UNCONST(argv)); #undef UNCONST } diff --git a/atf-c/detail/test_helpers.h b/atf-c/detail/test_helpers.h index a601c293ffe4..90841f803c59 100644 --- a/atf-c/detail/test_helpers.h +++ b/atf-c/detail/test_helpers.h @@ -33,6 +33,7 @@ #include *** 969 LINES SKIPPED ***