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

2024-07-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jul 10 19:37:41 UTC 2024

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

Log Message:
atf-c: detect accidental '=' in assertion condition

Seen several times in tests/libc/c063.


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

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/macros.h
diff -u src/external/bsd/atf/dist/atf-c/macros.h:1.1.1.8 src/external/bsd/atf/dist/atf-c/macros.h:1.2
--- src/external/bsd/atf/dist/atf-c/macros.h:1.1.1.8	Fri Feb 15 17:04:15 2013
+++ src/external/bsd/atf/dist/atf-c/macros.h	Wed Jul 10 19:37:41 2024
@@ -133,25 +133,25 @@
 
 #define ATF_REQUIRE_MSG(x, fmt, ...) \
 do { \
-if (!(x)) \
+if (x) {} else \
 atf_tc_fail_requirement(__FILE__, __LINE__, fmt, ##__VA_ARGS__); \
 } while(0)
 
 #define ATF_CHECK_MSG(x, fmt, ...) \
 do { \
-if (!(x)) \
+if (x) {} else \
 atf_tc_fail_check(__FILE__, __LINE__, fmt, ##__VA_ARGS__); \
 } while(0)
 
 #define ATF_REQUIRE(x) \
 do { \
-if (!(x)) \
+if (x) {} else \
 atf_tc_fail_requirement(__FILE__, __LINE__, "%s", #x " not met"); \
 } while(0)
 
 #define ATF_CHECK(x) \
 do { \
-if (!(x)) \
+if (x) {} else \
 atf_tc_fail_check(__FILE__, __LINE__, "%s", #x " not met"); \
 } while(0)
 



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

2024-07-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jul 10 19:37:41 UTC 2024

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

Log Message:
atf-c: detect accidental '=' in assertion condition

Seen several times in tests/libc/c063.


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

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



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

2023-03-13 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Tue Mar 14 00:55:31 UTC 2023

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

Log Message:
atf-c-api.3: correct ATF_TP_ADD_TC() examples to use "tp"


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 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.5 src/external/bsd/atf/dist/atf-c/atf-c-api.3:1.6
--- src/external/bsd/atf/dist/atf-c/atf-c-api.3:1.5	Fri Jul  3 19:22:38 2020
+++ src/external/bsd/atf/dist/atf-c/atf-c-api.3	Tue Mar 14 00:55:31 2023
@@ -26,7 +26,7 @@
 .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd November 15, 2013
+.Dd March 14, 2023
 .Dt ATF-C-API 3
 .Os
 .Sh NAME
@@ -243,9 +243,9 @@ ATF_TC_BODY(tc3, tc)
 
 ATF_TP_ADD_TCS(tp)
 {
-ATF_TP_ADD_TC(tcs, tc1);
-ATF_TP_ADD_TC(tcs, tc2);
-ATF_TP_ADD_TC(tcs, tc3);
+ATF_TP_ADD_TC(tp, tc1);
+ATF_TP_ADD_TC(tp, tc2);
+ATF_TP_ADD_TC(tp, tc3);
 ... add additional test cases ...
 
 return atf_no_error();



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

2023-03-13 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Tue Mar 14 00:55:31 UTC 2023

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

Log Message:
atf-c-api.3: correct ATF_TP_ADD_TC() examples to use "tp"


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 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.



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

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.



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, NEWLINE);
 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++/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.



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

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.



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

2011-11-09 Thread Julio Merino

On 11/9/11 9:42 AM, Christos Zoulas wrote:

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


Thanks; it seems to work now.


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);



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

2011-11-08 Thread Christos Zoulas
In article 2007202432.ga7...@britannica.bec.de,
Joerg Sonnenberger  jo...@britannica.bec.de wrote:
On Mon, Nov 07, 2011 at 04:06:30PM +, Christos Zoulas wrote:
 Well, I tried to print the failing pattern in t_expand, and it silently
 got truncated. dprintf(3) has been part of TOG since 2006:
 (http://pubs.opengroup.org/onlinepubs/9699919799/functions/dprintf.html)
 So it would be preferable to implement it in terms of asprintf/write +
 or snprintf/malloc/write or even fdopen/fprintf instead of open coding it.

From reading the patch, there are three different brances, right?
Why don't you use writev for this with up to 6 elements in the vector?

Done.

christos



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

2011-11-08 Thread Julio Merino
On 11/8/11 3:25 PM, Christos Zoulas wrote:
 In article 2007202432.ga7...@britannica.bec.de,
 Joerg Sonnenberger  jo...@britannica.bec.de wrote:
 On Mon, Nov 07, 2011 at 04:06:30PM +, Christos Zoulas wrote:
 Well, I tried to print the failing pattern in t_expand, and it silently
 got truncated. dprintf(3) has been part of TOG since 2006:
 (http://pubs.opengroup.org/onlinepubs/9699919799/functions/dprintf.html)
 So it would be preferable to implement it in terms of asprintf/write +
 or snprintf/malloc/write or even fdopen/fprintf instead of open coding it.

From reading the patch, there are three different brances, right?
 Why don't you use writev for this with up to 6 elements in the vector?
 
 Done.

Did you even run any tests after doing this?

This is broken.  The assertion you added triggers immediately.

-- 
Julio Merino / @jmmv


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

2011-11-08 Thread Christos Zoulas
On Nov 8,  6:48pm, j...@netbsd.org (Julio Merino) wrote:
-- Subject: Re: CVS commit: src/external/bsd/atf/dist/atf-c

| On 11/8/11 3:25 PM, Christos Zoulas wrote:
|  In article 2007202432.ga7...@britannica.bec.de,
|  Joerg Sonnenberger  jo...@britannica.bec.de wrote:
|  On Mon, Nov 07, 2011 at 04:06:30PM +, Christos Zoulas wrote:
|  Well, I tried to print the failing pattern in t_expand, and it silently
|  got truncated. dprintf(3) has been part of TOG since 2006:
|  (http://pubs.opengroup.org/onlinepubs/9699919799/functions/dprintf.html)
|  So it would be preferable to implement it in terms of asprintf/write +
|  or snprintf/malloc/write or even fdopen/fprintf instead of open coding it.
| 
| From reading the patch, there are three different brances, right?
|  Why don't you use writev for this with up to 6 elements in the vector?
|  
|  Done.
| 
| Did you even run any tests after doing this?
| 
| This is broken.  The assertion you added triggers immediately.

Yes, I did. I actually wrote the test backwards 2ice because INV has inverted
logic than regular assert for some reason.

christos


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

2011-11-08 Thread Julio Merino
On 11/8/11 7:32 PM, Christos Zoulas wrote:
 Yes, I did. I actually wrote the test backwards 2ice because INV has inverted
 logic than regular assert for some reason.

It doesn't.  INV(x) is the same as assert(x) -- or it is supposed to be
-- but if it wasn't, things would have broken much earlier everywhere.

-- 
Julio Merino / @jmmv


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 sys/types.h
 #include sys/stat.h
+#include sys/uio.h
 
 #include errno.h
 #include fcntl.h
@@ -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));



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

2011-11-07 Thread Julio Merino

On 11/6/11 1:18 PM, Christos Zoulas wrote:

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.


The use of dprintf cannot be merged back upstream because this function 
does not appear to be widely available.  A bunch of write()s should have 
the same effect and remove the 1K limit; will do this.


Anyway, where have you spot error messages longer than 1K?  That 
seems... ugly.


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

2011-11-07 Thread Christos Zoulas
In article 4eb7f47c.4040...@netbsd.org,
Julio Merino  j...@netbsd.org wrote:
On 11/6/11 1:18 PM, Christos Zoulas wrote:
 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.

The use of dprintf cannot be merged back upstream because this function 
does not appear to be widely available.  A bunch of write()s should have 
the same effect and remove the 1K limit; will do this.

Anyway, where have you spot error messages longer than 1K?  That 
seems... ugly.

Well, I tried to print the failing pattern in t_expand, and it silently
got truncated. dprintf(3) has been part of TOG since 2006:
(http://pubs.opengroup.org/onlinepubs/9699919799/functions/dprintf.html)
So it would be preferable to implement it in terms of asprintf/write +
or snprintf/malloc/write or even fdopen/fprintf instead of open coding it.

christos



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

2011-11-07 Thread Joerg Sonnenberger
On Mon, Nov 07, 2011 at 04:06:30PM +, Christos Zoulas wrote:
 Well, I tried to print the failing pattern in t_expand, and it silently
 got truncated. dprintf(3) has been part of TOG since 2006:
 (http://pubs.opengroup.org/onlinepubs/9699919799/functions/dprintf.html)
 So it would be preferable to implement it in terms of asprintf/write +
 or snprintf/malloc/write or even fdopen/fprintf instead of open coding it.

From reading the patch, there are three different brances, right?
Why don't you use writev for this with up to 6 elements in the vector?

Joerg


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

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.



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

2011-06-16 Thread Julio Merino
On 6/16/11 3:57 PM, Joerg Sonnenberger wrote:
 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.

I presume you found this with clang, right?  I only hit the issue in OS
X and didn't bother to pull it up to NetBSD because gcc did not
encounter the problem.

Thanks!

-- 
Julio Merino / @jmmv


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/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.



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-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.



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++

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.