Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Feb 2014 19:33:17 +0000 (UTC)
From:      Julio Merino <jmmv@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r261897 - in head: contrib/atf contrib/atf/atf-c contrib/atf/atf-c++ contrib/atf/atf-c++/detail contrib/atf/atf-c/detail contrib/atf/atf-sh contrib/atf/doc lib/atf/libatf-c++ lib/atf/li...
Message-ID:  <201402141933.s1EJXHVu097363@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jmmv
Date: Fri Feb 14 19:33:16 2014
New Revision: 261897
URL: http://svnweb.freebsd.org/changeset/base/261897

Log:
  MFV: Import atf-0.20.

Added:
  head/contrib/atf/atf-c++/detail/version_helper.cpp
     - copied unchanged from r261889, vendor/atf/dist/atf-c++/detail/version_helper.cpp
  head/contrib/atf/atf-c/detail/version_helper.c
     - copied unchanged from r261889, vendor/atf/dist/atf-c/detail/version_helper.c
Deleted:
  head/contrib/atf/atf-c++/detail/expand.cpp
  head/contrib/atf/atf-c++/detail/expand.hpp
  head/contrib/atf/atf-c++/detail/expand_test.cpp
  head/contrib/atf/atf-c++/detail/parser.cpp
  head/contrib/atf/atf-c++/detail/parser.hpp
  head/contrib/atf/atf-c++/detail/parser_test.cpp
  head/contrib/atf/atf-c++/detail/ui.cpp
  head/contrib/atf/atf-c++/detail/ui.hpp
  head/contrib/atf/atf-c++/detail/ui_test.cpp
  head/contrib/atf/atf-c++/noncopyable.hpp
Modified:
  head/contrib/atf/FREEBSD-Xlist
  head/contrib/atf/Kyuafile
  head/contrib/atf/NEWS
  head/contrib/atf/README
  head/contrib/atf/atf-c++/check.hpp
  head/contrib/atf/atf-c++/config.cpp
  head/contrib/atf/atf-c++/config_test.cpp
  head/contrib/atf/atf-c++/detail/Kyuafile
  head/contrib/atf/atf-c++/detail/application.cpp
  head/contrib/atf/atf-c++/detail/application.hpp
  head/contrib/atf/atf-c++/detail/application_test.cpp
  head/contrib/atf/atf-c++/detail/exceptions.hpp
  head/contrib/atf/atf-c++/detail/test_helpers.cpp
  head/contrib/atf/atf-c++/detail/test_helpers.hpp
  head/contrib/atf/atf-c++/macros_test.cpp
  head/contrib/atf/atf-c++/pkg_config_test.sh
  head/contrib/atf/atf-c++/tests.cpp
  head/contrib/atf/atf-c++/tests.hpp
  head/contrib/atf/atf-c++/tests_test.cpp
  head/contrib/atf/atf-c/config.c
  head/contrib/atf/atf-c/config_test.c
  head/contrib/atf/atf-c/detail/test_helpers.c
  head/contrib/atf/atf-c/detail/test_helpers.h
  head/contrib/atf/atf-c/macros_test.c
  head/contrib/atf/atf-c/pkg_config_test.sh
  head/contrib/atf/atf-sh/atf-check.cpp
  head/contrib/atf/atf-sh/atf-sh.cpp
  head/contrib/atf/atf-sh/atf_check_test.sh
  head/contrib/atf/atf-sh/integration_test.sh
  head/contrib/atf/bconfig.h
  head/contrib/atf/doc/atf-test-case.4
  head/lib/atf/libatf-c++/Makefile
  head/lib/atf/libatf-c++/tests/detail/Makefile
  head/lib/atf/libatf-c/tests/detail/Makefile
  head/tools/build/mk/OptionalObsoleteFiles.inc
Directory Properties:
  head/contrib/atf/   (props changed)

Modified: head/contrib/atf/FREEBSD-Xlist
==============================================================================
--- head/contrib/atf/FREEBSD-Xlist	Fri Feb 14 17:47:18 2014	(r261896)
+++ head/contrib/atf/FREEBSD-Xlist	Fri Feb 14 19:33:16 2014	(r261897)
@@ -18,3 +18,4 @@ configure*
 doc/atf-formats.5
 doc/atf.7.in
 m4/
+tools/

Modified: head/contrib/atf/Kyuafile
==============================================================================
--- head/contrib/atf/Kyuafile	Fri Feb 14 17:47:18 2014	(r261896)
+++ head/contrib/atf/Kyuafile	Fri Feb 14 19:33:16 2014	(r261897)
@@ -6,13 +6,3 @@ include("atf-c/Kyuafile")
 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")
-end

Modified: head/contrib/atf/NEWS
==============================================================================
--- head/contrib/atf/NEWS	Fri Feb 14 17:47:18 2014	(r261896)
+++ head/contrib/atf/NEWS	Fri Feb 14 19:33:16 2014	(r261897)
@@ -2,6 +2,51 @@ Major changes between releases          
 ===========================================================================
 
 
+Changes in version 0.20
+***********************
+
+Experimental version released on February 7th, 2014.
+
+This is the first release without the code for the deprecated tools.  If
+you require such code, please fetch a copy of the 0.19 release and extract
+the 'tools' directory for your own consumption.
+
+* Removed the deprecated tools.  This includes atf-config, atf-report,
+  atf-run and atf-version.
+
+
+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
 ***********************
 

Modified: head/contrib/atf/README
==============================================================================
--- head/contrib/atf/README	Fri Feb 14 17:47:18 2014	(r261896)
+++ head/contrib/atf/README	Fri Feb 14 19:33:16 2014	(r261897)
@@ -5,21 +5,18 @@ Introductory information                
 Introduction
 ************
 
-The Automated Testing Framework (ATF) is a collection of libraries and
-utilities designed to ease unattended application testing in the hands of
-developers and end users of a specific piece of software.
-
-As regards developers, ATF provides the necessary means to easily create
-test suites composed of multiple test programs, which in turn are a
-collection of test cases.  It also attempts to simplify the debugging of
-problems when these test cases detect an error by providing as much
-information as possible about the failure.
-
-As regards users, it simplifies the process of running the test suites and,
-in special, encourages end users to run them often: they do not need to
-have source trees around nor any other development tools installed to be
-able to certify that a given piece of software works on their machine as
-advertised.
+The Automated Testing Framework (ATF) is a collection of libraries to
+implement test programs in a variety of languages.  At the moment, ATF
+offers C, C++ and POSIX shell bindings with which to implement tests.
+These bindings all offer a similar set of functionality and any test
+program written with them exposes a consistent user interface.
+
+ATF-based test programs rely on a separate runtime engine to execute them.
+The runtime engine is in charge of isolating the test programs from the
+rest of the system to ensure that their results are deterministic and that
+they cannot affect the running system.  The runtime engine is also
+responsible for gathering the results of all tests and composing reports.
+The current runtime of choice is Kyua.
 
 
 Other documents

Modified: head/contrib/atf/atf-c++/check.hpp
==============================================================================
--- head/contrib/atf/atf-c++/check.hpp	Fri Feb 14 17:47:18 2014	(r261896)
+++ head/contrib/atf/atf-c++/check.hpp	Fri Feb 14 19:33:16 2014	(r261897)
@@ -39,8 +39,6 @@ extern "C" {
 #include <string>
 #include <vector>
 
-#include <atf-c++/noncopyable.hpp>
-
 namespace atf {
 
 namespace process {
@@ -60,7 +58,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.
     //!

Modified: head/contrib/atf/atf-c++/config.cpp
==============================================================================
--- head/contrib/atf/atf-c++/config.cpp	Fri Feb 14 17:47:18 2014	(r261896)
+++ head/contrib/atf/atf-c++/config.cpp	Fri Feb 14 19:33:16 2014	(r261897)
@@ -52,18 +52,14 @@ init_variables(void)
 {
     PRE(m_variables.empty());
 
-    m_variables["atf_arch"] = atf_config_get("atf_arch");
     m_variables["atf_build_cc"] = atf_config_get("atf_build_cc");
     m_variables["atf_build_cflags"] = atf_config_get("atf_build_cflags");
     m_variables["atf_build_cpp"] = atf_config_get("atf_build_cpp");
     m_variables["atf_build_cppflags"] = atf_config_get("atf_build_cppflags");
     m_variables["atf_build_cxx"] = atf_config_get("atf_build_cxx");
     m_variables["atf_build_cxxflags"] = atf_config_get("atf_build_cxxflags");
-    m_variables["atf_confdir"] = atf_config_get("atf_confdir");
     m_variables["atf_includedir"] = atf_config_get("atf_includedir");
-    m_variables["atf_libdir"] = atf_config_get("atf_libdir");
     m_variables["atf_libexecdir"] = atf_config_get("atf_libexecdir");
-    m_variables["atf_machine"] = atf_config_get("atf_machine");
     m_variables["atf_pkgdatadir"] = atf_config_get("atf_pkgdatadir");
     m_variables["atf_shell"] = atf_config_get("atf_shell");
     m_variables["atf_workdir"] = atf_config_get("atf_workdir");

Modified: head/contrib/atf/atf-c++/config_test.cpp
==============================================================================
--- head/contrib/atf/atf-c++/config_test.cpp	Fri Feb 14 17:47:18 2014	(r261896)
+++ head/contrib/atf/atf-c++/config_test.cpp	Fri Feb 14 19:33:16 2014	(r261897)
@@ -44,18 +44,14 @@ static struct varnames {
     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 },

Modified: head/contrib/atf/atf-c++/detail/Kyuafile
==============================================================================
--- head/contrib/atf/atf-c++/detail/Kyuafile	Fri Feb 14 17:47:18 2014	(r261896)
+++ head/contrib/atf/atf-c++/detail/Kyuafile	Fri Feb 14 19:33:16 2014	(r261897)
@@ -6,9 +6,7 @@ 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="process_test"}
 atf_test_program{name="sanity_test"}
 atf_test_program{name="text_test"}
-atf_test_program{name="ui_test"}

Modified: head/contrib/atf/atf-c++/detail/application.cpp
==============================================================================
--- head/contrib/atf/atf-c++/detail/application.cpp	Fri Feb 14 17:47:18 2014	(r261896)
+++ head/contrib/atf/atf-c++/detail/application.cpp	Fri Feb 14 19:33:16 2014	(r261897)
@@ -47,7 +47,6 @@ extern "C" {
 
 #include "application.hpp"
 #include "sanity.hpp"
-#include "ui.hpp"
 
 #if !defined(HAVE_VSNPRINTF_IN_STD)
 namespace std {
@@ -106,17 +105,12 @@ impl::option::operator<(const impl::opti
 }
 
 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 +127,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 +177,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 +199,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 +230,22 @@ impl::app::run(int argc, char* const* ar
 
     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;

Modified: head/contrib/atf/atf-c++/detail/application.hpp
==============================================================================
--- head/contrib/atf/atf-c++/detail/application.hpp	Fri Feb 14 17:47:18 2014	(r261896)
+++ head/contrib/atf/atf-c++/detail/application.hpp	Fri Feb 14 19:33:16 2014	(r261897)
@@ -74,8 +74,6 @@ public:
 // ------------------------------------------------------------------------
 
 class app {
-    bool m_hflag;
-
     void process_options(void);
     void usage(std::ostream&);
 
@@ -90,8 +88,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 +99,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*);

Modified: head/contrib/atf/atf-c++/detail/application_test.cpp
==============================================================================
--- head/contrib/atf/atf-c++/detail/application_test.cpp	Fri Feb 14 17:47:18 2014	(r261896)
+++ head/contrib/atf/atf-c++/detail/application_test.cpp	Fri Feb 14 19:33:16 2014	(r261897)
@@ -37,7 +37,7 @@ extern "C" {
 
 class getopt_app : public atf::application::app {
 public:
-    getopt_app(void) : app("description", "manpage", "other") {}
+    getopt_app(void) : app("description", "manpage") {}
 
     int main(void)
     {

Modified: head/contrib/atf/atf-c++/detail/exceptions.hpp
==============================================================================
--- head/contrib/atf/atf-c++/detail/exceptions.hpp	Fri Feb 14 17:47:18 2014	(r261896)
+++ head/contrib/atf/atf-c++/detail/exceptions.hpp	Fri Feb 14 19:33:16 2014	(r261897)
@@ -39,47 +39,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;

Modified: head/contrib/atf/atf-c++/detail/test_helpers.cpp
==============================================================================
--- head/contrib/atf/atf-c++/detail/test_helpers.cpp	Fri Feb 14 17:47:18 2014	(r261896)
+++ head/contrib/atf/atf-c++/detail/test_helpers.cpp	Fri Feb 14 19:33:16 2014	(r261897)
@@ -52,28 +52,24 @@ static const char* atf_c_tests_base = NU
 #endif
 #undef ATF_C_TESTS_BASE
 
-void
-build_check_cxx_o_aux(const atf::fs::path& sfile, const char* failmsg,
-                      const bool expect_pass)
+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("-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
@@ -86,7 +82,8 @@ header_check(const char *hdrname)
 
     const std::string failmsg = std::string("Header check failed; ") +
         hdrname + " is not self-contained";
-    build_check_cxx_o_aux(atf::fs::path("test.cpp"), failmsg.c_str(), true);
+    if (!build_check_cxx_o("test.cpp"))
+        ATF_FAIL(failmsg);
 }
 
 atf::fs::path
@@ -104,37 +101,3 @@ get_process_helpers_path(const atf::test
         return atf::fs::path(atf_c_tests_base) / helper;
     }
 }
-
-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");
-    }
-}

Modified: head/contrib/atf/atf-c++/detail/test_helpers.hpp
==============================================================================
--- head/contrib/atf/atf-c++/detail/test_helpers.hpp	Fri Feb 14 17:47:18 2014	(r261896)
+++ head/contrib/atf/atf-c++/detail/test_helpers.hpp	Fri Feb 14 19:33:16 2014	(r261897)
@@ -40,9 +40,7 @@
 
 #include "../macros.hpp"
 #include "../tests.hpp"
-#include "parser.hpp"
 #include "process.hpp"
-#include "text.hpp"
 
 #define HEADER_TC(name, hdrname) \
     ATF_TEST_CASE(name); \
@@ -64,18 +62,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,7 +73,8 @@ class tc;
 }
 
 void header_check(const char*);
-void build_check_cxx_o(const atf::tests::tc&, const char*, const char*, bool);
+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 {
@@ -120,45 +109,3 @@ run_h_tc(atf::tests::vars_map config = a
     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);
-}

Copied: head/contrib/atf/atf-c++/detail/version_helper.cpp (from r261889, vendor/atf/dist/atf-c++/detail/version_helper.cpp)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/contrib/atf/atf-c++/detail/version_helper.cpp	Fri Feb 14 19:33:16 2014	(r261897, copy of r261889, vendor/atf/dist/atf-c++/detail/version_helper.cpp)
@@ -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 "bconfig.h"
+#endif
+
+#include <cstdlib>
+#include <iostream>
+
+int
+main(void)
+{
+    std::cout << PACKAGE_VERSION << "\n";
+    return EXIT_SUCCESS;
+}

Modified: head/contrib/atf/atf-c++/macros_test.cpp
==============================================================================
--- head/contrib/atf/atf-c++/macros_test.cpp	Fri Feb 14 17:47:18 2014	(r261896)
+++ head/contrib/atf/atf-c++/macros_test.cpp	Fri Feb 14 19:33:16 2014	(r261897)
@@ -763,11 +763,30 @@ BUILD_TC(use, "macros_hpp_test.cpp",
          "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.

Modified: head/contrib/atf/atf-c++/pkg_config_test.sh
==============================================================================
--- head/contrib/atf/atf-c++/pkg_config_test.sh	Fri Feb 14 17:47:18 2014	(r261896)
+++ head/contrib/atf/atf-c++/pkg_config_test.sh	Fri Feb 14 19:33:16 2014	(r261897)
@@ -43,10 +43,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)
@@ -59,7 +57,7 @@ atf_test_case version
 version_head()
 {
     atf_set "descr" "Checks that the version in atf-c++ is correct"
-    atf_set "require.progs" "atf-version pkg-config"
+    atf_set "require.progs" "pkg-config"
 }
 version_body()
 {

Modified: head/contrib/atf/atf-c++/tests.cpp
==============================================================================
--- head/contrib/atf/atf-c++/tests.cpp	Fri Feb 14 17:47:18 2014	(r261896)
+++ head/contrib/atf/atf-c++/tests.cpp	Fri Feb 14 19:33:16 2014	(r261897)
@@ -55,7 +55,6 @@ extern "C" {
 #include "atf-c/utils.h"
 }
 
-#include "noncopyable.hpp"
 #include "tests.hpp"
 
 #include "detail/application.hpp"
@@ -63,7 +62,6 @@ extern "C" {
 #include "detail/env.hpp"
 #include "detail/exceptions.hpp"
 #include "detail/fs.hpp"
-#include "detail/parser.hpp"
 #include "detail/sanity.hpp"
 #include "detail/text.hpp"
 
@@ -79,12 +77,7 @@ detail::atf_tp_writer::atf_tp_writer(std
     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
@@ -129,7 +122,13 @@ detail::match(const std::string& regexp,
 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;
@@ -435,7 +434,7 @@ 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),
+    app(m_description, "atf-test-program(1)"),
     m_lflag(false),
     m_resfile("/dev/stdout"),
     m_srcdir("."),

Modified: head/contrib/atf/atf-c++/tests.hpp
==============================================================================
--- head/contrib/atf/atf-c++/tests.hpp	Fri Feb 14 17:47:18 2014	(r261896)
+++ head/contrib/atf/atf-c++/tests.hpp	Fri Feb 14 19:33:16 2014	(r261897)
@@ -38,8 +38,6 @@ extern "C" {
 #include <atf-c/defs.h>
 }
 
-#include <atf-c++/noncopyable.hpp>
-
 namespace atf {
 namespace tests {
 
@@ -74,7 +72,11 @@ typedef std::map< std::string, std::stri
 
 struct tc_impl;
 
-class tc : noncopyable {
+class tc {
+    // Non-copyable.
+    tc(const tc&);
+    tc& operator=(const tc&);
+
     std::auto_ptr< tc_impl > pimpl;
 
 protected:

Modified: head/contrib/atf/atf-c++/tests_test.cpp
==============================================================================
--- head/contrib/atf/atf-c++/tests_test.cpp	Fri Feb 14 17:47:18 2014	(r261896)
+++ head/contrib/atf/atf-c++/tests_test.cpp	Fri Feb 14 19:33:16 2014	(r261897)
@@ -40,8 +40,8 @@ extern "C" {
 
 #include "macros.hpp"
 
-#include "detail/parser.hpp"
 #include "detail/test_helpers.hpp"
+#include "detail/text.hpp"
 
 // ------------------------------------------------------------------------
 // Tests for the "atf_tp_writer" class.

Modified: head/contrib/atf/atf-c/config.c
==============================================================================
--- head/contrib/atf/atf-c/config.c	Fri Feb 14 17:47:18 2014	(r261896)
+++ head/contrib/atf/atf-c/config.c	Fri Feb 14 19:33:16 2014	(r261897)
@@ -45,18 +45,14 @@ static struct var {
     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, },

Modified: head/contrib/atf/atf-c/config_test.c
==============================================================================
--- head/contrib/atf/atf-c/config_test.c	Fri Feb 14 17:47:18 2014	(r261896)
+++ head/contrib/atf/atf-c/config_test.c	Fri Feb 14 19:33:16 2014	(r261897)
@@ -44,18 +44,14 @@ static struct varnames {
     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 },

Modified: head/contrib/atf/atf-c/detail/test_helpers.c
==============================================================================
--- head/contrib/atf/atf-c/detail/test_helpers.c	Fri Feb 14 17:47:18 2014	(r261896)
+++ head/contrib/atf/atf-c/detail/test_helpers.c	Fri Feb 14 19:33:16 2014	(r261897)
@@ -43,10 +43,8 @@
 #include "process.h"
 #include "test_helpers.h"
 
-static
-void
-build_check_c_o_aux(const char *path, const char *failmsg,
-                    const bool expect_pass)
+bool
+build_check_c_o(const char *path)
 {
     bool success;
     atf_dynstr_t iflag;
@@ -63,20 +61,19 @@ build_check_c_o_aux(const char *path, co
 
     atf_dynstr_fini(&iflag);
 
-    if ((expect_pass && !success) || (!expect_pass && success))
-        atf_tc_fail("%s", failmsg);
+    return success;
 }
 
-void
-build_check_c_o(const atf_tc_t *tc, const char *sfile, const char *failmsg,
-                const bool expect_pass)
+bool
+build_check_c_o_srcdir(const atf_tc_t *tc, const char *sfile)
 {
     atf_fs_path_t path;
 
     RE(atf_fs_path_init_fmt(&path, "%s/%s",
                             atf_tc_get_config_var(tc, "srcdir"), sfile));
-    build_check_c_o_aux(atf_fs_path_cstring(&path), failmsg, expect_pass);
+    const bool result = build_check_c_o(atf_fs_path_cstring(&path));
     atf_fs_path_fini(&path);
+    return result;
 }
 
 void
@@ -93,7 +90,8 @@ header_check(const char *hdrname)
     snprintf(failmsg, sizeof(failmsg),
              "Header check failed; %s is not self-contained", hdrname);
 
-    build_check_c_o_aux("test.c", failmsg, true);
+    if (!build_check_c_o("test.c"))
+        atf_tc_fail("%s", failmsg);
 }
 
 void

Modified: head/contrib/atf/atf-c/detail/test_helpers.h
==============================================================================
--- head/contrib/atf/atf-c/detail/test_helpers.h	Fri Feb 14 17:47:18 2014	(r261896)
+++ head/contrib/atf/atf-c/detail/test_helpers.h	Fri Feb 14 19:33:16 2014	(r261897)
@@ -63,21 +63,12 @@ struct atf_fs_path;
     } \
     ATF_TC_BODY(name, tc) \
     { \
-        build_check_c_o(tc, sfile, failmsg, true);   \
+        if (!build_check_c_o_srcdir(tc, sfile)) \
+            atf_tc_fail("%s", failmsg); \
     }
 
-#define BUILD_TC_FAIL(name, sfile, descr, failmsg) \
-    ATF_TC(name); \
-    ATF_TC_HEAD(name, tc) \
-    { \
-        atf_tc_set_md_var(tc, "descr", descr); \
-    } \
-    ATF_TC_BODY(name, tc) \
-    { \
-        build_check_c_o(tc, sfile, failmsg, false);   \
-    }
-
-void build_check_c_o(const atf_tc_t *, const char *, const char *, const bool);
+bool build_check_c_o(const char *);
+bool build_check_c_o_srcdir(const atf_tc_t *, const char *);
 void header_check(const char *);
 void get_process_helpers_path(const atf_tc_t *, const bool,
                               struct atf_fs_path *);

Copied: head/contrib/atf/atf-c/detail/version_helper.c (from r261889, vendor/atf/dist/atf-c/detail/version_helper.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/contrib/atf/atf-c/detail/version_helper.c	Fri Feb 14 19:33:16 2014	(r261897, copy of r261889, vendor/atf/dist/atf-c/detail/version_helper.c)
@@ -0,0 +1,43 @@
+/*
+ * 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 "bconfig.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main(void)
+{
+    printf("%s\n", PACKAGE_VERSION);
+    return EXIT_SUCCESS;
+}

Modified: head/contrib/atf/atf-c/macros_test.c
==============================================================================
--- head/contrib/atf/atf-c/macros_test.c	Fri Feb 14 17:47:18 2014	(r261896)
+++ head/contrib/atf/atf-c/macros_test.c	Fri Feb 14 19:33:16 2014	(r261897)
@@ -843,11 +843,30 @@ BUILD_TC(use, "macros_h_test.c",
          "do not cause syntax errors when used",
          "Build of macros_h_test.c failed; some macros in atf-c/macros.h "

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201402141933.s1EJXHVu097363>