Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/atf/dist Fix merge conflicts after import of at...



details:   https://anonhg.NetBSD.org/src/rev/931cd45d3af0
branches:  trunk
changeset: 784960:931cd45d3af0
user:      jmmv <jmmv%NetBSD.org@localhost>
date:      Fri Feb 15 17:07:59 2013 +0000

description:
Fix merge conflicts after import of atf 0.17.

diffstat:

 external/bsd/atf/dist/atf-c++/detail/process.hpp       |    5 +-
 external/bsd/atf/dist/atf-c++/tests.cpp                |    7 +-
 external/bsd/atf/dist/atf-c++/tests.hpp                |    4 +-
 external/bsd/atf/dist/atf-c/atf-c-api.3                |  270 ++++++++++++++++-
 external/bsd/atf/dist/atf-c/detail/process_test.c      |   40 +-
 external/bsd/atf/dist/atf-c/detail/test_helpers.c      |   67 ----
 external/bsd/atf/dist/atf-c/detail/test_helpers_test.c |  185 -----------
 external/bsd/atf/dist/atf-c/macros_test.c              |  154 +++++++-
 external/bsd/atf/dist/atf-report/atf-report.cpp        |   23 +-
 external/bsd/atf/dist/atf-run/fs.cpp                   |    3 +-
 external/bsd/atf/dist/atf-run/timer.hpp                |    4 +-
 external/bsd/atf/dist/atf-sh/atf-check.cpp             |    4 +-
 external/bsd/atf/dist/atf-sh/atf-check_test.sh         |   12 +-
 external/bsd/atf/dist/doc/atf-test-case.4              |    2 +-
 external/bsd/atf/dist/test-programs/fork_test.sh       |   64 ----
 15 files changed, 446 insertions(+), 398 deletions(-)

diffs (truncated from 1296 to 300 lines):

diff -r 5d0367cf0d1f -r 931cd45d3af0 external/bsd/atf/dist/atf-c++/detail/process.hpp
--- a/external/bsd/atf/dist/atf-c++/detail/process.hpp  Fri Feb 15 17:07:09 2013 +0000
+++ b/external/bsd/atf/dist/atf-c++/detail/process.hpp  Fri Feb 15 17:07:59 2013 +0000
@@ -41,11 +41,10 @@
 #include <string>
 #include <vector>
 
+#include "auto_array.hpp"
 #include "exceptions.hpp"
 #include "fs.hpp"
 
-#include "../utils.hpp"
-
 namespace atf {
 namespace process {
 
@@ -64,7 +63,7 @@
     // std::tr1::shared_array instead when it becomes widely available.
     // The reason would be to remove all copy constructors and assignment
     // operators from this class.
-    utils::auto_array< const char* > m_exec_argv;
+    auto_array< const char* > m_exec_argv;
     void ctor_init_exec_argv(void);
 
 public:
diff -r 5d0367cf0d1f -r 931cd45d3af0 external/bsd/atf/dist/atf-c++/tests.cpp
--- a/external/bsd/atf/dist/atf-c++/tests.cpp   Fri Feb 15 17:07:09 2013 +0000
+++ b/external/bsd/atf/dist/atf-c++/tests.cpp   Fri Feb 15 17:07:59 2013 +0000
@@ -55,9 +55,11 @@
 #include "atf-c/utils.h"
 }
 
+#include "noncopyable.hpp"
 #include "tests.hpp"
 
 #include "detail/application.hpp"
+#include "detail/auto_array.hpp"
 #include "detail/env.hpp"
 #include "detail/exceptions.hpp"
 #include "detail/fs.hpp"
@@ -127,7 +129,7 @@
 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::utils::noncopyable {
+struct impl::tc_impl : atf::noncopyable {
     std::string m_ident;
     atf_tc_t m_tc;
     bool m_has_cleanup;
@@ -190,8 +192,7 @@
 {
     atf_error_t err;
 
-    utils::auto_array< const char * > array(
-        new const char*[(config.size() * 2) + 1]);
+    auto_array< const char * > array(new const char*[(config.size() * 2) + 1]);
     const char **ptr = array.get();
     for (vars_map::const_iterator iter = config.begin();
          iter != config.end(); iter++) {
diff -r 5d0367cf0d1f -r 931cd45d3af0 external/bsd/atf/dist/atf-c++/tests.hpp
--- a/external/bsd/atf/dist/atf-c++/tests.hpp   Fri Feb 15 17:07:09 2013 +0000
+++ b/external/bsd/atf/dist/atf-c++/tests.hpp   Fri Feb 15 17:07:59 2013 +0000
@@ -38,7 +38,7 @@
 #include <atf-c/defs.h>
 }
 
-#include <atf-c++/utils.hpp>
+#include <atf-c++/noncopyable.hpp>
 
 namespace atf {
 namespace tests {
@@ -74,7 +74,7 @@
 
 struct tc_impl;
 
-class tc : utils::noncopyable {
+class tc : noncopyable {
     std::auto_ptr< tc_impl > pimpl;
 
 protected:
diff -r 5d0367cf0d1f -r 931cd45d3af0 external/bsd/atf/dist/atf-c/atf-c-api.3
--- a/external/bsd/atf/dist/atf-c/atf-c-api.3   Fri Feb 15 17:07:09 2013 +0000
+++ b/external/bsd/atf/dist/atf-c/atf-c-api.3   Fri Feb 15 17:07:59 2013 +0000
@@ -26,14 +26,17 @@
 .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd December 26, 2010
+.Dd November 30, 2012
 .Dt ATF-C-API 3
 .Os
 .Sh NAME
+.Nm atf-c-api ,
 .Nm ATF_CHECK ,
 .Nm ATF_CHECK_MSG ,
 .Nm ATF_CHECK_EQ ,
 .Nm ATF_CHECK_EQ_MSG ,
+.Nm ATF_CHECK_MATCH ,
+.Nm ATF_CHECK_MATCH_MSG ,
 .Nm ATF_CHECK_STREQ ,
 .Nm ATF_CHECK_STREQ_MSG ,
 .Nm ATF_CHECK_ERRNO ,
@@ -41,6 +44,8 @@
 .Nm ATF_REQUIRE_MSG ,
 .Nm ATF_REQUIRE_EQ ,
 .Nm ATF_REQUIRE_EQ_MSG ,
+.Nm ATF_REQUIRE_MATCH ,
+.Nm ATF_REQUIRE_MATCH_MSG ,
 .Nm ATF_REQUIRE_STREQ ,
 .Nm ATF_REQUIRE_STREQ_MSG ,
 .Nm ATF_REQUIRE_ERRNO ,
@@ -72,7 +77,19 @@
 .Nm atf_tc_fail ,
 .Nm atf_tc_fail_nonfatal ,
 .Nm atf_tc_pass ,
-.Nm atf_tc_skip
+.Nm atf_tc_skip ,
+.Nm atf_utils_cat_file ,
+.Nm atf_utils_compare_file ,
+.Nm atf_utils_copy_file ,
+.Nm atf_utils_create_file ,
+.Nm atf_utils_file_exists ,
+.Nm atf_utils_fork ,
+.Nm atf_utils_free_charpp ,
+.Nm atf_utils_grep_file ,
+.Nm atf_utils_grep_string ,
+.Nm atf_utils_readline ,
+.Nm atf_utils_redirect ,
+.Nm atf_utils_wait
 .Nd C API to write ATF-based test programs
 .Sh SYNOPSIS
 .In atf-c.h
@@ -80,6 +97,8 @@
 .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_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"
@@ -87,6 +106,8 @@
 .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_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"
@@ -119,6 +140,67 @@
 .Fn atf_tc_fail_nonfatal "reason"
 .Fn atf_tc_pass
 .Fn atf_tc_skip "reason"
+.Ft void
+.Fo atf_utils_cat_file
+.Fa "const char *file"
+.Fa "const char *prefix"
+.Fc
+.Ft bool
+.Fo atf_utils_compare_file
+.Fa "const char *file"
+.Fa "const char *contents"
+.Fc
+.Ft void
+.Fo atf_utils_copy_file
+.Fa "const char *source"
+.Fa "const char *destination"
+.Fc
+.Ft void
+.Fo atf_utils_create_file
+.Fa "const char *file"
+.Fa "const char *contents"
+.Fa "..."
+.Fc
+.Ft void
+.Fo atf_utils_file_exists
+.Fa "const char *file"
+.Fc
+.Ft pid_t
+.Fo atf_utils_fork
+.Fa "void"
+.Fc
+.Ft void
+.Fo atf_utils_free_charpp
+.Fa "char **argv"
+.Fc
+.Ft bool
+.Fo atf_utils_grep_file
+.Fa "const char *regexp"
+.Fa "const char *file"
+.Fa "..."
+.Fc
+.Ft bool
+.Fo atf_utils_grep_string
+.Fa "const char *regexp"
+.Fa "const char *str"
+.Fa "..."
+.Fc
+.Ft char *
+.Fo atf_utils_readline
+.Fa "int fd"
+.Fc
+.Ft void
+.Fo atf_utils_redirect
+.Fa "const int fd"
+.Fa "const char *file"
+.Fc
+.Ft void
+.Fo atf_utils_wait
+.Fa "const pid_t pid"
+.Fa "const int expected_exit_status"
+.Fa "const char *expected_stdout"
+.Fa "const char *expected_stderr"
+.Fc
 .Sh DESCRIPTION
 The ATF
 .Pp
@@ -417,6 +499,16 @@
 .Fn ATF_REQUIRE_EQ_MSG
 take two expressions and fail if the two evaluated values are not equal.
 .Pp
+.Fn ATF_CHECK_MATCH ,
+.Fn ATF_CHECK_MATCH_MSG ,
+.Fn ATF_REQUIRE_MATCH
+and
+.Fn ATF_REQUIRE_MATCH_MSG
+take a regular expression and a string and fail if the regular expression does
+not match the given string.
+Note that the regular expression is not anchored, so it will match anywhere in
+the string.
+.Pp
 .Fn ATF_CHECK_STREQ ,
 .Fn ATF_CHECK_STREQ_MSG ,
 .Fn ATF_REQUIRE_STREQ
@@ -433,6 +525,180 @@
 means that a call failed and
 .Va errno
 has to be checked against the first value.
+.Ss Utility functions
+The following functions are provided as part of the
+.Nm
+API to simplify the creation of a variety of tests.
+In particular, these are useful to write tests for command-line interfaces.
+.Pp
+.Ft void
+.Fo atf_utils_cat_file
+.Fa "const char *file"
+.Fa "const char *prefix"
+.Fc
+.Bd -offset indent
+Prints the contents of
+.Fa file
+to the standard output, prefixing every line with the string in
+.Fa prefix .
+.Ed
+.Pp
+.Ft bool
+.Fo atf_utils_compare_file
+.Fa "const char *file"
+.Fa "const char *contents"
+.Fc
+.Bd -offset indent
+Returns true if the given
+.Fa file
+matches exactly the expected inlined
+.Fa contents .
+.Ed
+.Pp
+.Ft void
+.Fo atf_utils_copy_file
+.Fa "const char *source"
+.Fa "const char *destination"
+.Fc
+.Bd -offset indent
+Copies the file
+.Fa source
+to
+.Fa destination .
+The permissions of the file are preserved during the code.
+.Ed
+.Pp
+.Ft void
+.Fo atf_utils_create_file
+.Fa "const char *file"
+.Fa "const char *contents"
+.Fa "..."
+.Fc
+.Bd -offset indent
+Creates
+.Fa file
+with the text given in
+.Fa contents ,
+which is a formatting string that uses the rest of the variable arguments.
+.Ed
+.Pp
+.Ft void
+.Fo atf_utils_file_exists
+.Fa "const char *file"
+.Fc



Home | Main Index | Thread Index | Old Index