CVS commit: src/external/bsd/atf/dist/atf-c

2020-07-03 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Jul  3 19:22:39 UTC 2020

Modified Files:
src/external/bsd/atf/dist/atf-c: atf-c-api.3

Log Message:
Consistent use of comma in lists.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/atf/dist/atf-c/atf-c-api.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/atf/dist/atf-c/atf-c-api.3
diff -u src/external/bsd/atf/dist/atf-c/atf-c-api.3:1.4 src/external/bsd/atf/dist/atf-c/atf-c-api.3:1.5
--- src/external/bsd/atf/dist/atf-c/atf-c-api.3:1.4	Sat Feb  8 19:13:43 2014
+++ src/external/bsd/atf/dist/atf-c/atf-c-api.3	Fri Jul  3 19:22:38 2020
@@ -276,15 +276,15 @@ In order to do so, a later registration 
 macro detailed in
 .Sx Program initialization .
 .Pp
-Later on, one must define the three parts of the body by means of three
+Later on, one must define the three parts of the test by means of three
 functions.
 Their headers are given by the
 .Fn ATF_TC_HEAD ,
-.Fn ATF_TC_BODY
+.Fn ATF_TC_BODY ,
 and
 .Fn ATF_TC_CLEANUP
 macros, all of which take the test case name provided to the
-.Fn ATF_TC
+.Fn ATF_TC ,
 .Fn ATF_TC_WITH_CLEANUP ,
 or
 .Fn ATF_TC_WITHOUT_HEAD



CVS commit: src/external/bsd/atf/dist/atf-c++/detail

2013-04-29 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Tue Apr 30 00:31:56 UTC 2013

Modified Files:
src/external/bsd/atf/dist/atf-c++/detail: parser.hpp

Log Message:
It is unclear whether cin is guaranteed to buffer the last input
character of a get() for ungetch() to work. Prefer putback() to make it
work with current implementations of cin in libc++. Tracked as
http://llvm.org/bugs/show_bug.cgi?id=15867 with test case.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r1.2 \
src/external/bsd/atf/dist/atf-c++/detail/parser.hpp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/atf/dist/atf-c++/detail/parser.hpp
diff -u src/external/bsd/atf/dist/atf-c++/detail/parser.hpp:1.1.1.2 src/external/bsd/atf/dist/atf-c++/detail/parser.hpp:1.2
--- src/external/bsd/atf/dist/atf-c++/detail/parser.hpp:1.1.1.2	Mon Jan 16 22:36:46 2012
+++ src/external/bsd/atf/dist/atf-c++/detail/parser.hpp	Tue Apr 30 00:31:56 2013
@@ -259,7 +259,7 @@ tokenizer< IS >::next(void)
 t = token(m_lineno, m_text_type, text);
 quoted = true;
 } else {
-m_is.unget();
+m_is.putback(ch);
 done = true;
 }
 } else {
@@ -271,13 +271,13 @@ tokenizer< IS >::next(void)
 t = token(m_lineno, (*idelim).second,
std::string("") + ch);
 else
-m_is.unget();
+m_is.putback(ch);
 } else if (ch == '\n') {
 done = true;
 if (text.empty())
 t = token(m_lineno, m_nl_type, "<>");
 else
-m_is.unget();
+m_is.putback(ch);
 } else if (m_skipws && (ch == ' ' || ch == '\t')) {
 if (!text.empty())
 done = true;



CVS commit: src/external/bsd/atf/dist/atf-c

2012-09-26 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Wed Sep 26 23:27:34 UTC 2012

Modified Files:
src/external/bsd/atf/dist/atf-c: atf-c-api.3

Log Message:
now sense -> no sense


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.7 -r1.2 src/external/bsd/atf/dist/atf-c/atf-c-api.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/atf/dist/atf-c/atf-c-api.3
diff -u src/external/bsd/atf/dist/atf-c/atf-c-api.3:1.1.1.7 src/external/bsd/atf/dist/atf-c/atf-c-api.3:1.2
--- src/external/bsd/atf/dist/atf-c/atf-c-api.3:1.1.1.7	Mon Jan 16 22:36:31 2012
+++ src/external/bsd/atf/dist/atf-c/atf-c-api.3	Wed Sep 26 23:27:34 2012
@@ -382,7 +382,7 @@ variant of the macros immediately abort 
 condition is detected by calling the
 .Fn atf_tc_fail
 function.
-Use this variant whenever it makes now sense to continue the execution of a
+Use this variant whenever it makes no sense to continue the execution of a
 test case when the checked condition is not met.
 The
 .Sq CHECK



CVS commit: src/external/bsd/atf/dist/atf-c

2011-11-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Nov  9 14:42:43 UTC 2011

Modified Files:
src/external/bsd/atf/dist/atf-c: tc.c

Log Message:
need || instead of &&


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/external/bsd/atf/dist/atf-c/tc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/atf/dist/atf-c/tc.c
diff -u src/external/bsd/atf/dist/atf-c/tc.c:1.10 src/external/bsd/atf/dist/atf-c/tc.c:1.11
--- src/external/bsd/atf/dist/atf-c/tc.c:1.10	Tue Nov  8 15:25:14 2011
+++ src/external/bsd/atf/dist/atf-c/tc.c	Wed Nov  9 09:42:42 2011
@@ -164,7 +164,7 @@ write_resfile(const int fd, const char *
 ssize_t ret;
 int count = 0;
 
-INV(arg == -1 && reason != NULL);
+INV(arg == -1 || reason != NULL);
 
 iov[count].iov_base = __UNCONST(result);
 iov[count++].iov_len = strlen(result);



CVS commit: src/external/bsd/atf/dist/atf-c

2011-11-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Nov  8 20:25:14 UTC 2011

Modified Files:
src/external/bsd/atf/dist/atf-c: tc.c

Log Message:
use writev(2) instead of dprintf(3) for portability. Suggested by joerg@


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/bsd/atf/dist/atf-c/tc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/atf/dist/atf-c/tc.c
diff -u src/external/bsd/atf/dist/atf-c/tc.c:1.9 src/external/bsd/atf/dist/atf-c/tc.c:1.10
--- src/external/bsd/atf/dist/atf-c/tc.c:1.9	Sun Nov  6 13:18:16 2011
+++ src/external/bsd/atf/dist/atf-c/tc.c	Tue Nov  8 15:25:14 2011
@@ -29,6 +29,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -156,24 +157,40 @@ static atf_error_t
 write_resfile(const int fd, const char *result, const int arg,
   const atf_dynstr_t *reason)
 {
-if (arg == -1 && reason == NULL) {
-if (dprintf(fd, "%s\n", result) <= 0)
-goto err;
-} else if (arg == -1 && reason != NULL) {
-if (dprintf(fd, "%s: %s\n", result,
- atf_dynstr_cstring(reason)) < 0)
-goto err;
-} else if (arg != -1 && reason != NULL) {
-if (dprintf(fd, "%s(%d): %s\n", result,
- arg, atf_dynstr_cstring(reason)) < 0)
-goto err;
-} else {
-UNREACHABLE;
+static char NL[] = "\n", CS[] = ": ";
+char buf[64];
+const char *r;
+struct iovec iov[5];
+ssize_t ret;
+int count = 0;
+
+INV(arg == -1 && reason != NULL);
+
+iov[count].iov_base = __UNCONST(result);
+iov[count++].iov_len = strlen(result);
+
+if (reason != NULL) {
+	if (arg != -1) {
+	iov[count].iov_base = buf;
+	iov[count++].iov_len = snprintf(buf, sizeof(buf), "(%d)", arg);
+	}
+
+	iov[count].iov_base = CS;
+	iov[count++].iov_len = sizeof(CS) - 1;
+
+	r = atf_dynstr_cstring(reason);
+	iov[count].iov_base = __UNCONST(r);
+	iov[count++].iov_len = strlen(r);
 }
 
-return atf_no_error();
+iov[count].iov_base = NL;
+iov[count++].iov_len = sizeof(NL) - 1;
+
+while ((ret = writev(fd, iov, count)) == -1 && errno == EINTR)
+continue; /* Retry. */
+if (ret != -1)
+return atf_no_error();
 
-err:
 return atf_libc_error(
 errno, "Failed to write results file; result %s, reason %s", result,
 reason == NULL ? "null" : atf_dynstr_cstring(reason));



CVS commit: src/external/bsd/atf/dist/atf-c

2011-11-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Nov  6 18:18:16 UTC 2011

Modified Files:
src/external/bsd/atf/dist/atf-c: tc.c

Log Message:
don't truncate error messages to 1K.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/bsd/atf/dist/atf-c/tc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/atf/dist/atf-c/tc.c
diff -u src/external/bsd/atf/dist/atf-c/tc.c:1.8 src/external/bsd/atf/dist/atf-c/tc.c:1.9
--- src/external/bsd/atf/dist/atf-c/tc.c:1.8	Sun Nov  7 12:45:21 2010
+++ src/external/bsd/atf/dist/atf-c/tc.c	Sun Nov  6 13:18:16 2011
@@ -156,28 +156,22 @@ static atf_error_t
 write_resfile(const int fd, const char *result, const int arg,
   const atf_dynstr_t *reason)
 {
-char buffer[1024];
-int ret;
-
 if (arg == -1 && reason == NULL) {
-if (snprintf(buffer, sizeof(buffer), "%s\n", result) <= 0)
+if (dprintf(fd, "%s\n", result) <= 0)
 goto err;
 } else if (arg == -1 && reason != NULL) {
-if (snprintf(buffer, sizeof(buffer), "%s: %s\n", result,
- atf_dynstr_cstring(reason)) <= 0)
+if (dprintf(fd, "%s: %s\n", result,
+ atf_dynstr_cstring(reason)) < 0)
 goto err;
 } else if (arg != -1 && reason != NULL) {
-if (snprintf(buffer, sizeof(buffer), "%s(%d): %s\n", result,
- arg, atf_dynstr_cstring(reason)) <= 0)
+if (dprintf(fd, "%s(%d): %s\n", result,
+ arg, atf_dynstr_cstring(reason)) < 0)
 goto err;
 } else {
 UNREACHABLE;
 }
 
-while ((ret = write(fd, buffer, strlen(buffer))) == -1 && errno == EINTR)
-; /* Retry. */
-if (ret != -1)
-return atf_no_error();
+return atf_no_error();
 
 err:
 return atf_libc_error(



CVS commit: src/external/bsd/atf/dist/atf-c/detail

2011-06-16 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Jun 16 14:57:22 UTC 2011

Modified Files:
src/external/bsd/atf/dist/atf-c/detail: test_helpers.c

Log Message:
Properly use a format string.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/bsd/atf/dist/atf-c/detail/test_helpers.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/atf/dist/atf-c/detail/test_helpers.c
diff -u src/external/bsd/atf/dist/atf-c/detail/test_helpers.c:1.1.1.1 src/external/bsd/atf/dist/atf-c/detail/test_helpers.c:1.2
--- src/external/bsd/atf/dist/atf-c/detail/test_helpers.c:1.1.1.1	Wed Oct 20 09:14:19 2010
+++ src/external/bsd/atf/dist/atf-c/detail/test_helpers.c	Thu Jun 16 14:57:22 2011
@@ -62,7 +62,7 @@
 atf_dynstr_fini(&iflag);
 
 if (!success)
-atf_tc_fail(failmsg);
+atf_tc_fail("%s", failmsg);
 }
 
 void



CVS commit: src/external/bsd/atf/dist/atf-c

2011-06-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jun 15 01:45:16 UTC 2011

Modified Files:
src/external/bsd/atf/dist/atf-c: defs.h.in

Log Message:
remove merge botch.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/atf/dist/atf-c/defs.h.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/atf/dist/atf-c/defs.h.in
diff -u src/external/bsd/atf/dist/atf-c/defs.h.in:1.3 src/external/bsd/atf/dist/atf-c/defs.h.in:1.4
--- src/external/bsd/atf/dist/atf-c/defs.h.in:1.3	Tue Jun 14 11:26:20 2011
+++ src/external/bsd/atf/dist/atf-c/defs.h.in	Tue Jun 14 21:45:16 2011
@@ -32,6 +32,5 @@
 
 #define ATF_DEFS_ATTRIBUTE_FORMAT_PRINTF(a, b) @ATTRIBUTE_FORMAT_PRINTF@
 #define ATF_DEFS_ATTRIBUTE_NORETURN @ATTRIBUTE_NORETURN@
-#define ATF_DEFS_ATTRIBUTE_PRINTF(a,b) @ATTRIBUTE_PRINTF(a,b)@
 
 #endif /* !defined(ATF_C_DEFS_H) */



CVS commit: src/external/bsd/atf/dist/atf-c

2011-03-24 Thread Julio Merino
Module Name:src
Committed By:   jmmv
Date:   Thu Mar 24 19:50:30 UTC 2011

Modified Files:
src/external/bsd/atf/dist/atf-c: Atffile

Log Message:
Enable the execution of pkg_config_test; it has been present for a while
and it is even being built and installed already.

Partial pull up of 0930d2c3f44a9c8fcaf0a960ab51c5e8f320684d.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r1.2 src/external/bsd/atf/dist/atf-c/Atffile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/atf/dist/atf-c/Atffile
diff -u src/external/bsd/atf/dist/atf-c/Atffile:1.1.1.2 src/external/bsd/atf/dist/atf-c/Atffile:1.2
--- src/external/bsd/atf/dist/atf-c/Atffile:1.1.1.2	Wed Oct 20 09:14:19 2010
+++ src/external/bsd/atf/dist/atf-c/Atffile	Thu Mar 24 19:50:30 2011
@@ -10,6 +10,7 @@
 tp: config_test
 tp: error_test
 tp: macros_test
+tp: pkg_config_test
 tp: tc_test
 tp: tp_test
 tp: utils_test



CVS commit: src/external/bsd/atf/dist/atf-c++

2010-07-06 Thread Julio Merino
Module Name:src
Committed By:   jmmv
Date:   Tue Jul  6 18:03:37 UTC 2010

Modified Files:
src/external/bsd/atf/dist/atf-c++: tests.cpp

Log Message:
Pull up revision 3becdd597a7f5f996eeceebf06ac7f77aaa7c30c from upstream:

Catch and report unhandled exceptions before they propagate to C land

The C++ interface to run test cases goes like this:

1) C++ run function -> 2) C run function -> 3) C++ wrapper for
test case -> 4) test case head/body/cleanup

The previous code caught and reported unhandled exceptions in 1).
However, such approach does not seem to work everywhere.  It fails,
for example, in NetBSD/i386 but works in NetBSD/amd64.  I am not sure
which platform implementation is correct nor if there even _is_ a
defined behavior.  No matter what, it feels wrong and clunky.

Move the last-resort exception catching to happen in 3) so that
exceptions don't propagate back to C.

Fixes the test-programs/result_test:result_exception test case in
NetBSD/i386 5.99.34.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/atf/dist/atf-c++/tests.cpp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/atf/dist/atf-c++/tests.cpp
diff -u src/external/bsd/atf/dist/atf-c++/tests.cpp:1.3 src/external/bsd/atf/dist/atf-c++/tests.cpp:1.4
--- src/external/bsd/atf/dist/atf-c++/tests.cpp:1.3	Sat Jul  3 08:11:25 2010
+++ src/external/bsd/atf/dist/atf-c++/tests.cpp	Tue Jul  6 18:03:37 2010
@@ -119,27 +119,49 @@
 void
 impl::tc::wrap_head(atf_tc_t *tc)
 {
-std::map< atf_tc_t*, impl::tc* >::iterator iter = wraps.find(tc);
-INV(iter != wraps.end());
-(*iter).second->head();
+try {
+std::map< atf_tc_t*, impl::tc* >::iterator iter = wraps.find(tc);
+INV(iter != wraps.end());
+(*iter).second->head();
+} catch (const std::exception& e) {
+std::cerr << "Caught unhandled exception: " + std::string(e.what());
+	std::abort();
+} catch (...) {
+std::cerr << "Caught unknown exception";
+	std::abort();
+}
 }
 
 void
 impl::tc::wrap_body(const atf_tc_t *tc)
 {
-std::map< const atf_tc_t*, const impl::tc* >::const_iterator iter =
-cwraps.find(tc);
-INV(iter != cwraps.end());
-(*iter).second->body();
+try {
+std::map< const atf_tc_t*, const impl::tc* >::const_iterator iter =
+cwraps.find(tc);
+INV(iter != cwraps.end());
+(*iter).second->body();
+} catch (const std::exception& e) {
+fail("Caught unhandled exception: " + std::string(e.what()));
+} catch (...) {
+fail("Caught unknown exception");
+}
 }
 
 void
 impl::tc::wrap_cleanup(const atf_tc_t *tc)
 {
-std::map< const atf_tc_t*, const impl::tc* >::const_iterator iter =
-cwraps.find(tc);
-INV(iter != cwraps.end());
-(*iter).second->cleanup();
+try {
+std::map< const atf_tc_t*, const impl::tc* >::const_iterator iter =
+cwraps.find(tc);
+INV(iter != cwraps.end());
+(*iter).second->cleanup();
+} catch (const std::exception& e) {
+std::cerr << "Caught unhandled exception: " + std::string(e.what());
+	std::abort();
+} catch (...) {
+std::cerr << "Caught unknown exception";
+	std::abort();
+}
 }
 
 impl::tc::tc(const std::string& ident, const bool has_cleanup) :
@@ -251,15 +273,9 @@
 impl::tc::run(const fs::path& resfile)
 const
 {
-try {
-atf_error_t err = atf_tc_run(&m_tc, resfile.c_path());
-if (atf_is_error(err))
-throw_atf_error(err);
-} catch (const std::exception& e) {
-fail("Caught unhandled exception: " + std::string(e.what()));
-} catch (...) {
-fail("Caught unknown exception");
-}
+atf_error_t err = atf_tc_run(&m_tc, resfile.c_path());
+if (atf_is_error(err))
+throw_atf_error(err);
 }
 
 void



CVS commit: src/external/bsd/atf/dist/atf-c

2009-04-14 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Apr 14 15:41:11 UTC 2009

Modified Files:
src/external/bsd/atf/dist/atf-c: tc.c

Log Message:
Instead of printing the status value from wait(), decode it into
more human-readable output.

reviewed by jmmv


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/atf/dist/atf-c/tc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/atf/dist/atf-c/tc.c
diff -u src/external/bsd/atf/dist/atf-c/tc.c:1.1.1.1 src/external/bsd/atf/dist/atf-c/tc.c:1.2
--- src/external/bsd/atf/dist/atf-c/tc.c:1.1.1.1	Mon Jan 19 07:11:51 2009
+++ src/external/bsd/atf/dist/atf-c/tc.c	Tue Apr 14 15:41:11 2009
@@ -404,11 +404,24 @@
 err = atf_libc_error(errno, "Error waiting for child process "
  "%d", pid);
 } else {
-if (!WIFEXITED(state) || WEXITSTATUS(state) != EXIT_SUCCESS)
-err = atf_tcr_init_reason_fmt(tcr, atf_tcr_failed_state,
-  "Test case did not exit cleanly; "
-  "state was %d", state);
-else
+if (!WIFEXITED(state) || WEXITSTATUS(state) != EXIT_SUCCESS) {
+if (WIFEXITED(state))
+err = atf_tcr_init_reason_fmt(tcr, atf_tcr_failed_state,
+ "Test case did not exit cleanly; "
+ "exit status was %d",
+ WEXITSTATUS(state));
+else if (WIFSIGNALED(state))
+err = atf_tcr_init_reason_fmt(tcr, atf_tcr_failed_state,
+ "Test case did not exit cleanly: "
+ "%s%s",
+ strsignal(WTERMSIG(state)),
+ WCOREDUMP(state) ?
+   " (core dumped)" : "");
+else
+err = atf_tcr_init_reason_fmt(tcr, atf_tcr_failed_state,
+ "Test case did not exit cleanly; "
+ "state was %d", state);
+} else
 err = get_tc_result(workdir, tcr);
 }