Module Name:    src
Committed By:   jmmv
Date:           Wed Oct 20 09:17:24 UTC 2010

Modified Files:
        src/external/bsd/atf/dist/atf-c: tc.c
        src/external/bsd/atf/dist/atf-c++: tests.cpp tests.hpp
        src/external/bsd/atf/dist/atf-report: atf-report.cpp tests-results.css
            tests-results.xsl
        src/external/bsd/atf/dist/atf-run: atf-run.cpp test-program.cpp
            test-program.hpp
        src/external/bsd/atf/dist/atf-version: atf-version.cpp
Removed Files:
        src/external/bsd/atf/dist/atf-c: dynstr.c dynstr.h dynstr_test.c env.c
            env.h env_test.c fs.c fs.h fs_test.c list.c list.h list_test.c
            map.c map.h map_test.c process.c process.h process_helpers.c
            process_test.c sanity.c sanity.h sanity_test.c test_helpers.c
            test_helpers.h test_helpers_test.c text.c text.h text_test.c
            tp_main.c user.c user.h user_test.c
        src/external/bsd/atf/dist/atf-c++: application.cpp application.hpp
            application_test.cpp env.cpp env.hpp env_test.cpp exceptions.cpp
            exceptions.hpp exceptions_test.cpp expand.cpp expand.hpp
            expand_test.cpp fs.cpp fs.hpp fs_test.cpp io.cpp io.hpp io_test.cpp
            parser.cpp parser.hpp parser_test.cpp process.cpp process.hpp
            process_test.cpp sanity.hpp sanity_test.cpp signals.cpp signals.hpp
            signals_test.cpp test_helpers.cpp test_helpers.hpp text.cpp
            text.hpp text_test.cpp ui.cpp ui.hpp ui_test.cpp user.cpp user.hpp
            user_test.cpp
        src/external/bsd/atf/dist/atf-check: Atffile atf-check.1 atf-check.cpp
            integration_test.sh

Log Message:
Resolve import conflicts.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r0 src/external/bsd/atf/dist/atf-c/dynstr.c
cvs rdiff -u -r1.1.1.2 -r0 src/external/bsd/atf/dist/atf-c/dynstr.h \
    src/external/bsd/atf/dist/atf-c/text.c \
    src/external/bsd/atf/dist/atf-c/text.h
cvs rdiff -u -r1.1.1.1 -r0 src/external/bsd/atf/dist/atf-c/dynstr_test.c \
    src/external/bsd/atf/dist/atf-c/env.c \
    src/external/bsd/atf/dist/atf-c/env.h \
    src/external/bsd/atf/dist/atf-c/env_test.c \
    src/external/bsd/atf/dist/atf-c/fs_test.c \
    src/external/bsd/atf/dist/atf-c/list_test.c \
    src/external/bsd/atf/dist/atf-c/map_test.c \
    src/external/bsd/atf/dist/atf-c/process_helpers.c \
    src/external/bsd/atf/dist/atf-c/process_test.c \
    src/external/bsd/atf/dist/atf-c/sanity.c \
    src/external/bsd/atf/dist/atf-c/sanity.h \
    src/external/bsd/atf/dist/atf-c/sanity_test.c \
    src/external/bsd/atf/dist/atf-c/test_helpers.c \
    src/external/bsd/atf/dist/atf-c/test_helpers.h \
    src/external/bsd/atf/dist/atf-c/test_helpers_test.c \
    src/external/bsd/atf/dist/atf-c/text_test.c \
    src/external/bsd/atf/dist/atf-c/user.c \
    src/external/bsd/atf/dist/atf-c/user.h \
    src/external/bsd/atf/dist/atf-c/user_test.c
cvs rdiff -u -r1.5 -r0 src/external/bsd/atf/dist/atf-c/fs.c
cvs rdiff -u -r1.1.1.4 -r0 src/external/bsd/atf/dist/atf-c/fs.h \
    src/external/bsd/atf/dist/atf-c/map.c
cvs rdiff -u -r1.1.1.3 -r0 src/external/bsd/atf/dist/atf-c/list.c \
    src/external/bsd/atf/dist/atf-c/list.h \
    src/external/bsd/atf/dist/atf-c/map.h \
    src/external/bsd/atf/dist/atf-c/process.c \
    src/external/bsd/atf/dist/atf-c/process.h
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/atf/dist/atf-c/tc.c
cvs rdiff -u -r1.1.1.5 -r0 src/external/bsd/atf/dist/atf-c/tp_main.c
cvs rdiff -u -r1.1.1.4 -r0 src/external/bsd/atf/dist/atf-c++/application.cpp \
    src/external/bsd/atf/dist/atf-c++/application.hpp \
    src/external/bsd/atf/dist/atf-c++/fs.cpp \
    src/external/bsd/atf/dist/atf-c++/fs.hpp \
    src/external/bsd/atf/dist/atf-c++/process.hpp
cvs rdiff -u -r1.1.1.1 -r0 \
    src/external/bsd/atf/dist/atf-c++/application_test.cpp \
    src/external/bsd/atf/dist/atf-c++/env.cpp \
    src/external/bsd/atf/dist/atf-c++/env.hpp \
    src/external/bsd/atf/dist/atf-c++/env_test.cpp \
    src/external/bsd/atf/dist/atf-c++/exceptions.hpp \
    src/external/bsd/atf/dist/atf-c++/exceptions_test.cpp \
    src/external/bsd/atf/dist/atf-c++/expand_test.cpp \
    src/external/bsd/atf/dist/atf-c++/fs_test.cpp \
    src/external/bsd/atf/dist/atf-c++/parser_test.cpp \
    src/external/bsd/atf/dist/atf-c++/process_test.cpp \
    src/external/bsd/atf/dist/atf-c++/sanity.hpp \
    src/external/bsd/atf/dist/atf-c++/sanity_test.cpp \
    src/external/bsd/atf/dist/atf-c++/signals_test.cpp \
    src/external/bsd/atf/dist/atf-c++/test_helpers.cpp \
    src/external/bsd/atf/dist/atf-c++/test_helpers.hpp \
    src/external/bsd/atf/dist/atf-c++/text_test.cpp \
    src/external/bsd/atf/dist/atf-c++/ui.hpp \
    src/external/bsd/atf/dist/atf-c++/ui_test.cpp \
    src/external/bsd/atf/dist/atf-c++/user.cpp \
    src/external/bsd/atf/dist/atf-c++/user.hpp \
    src/external/bsd/atf/dist/atf-c++/user_test.cpp
cvs rdiff -u -r1.1.1.2 -r0 src/external/bsd/atf/dist/atf-c++/exceptions.cpp \
    src/external/bsd/atf/dist/atf-c++/expand.cpp \
    src/external/bsd/atf/dist/atf-c++/expand.hpp \
    src/external/bsd/atf/dist/atf-c++/signals.cpp \
    src/external/bsd/atf/dist/atf-c++/signals.hpp \
    src/external/bsd/atf/dist/atf-c++/text.cpp \
    src/external/bsd/atf/dist/atf-c++/text.hpp \
    src/external/bsd/atf/dist/atf-c++/ui.cpp
cvs rdiff -u -r1.2 -r0 src/external/bsd/atf/dist/atf-c++/io.cpp \
    src/external/bsd/atf/dist/atf-c++/io.hpp \
    src/external/bsd/atf/dist/atf-c++/io_test.cpp
cvs rdiff -u -r1.1.1.3 -r0 src/external/bsd/atf/dist/atf-c++/parser.cpp \
    src/external/bsd/atf/dist/atf-c++/parser.hpp \
    src/external/bsd/atf/dist/atf-c++/process.cpp
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/atf/dist/atf-c++/tests.cpp
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/atf/dist/atf-c++/tests.hpp
cvs rdiff -u -r1.1.1.1 -r0 src/external/bsd/atf/dist/atf-check/Atffile \
    src/external/bsd/atf/dist/atf-check/integration_test.sh
cvs rdiff -u -r1.3 -r0 src/external/bsd/atf/dist/atf-check/atf-check.1
cvs rdiff -u -r1.1.1.2 -r0 src/external/bsd/atf/dist/atf-check/atf-check.cpp
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/atf/dist/atf-report/atf-report.cpp
cvs rdiff -u -r1.2 -r1.3 \
    src/external/bsd/atf/dist/atf-report/tests-results.css
cvs rdiff -u -r1.3 -r1.4 \
    src/external/bsd/atf/dist/atf-report/tests-results.xsl
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/atf/dist/atf-run/atf-run.cpp
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/atf/dist/atf-run/test-program.cpp
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/atf/dist/atf-run/test-program.hpp
cvs rdiff -u -r1.4 -r1.5 \
    src/external/bsd/atf/dist/atf-version/atf-version.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/tc.c
diff -u src/external/bsd/atf/dist/atf-c/tc.c:1.6 src/external/bsd/atf/dist/atf-c/tc.c:1.7
--- src/external/bsd/atf/dist/atf-c/tc.c:1.6	Sat Jul  3 08:11:25 2010
+++ src/external/bsd/atf/dist/atf-c/tc.c	Wed Oct 20 09:17:22 2010
@@ -27,7 +27,11 @@
  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include <sys/types.h>
+#include <sys/stat.h>
+
 #include <errno.h>
+#include <fcntl.h>
 #include <stdarg.h>
 #include <stdbool.h>
 #include <stdio.h>
@@ -36,12 +40,14 @@
 #include <unistd.h>
 
 #include "atf-c/defs.h"
-#include "atf-c/env.h"
 #include "atf-c/error.h"
-#include "atf-c/fs.h"
-#include "atf-c/sanity.h"
 #include "atf-c/tc.h"
-#include "atf-c/text.h"
+
+#include "detail/env.h"
+#include "detail/fs.h"
+#include "detail/map.h"
+#include "detail/sanity.h"
+#include "detail/text.h"
 
 /* ---------------------------------------------------------------------
  * Auxiliary functions.
@@ -58,7 +64,7 @@
 
 struct context {
     const atf_tc_t *tc;
-    const atf_fs_path_t *resfile;
+    const char *resfile;
     size_t fail_count;
 
     enum expect_type expect;
@@ -69,14 +75,13 @@
     int expect_signo;
 };
 
-static void context_init(struct context *, const atf_tc_t *,
-                         const atf_fs_path_t *);
+static void context_init(struct context *, const atf_tc_t *, const char *);
 static void check_fatal_error(atf_error_t);
 static void report_fatal_error(const char *, ...)
     ATF_DEFS_ATTRIBUTE_NORETURN;
-static atf_error_t write_resfile(FILE *, const char *, const int,
+static atf_error_t write_resfile(const int, const char *, const int,
                                  const atf_dynstr_t *);
-static void create_resfile(const atf_fs_path_t *, const char *, const int,
+static void create_resfile(const char *, const char *, const int,
                            atf_dynstr_t *);
 static void error_in_expect(struct context *, const char *, ...)
     ATF_DEFS_ATTRIBUTE_NORETURN;
@@ -101,8 +106,7 @@
 static atf_error_t check_prog(struct context *, const char *, void *);
 
 static void
-context_init(struct context *ctx, const atf_tc_t *tc,
-             const atf_fs_path_t *resfile)
+context_init(struct context *ctx, const atf_tc_t *tc, const char *resfile)
 {
     ctx->tc = tc;
     ctx->resfile = resfile;
@@ -149,27 +153,35 @@
  * because the caller needs to clean up the reason object before terminating.
  */
 static atf_error_t
-write_resfile(FILE *file, const char *result, const int arg,
+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 (fprintf(file, "%s\n", result) <= 0)
+        if (snprintf(buffer, sizeof(buffer), "%s\n", result) <= 0)
             goto err;
     } else if (arg == -1 && reason != NULL) {
-        if (fprintf(file, "%s: %s\n", result, atf_dynstr_cstring(reason)) <= 0)
+        if (snprintf(buffer, sizeof(buffer), "%s: %s\n", result,
+                     atf_dynstr_cstring(reason)) <= 0)
             goto err;
     } else if (arg != -1 && reason != NULL) {
-        if (fprintf(file, "%s(%d): %s\n", result, arg,
-                    atf_dynstr_cstring(reason)) <= 0)
+        if (snprintf(buffer, sizeof(buffer), "%s(%d): %s\n", result,
+                     arg, atf_dynstr_cstring(reason)) <= 0)
             goto err;
-    } else
+    } else {
         UNREACHABLE;
+    }
 
-    return atf_no_error();
+    while ((ret = write(fd, buffer, strlen(buffer))) == -1 && errno == EINTR)
+        ; /* Retry. */
+    if (ret != -1)
+        return atf_no_error();
 
 err:
-    return atf_libc_error(errno, "Failed to write results file; result %s, "
-        "reason %s", result,
+    return atf_libc_error(
+        errno, "Failed to write results file; result %s, reason %s", result,
         reason == NULL ? "null" : atf_dynstr_cstring(reason));
 }
 
@@ -181,23 +193,24 @@
  * not return any error code.
  */
 static void
-create_resfile(const atf_fs_path_t *resfile, const char *result, const int arg,
+create_resfile(const char *resfile, const char *result, const int arg,
                atf_dynstr_t *reason)
 {
     atf_error_t err;
 
-    if (strcmp("/dev/stdout", atf_fs_path_cstring(resfile)) == 0) {
-        err = write_resfile(stdout, result, arg, reason);
-    } else if (strcmp("/dev/stderr", atf_fs_path_cstring(resfile)) == 0) {
-        err = write_resfile(stderr, result, arg, reason);
+    if (strcmp("/dev/stdout", resfile) == 0) {
+        err = write_resfile(STDOUT_FILENO, result, arg, reason);
+    } else if (strcmp("/dev/stderr", resfile) == 0) {
+        err = write_resfile(STDERR_FILENO, result, arg, reason);
     } else {
-        FILE *file = fopen(atf_fs_path_cstring(resfile), "w");
-        if (file == NULL) {
+        const int fd = open(resfile, O_WRONLY | O_CREAT | O_TRUNC,
+            S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+        if (fd == -1) {
             err = atf_libc_error(errno, "Cannot create results file '%s'",
-                                 atf_fs_path_cstring(resfile));
+                                 resfile);
         } else {
-            err = write_resfile(file, result, arg, reason);
-            fclose(file);
+            err = write_resfile(fd, result, arg, reason);
+            close(fd);
         }
     }
 
@@ -504,6 +517,17 @@
  * The "atf_tc" type.
  * --------------------------------------------------------------------- */
 
+struct atf_tc_impl {
+    const char *m_ident;
+
+    atf_map_t m_vars;
+    atf_map_t m_config;
+
+    atf_tc_head_t m_head;
+    atf_tc_body_t m_body;
+    atf_tc_cleanup_t m_cleanup;
+};
+
 /*
  * Constructors/destructors.
  */
@@ -511,20 +535,29 @@
 atf_error_t
 atf_tc_init(atf_tc_t *tc, const char *ident, atf_tc_head_t head,
             atf_tc_body_t body, atf_tc_cleanup_t cleanup,
-            const atf_map_t *config)
+            const char *const *config)
 {
     atf_error_t err;
 
-    tc->m_ident = ident;
-    tc->m_head = head;
-    tc->m_body = body;
-    tc->m_cleanup = cleanup;
-    tc->m_config = config;
+    tc->pimpl = malloc(sizeof(struct atf_tc_impl));
+    if (tc->pimpl == NULL) {
+        err = atf_no_memory_error();
+        goto err;
+    }
+
+    tc->pimpl->m_ident = ident;
+    tc->pimpl->m_head = head;
+    tc->pimpl->m_body = body;
+    tc->pimpl->m_cleanup = cleanup;
 
-    err = atf_map_init(&tc->m_vars);
+    err = atf_map_init_charpp(&tc->pimpl->m_config, config);
     if (atf_is_error(err))
         goto err;
 
+    err = atf_map_init(&tc->pimpl->m_vars);
+    if (atf_is_error(err))
+        goto err_vars;
+
     err = atf_tc_set_md_var(tc, "ident", ident);
     if (atf_is_error(err))
         goto err_map;
@@ -536,8 +569,8 @@
     }
 
     /* XXX Should the head be able to return error codes? */
-    if (tc->m_head != NULL)
-        tc->m_head(tc);
+    if (tc->pimpl->m_head != NULL)
+        tc->pimpl->m_head(tc);
 
     if (strcmp(atf_tc_get_md_var(tc, "ident"), ident) != 0) {
         report_fatal_error("Test case head modified the read-only 'ident' "
@@ -549,14 +582,16 @@
     return err;
 
 err_map:
-    atf_map_fini(&tc->m_vars);
+    atf_map_fini(&tc->pimpl->m_vars);
+err_vars:
+    atf_map_fini(&tc->pimpl->m_config);
 err:
     return err;
 }
 
 atf_error_t
 atf_tc_init_pack(atf_tc_t *tc, const atf_tc_pack_t *pack,
-                 const atf_map_t *config)
+                 const char *const *config)
 {
     return atf_tc_init(tc, pack->m_ident, pack->m_head, pack->m_body,
                        pack->m_cleanup, config);
@@ -565,7 +600,8 @@
 void
 atf_tc_fini(atf_tc_t *tc)
 {
-    atf_map_fini(&tc->m_vars);
+    atf_map_fini(&tc->pimpl->m_vars);
+    free(tc->pimpl);
 }
 
 /*
@@ -575,7 +611,7 @@
 const char *
 atf_tc_get_ident(const atf_tc_t *tc)
 {
-    return tc->m_ident;
+    return tc->pimpl->m_ident;
 }
 
 const char *
@@ -585,7 +621,7 @@
     atf_map_citer_t iter;
 
     PRE(atf_tc_has_config_var(tc, name));
-    iter = atf_map_find_c(tc->m_config, name);
+    iter = atf_map_find_c(&tc->pimpl->m_config, name);
     val = atf_map_citer_data(iter);
     INV(val != NULL);
 
@@ -613,34 +649,27 @@
     atf_map_citer_t iter;
 
     PRE(atf_tc_has_md_var(tc, name));
-    iter = atf_map_find_c(&tc->m_vars, name);
+    iter = atf_map_find_c(&tc->pimpl->m_vars, name);
     val = atf_map_citer_data(iter);
     INV(val != NULL);
 
     return val;
 }
 
-const atf_map_t *
+char **
 atf_tc_get_md_vars(const atf_tc_t *tc)
 {
-    return &tc->m_vars;
+    return atf_map_to_charpp(&tc->pimpl->m_vars);
 }
 
 bool
 atf_tc_has_config_var(const atf_tc_t *tc, const char *name)
 {
-    bool found;
     atf_map_citer_t end, iter;
 
-    if (tc->m_config == NULL)
-        found = false;
-    else {
-        iter = atf_map_find_c(tc->m_config, name);
-        end = atf_map_end_c(tc->m_config);
-        found = !atf_equal_map_citer_map_citer(iter, end);
-    }
-
-    return found;
+    iter = atf_map_find_c(&tc->pimpl->m_config, name);
+    end = atf_map_end_c(&tc->pimpl->m_config);
+    return !atf_equal_map_citer_map_citer(iter, end);
 }
 
 bool
@@ -648,8 +677,8 @@
 {
     atf_map_citer_t end, iter;
 
-    iter = atf_map_find_c(&tc->m_vars, name);
-    end = atf_map_end_c(&tc->m_vars);
+    iter = atf_map_find_c(&tc->pimpl->m_vars, name);
+    end = atf_map_end_c(&tc->pimpl->m_vars);
     return !atf_equal_map_citer_map_citer(iter, end);
 }
 
@@ -669,7 +698,7 @@
     va_end(ap);
 
     if (!atf_is_error(err))
-        err = atf_map_insert(&tc->m_vars, name, value, true);
+        err = atf_map_insert(&tc->pimpl->m_vars, name, value, true);
     else
         free(value);
 
@@ -899,11 +928,11 @@
 static struct context Current;
 
 atf_error_t
-atf_tc_run(const atf_tc_t *tc, const atf_fs_path_t *resfile)
+atf_tc_run(const atf_tc_t *tc, const char *resfile)
 {
     context_init(&Current, tc, resfile);
 
-    tc->m_body(tc);
+    tc->pimpl->m_body(tc);
 
     validate_expect(&Current);
 
@@ -929,8 +958,8 @@
 atf_error_t
 atf_tc_cleanup(const atf_tc_t *tc)
 {
-    if (tc->m_cleanup != NULL)
-        tc->m_cleanup(tc);
+    if (tc->pimpl->m_cleanup != NULL)
+        tc->pimpl->m_cleanup(tc);
     return atf_no_error(); /* XXX */
 }
 

Index: src/external/bsd/atf/dist/atf-c++/tests.cpp
diff -u src/external/bsd/atf/dist/atf-c++/tests.cpp:1.4 src/external/bsd/atf/dist/atf-c++/tests.cpp:1.5
--- src/external/bsd/atf/dist/atf-c++/tests.cpp:1.4	Tue Jul  6 18:03:37 2010
+++ src/external/bsd/atf/dist/atf-c++/tests.cpp	Wed Oct 20 09:17:23 2010
@@ -51,18 +51,19 @@
 
 extern "C" {
 #include "atf-c/error.h"
+#include "atf-c/tc.h"
+#include "atf-c/utils.h"
 }
 
-#include "atf-c++/application.hpp"
-#include "atf-c++/env.hpp"
-#include "atf-c++/exceptions.hpp"
-#include "atf-c++/fs.hpp"
-#include "atf-c++/io.hpp"
-#include "atf-c++/parser.hpp"
-#include "atf-c++/sanity.hpp"
-#include "atf-c++/tests.hpp"
-#include "atf-c++/text.hpp"
-#include "atf-c++/user.hpp"
+#include "tests.hpp"
+
+#include "detail/application.hpp"
+#include "detail/env.hpp"
+#include "detail/exceptions.hpp"
+#include "detail/fs.hpp"
+#include "detail/parser.hpp"
+#include "detail/sanity.hpp"
+#include "detail/text.hpp"
 
 namespace impl = atf::tests;
 namespace detail = atf::tests::detail;
@@ -88,8 +89,8 @@
 detail::atf_tp_writer::start_tc(const std::string& ident)
 {
     if (!m_is_first)
-        m_os << std::endl;
-    m_os << "ident: " << ident << std::endl;
+        m_os << "\n";
+    m_os << "ident: " << ident << "\n";
     m_os.flush();
 }
 
@@ -105,7 +106,7 @@
                                     const std::string& value)
 {
     PRE(name != "ident");
-    m_os << name << ": " << value << std::endl;
+    m_os << name << ": " << value << "\n";
     m_os.flush();
 }
 
@@ -116,67 +117,62 @@
 static std::map< atf_tc_t*, impl::tc* > wraps;
 static std::map< const atf_tc_t*, const impl::tc* > cwraps;
 
-void
-impl::tc::wrap_head(atf_tc_t *tc)
-{
-    try {
+struct impl::tc_impl : atf::utils::noncopyable {
+    std::string m_ident;
+    atf_tc_t m_tc;
+    bool m_has_cleanup;
+
+    tc_impl(const std::string& ident, const bool has_cleanup) :
+        m_ident(ident),
+        m_has_cleanup(has_cleanup)
+    {
+    }
+
+    static void
+    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();
-    } 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)
-{
-    try {
+    static void
+    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();
-    } catch (const std::exception& e) {
-        fail("Caught unhandled exception: " + std::string(e.what()));
-    } catch (...) {
-        fail("Caught unknown exception");
+        try {
+            (*iter).second->body();
+        } catch (const std::exception& e) {
+            (*iter).second->fail("Caught unhandled exception: " + std::string(
+                                     e.what()));
+        } catch (...) {
+            (*iter).second->fail("Caught unknown exception");
+        }
     }
-}
 
-void
-impl::tc::wrap_cleanup(const atf_tc_t *tc)
-{
-    try {
+    static void
+    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();
-    } 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) :
-    m_ident(ident),
-    m_has_cleanup(has_cleanup)
+    pimpl(new tc_impl(ident, has_cleanup))
 {
 }
 
 impl::tc::~tc(void)
 {
-    cwraps.erase(&m_tc);
-    wraps.erase(&m_tc);
+    cwraps.erase(&pimpl->m_tc);
+    wraps.erase(&pimpl->m_tc);
 
-    atf_tc_fini(&m_tc);
-    atf_map_fini(&m_config);
+    atf_tc_fini(&pimpl->m_tc);
 }
 
 void
@@ -184,66 +180,60 @@
 {
     atf_error_t err;
 
-    err = atf_map_init(&m_config);
-    if (atf_is_error(err))
-        throw_atf_error(err);
-
+    utils::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++) {
-        const char *var = (*iter).first.c_str();
-        const char *val = (*iter).second.c_str();
-
-        err = atf_map_insert(&m_config, var, ::strdup(val), true);
-        if (atf_is_error(err)) {
-            atf_map_fini(&m_config);
-            throw_atf_error(err);
-        }
-    }
-
-    wraps[&m_tc] = this;
-    cwraps[&m_tc] = this;
-
-    err = atf_tc_init(&m_tc, m_ident.c_str(), wrap_head, wrap_body,
-                      m_has_cleanup ? wrap_cleanup : NULL, &m_config);
-    if (atf_is_error(err)) {
-        atf_map_fini(&m_config);
+         *ptr = (*iter).first.c_str();
+         *(ptr + 1) = (*iter).second.c_str();
+         ptr += 2;
+    }
+    *ptr = NULL;
+
+    wraps[&pimpl->m_tc] = this;
+    cwraps[&pimpl->m_tc] = this;
+
+    err = atf_tc_init(&pimpl->m_tc, pimpl->m_ident.c_str(), pimpl->wrap_head,
+        pimpl->wrap_body, pimpl->m_has_cleanup ? pimpl->wrap_cleanup : NULL,
+        array.get());
+    if (atf_is_error(err))
         throw_atf_error(err);
-    }
 }
 
 bool
 impl::tc::has_config_var(const std::string& var)
     const
 {
-    return atf_tc_has_config_var(&m_tc, var.c_str());
+    return atf_tc_has_config_var(&pimpl->m_tc, var.c_str());
 }
 
 bool
 impl::tc::has_md_var(const std::string& var)
     const
 {
-    return atf_tc_has_md_var(&m_tc, var.c_str());
+    return atf_tc_has_md_var(&pimpl->m_tc, var.c_str());
 }
 
 const std::string
 impl::tc::get_config_var(const std::string& var)
     const
 {
-    return atf_tc_get_config_var(&m_tc, var.c_str());
+    return atf_tc_get_config_var(&pimpl->m_tc, var.c_str());
 }
 
 const std::string
 impl::tc::get_config_var(const std::string& var, const std::string& defval)
     const
 {
-    return atf_tc_get_config_var_wd(&m_tc, var.c_str(), defval.c_str());
+    return atf_tc_get_config_var_wd(&pimpl->m_tc, var.c_str(), defval.c_str());
 }
 
 const std::string
 impl::tc::get_md_var(const std::string& var)
     const
 {
-    return atf_tc_get_md_var(&m_tc, var.c_str());
+    return atf_tc_get_md_var(&pimpl->m_tc, var.c_str());
 }
 
 const impl::vars_map
@@ -252,10 +242,14 @@
 {
     vars_map vars;
 
-    atf_map_citer_t iter;
-    atf_map_for_each_c(iter, atf_tc_get_md_vars(&m_tc)) {
-        vars.insert(vars_map::value_type(atf_map_citer_key(iter),
-                    static_cast< const char * >(atf_map_citer_data(iter))));
+    char **array = atf_tc_get_md_vars(&pimpl->m_tc);
+    try {
+        char **ptr;
+        for (ptr = array; *ptr != NULL; ptr += 2)
+            vars[*ptr] = *(ptr + 1);
+    } catch (...) {
+        atf_utils_free_charpp(array);
+        throw;
     }
 
     return vars;
@@ -264,16 +258,16 @@
 void
 impl::tc::set_md_var(const std::string& var, const std::string& val)
 {
-    atf_error_t err = atf_tc_set_md_var(&m_tc, var.c_str(), val.c_str());
+    atf_error_t err = atf_tc_set_md_var(&pimpl->m_tc, var.c_str(), val.c_str());
     if (atf_is_error(err))
         throw_atf_error(err);
 }
 
 void
-impl::tc::run(const fs::path& resfile)
+impl::tc::run(const std::string& resfile)
     const
 {
-    atf_error_t err = atf_tc_run(&m_tc, resfile.c_path());
+    atf_error_t err = atf_tc_run(&pimpl->m_tc, resfile.c_str());
     if (atf_is_error(err))
         throw_atf_error(err);
 }
@@ -282,7 +276,7 @@
 impl::tc::run_cleanup(void)
     const
 {
-    atf_error_t err = atf_tc_cleanup(&m_tc);
+    atf_error_t err = atf_tc_cleanup(&pimpl->m_tc);
     if (atf_is_error(err))
         throw_atf_error(err);
 }
@@ -640,7 +634,7 @@
     try {
         switch (fields.second) {
         case BODY:
-            tc->run(m_resfile);
+            tc->run(m_resfile.str());
             break;
         case CLEANUP:
             tc->run_cleanup();

Index: src/external/bsd/atf/dist/atf-c++/tests.hpp
diff -u src/external/bsd/atf/dist/atf-c++/tests.hpp:1.3 src/external/bsd/atf/dist/atf-c++/tests.hpp:1.4
--- src/external/bsd/atf/dist/atf-c++/tests.hpp:1.3	Sat Jul  3 08:11:25 2010
+++ src/external/bsd/atf/dist/atf-c++/tests.hpp	Wed Oct 20 09:17:23 2010
@@ -31,13 +31,9 @@
 #define _ATF_CXX_TESTS_HPP_
 
 #include <map>
+#include <memory>
 #include <string>
 
-extern "C" {
-#include <atf-c/tc.h>
-}
-
-#include <atf-c++/fs.hpp>
 #include <atf-c++/utils.hpp>
 
 namespace atf {
@@ -70,11 +66,10 @@
 // The "tc" class.
 // ------------------------------------------------------------------------
 
+struct tc_impl;
+
 class tc : utils::noncopyable {
-    std::string m_ident;
-    atf_map_t m_config;
-    atf_tc_t m_tc;
-    bool m_has_cleanup;
+    std::auto_ptr< tc_impl > pimpl;
 
 protected:
     virtual void head(void);
@@ -83,9 +78,7 @@
 
     void require_prog(const std::string&) const;
 
-    static void wrap_head(atf_tc_t *);
-    static void wrap_body(const atf_tc_t *);
-    static void wrap_cleanup(const atf_tc_t *);
+    friend struct tc_impl;
 
 public:
     tc(const std::string&, const bool);
@@ -102,7 +95,7 @@
     bool has_md_var(const std::string&) const;
     void set_md_var(const std::string&, const std::string&);
 
-    void run(const fs::path&) const;
+    void run(const std::string&) const;
     void run_cleanup(void) const;
 
     // To be called from the child process only.

Index: src/external/bsd/atf/dist/atf-report/atf-report.cpp
diff -u src/external/bsd/atf/dist/atf-report/atf-report.cpp:1.4 src/external/bsd/atf/dist/atf-report/atf-report.cpp:1.5
--- src/external/bsd/atf/dist/atf-report/atf-report.cpp:1.4	Sat Jul  3 08:11:25 2010
+++ src/external/bsd/atf/dist/atf-report/atf-report.cpp	Wed Oct 20 09:17:23 2010
@@ -34,11 +34,11 @@
 #include <utility>
 #include <vector>
 
-#include "atf-c++/application.hpp"
-#include "atf-c++/fs.hpp"
-#include "atf-c++/sanity.hpp"
-#include "atf-c++/text.hpp"
-#include "atf-c++/ui.hpp"
+#include "atf-c++/detail/application.hpp"
+#include "atf-c++/detail/fs.hpp"
+#include "atf-c++/detail/sanity.hpp"
+#include "atf-c++/detail/text.hpp"
+#include "atf-c++/detail/ui.hpp"
 
 #include "reader.hpp"
 
@@ -126,12 +126,11 @@
     write_tp_end(const std::string& reason)
     {
         if (!reason.empty())
-            (*m_os) << "tp, " << m_tpname << ", bogus, " << reason
-                    << std::endl;
+            (*m_os) << "tp, " << m_tpname << ", bogus, " << reason << "\n";
         else if (m_failed)
-            (*m_os) << "tp, " << m_tpname << ", failed" << std::endl;
+            (*m_os) << "tp, " << m_tpname << ", failed\n";
         else
-            (*m_os) << "tp, " << m_tpname << ", passed" << std::endl;
+            (*m_os) << "tp, " << m_tpname << ", passed\n";
     }
 
     virtual
@@ -148,7 +147,7 @@
         std::string str = "tc, " + m_tpname + ", " + m_tcname + ", " + state;
         if (!reason.empty())
             str += ", " + reason;
-        (*m_os) << str << std::endl;
+        (*m_os) << str << "\n";
 
         if (state == "failed")
             m_failed = true;
@@ -174,15 +173,14 @@
     size_t m_tcs_passed, m_tcs_failed, m_tcs_skipped, m_tcs_expected_failures;
     std::string m_tcname, m_tpname;
     std::vector< std::string > m_failed_tcs;
-    std::vector< std::string > m_expected_failures_tcs;
+    std::map< std::string, std::string > m_expected_failures_tcs;
     std::vector< std::string > m_failed_tps;
 
     void
     write_info(const std::string& what, const std::string& val)
     {
         if (what == "tests.root") {
-            (*m_os) << "Tests root: " << val << std::endl
-                    << std::endl;
+            (*m_os) << "Tests root: " << val << "\n\n";
         }
     }
 
@@ -208,7 +206,7 @@
         (*m_os) << format_text(tp + " (" + to_string(m_curtp) +
                                "/" + to_string(m_ntps) + "): " +
                                to_string(ntcs) + " test cases")
-                << std::endl;
+                << "\n";
         (*m_os).flush();
     }
 
@@ -224,10 +222,10 @@
                                             "trust its results because "
                                             "of `" + reason + "'",
                                             m_tpname + ": ", false)
-                    << std::endl;
+                    << "\n";
             m_failed_tps.push_back(m_tpname);
         }
-        (*m_os) << std::endl;
+        (*m_os) << "\n";
         (*m_os).flush();
 
         m_tpname.clear();
@@ -252,7 +250,7 @@
             state == "expected_timeout") {
             str = "Expected failure: " + reason;
             m_tcs_expected_failures++;
-            m_expected_failures_tcs.push_back(m_tpname + ":" + m_tcname);
+            m_expected_failures_tcs[m_tpname + ":" + m_tcname] = reason;
         } else if (state == "failed") {
             str = "Failed: " + reason;
             m_tcs_failed++;
@@ -269,11 +267,30 @@
         // XXX Wrap text.  format_text_with_tag does not currently allow
         // to specify the current column, which is needed because we have
         // already printed the tc's name.
-        (*m_os) << str << std::endl;
+        (*m_os) << str << "\n";
 
         m_tcname = "";
     }
 
+    static void
+    write_expected_failures(const std::map< std::string, std::string >& xfails,
+                            std::ostream& os)
+    {
+        using atf::ui::format_text;
+        using atf::ui::format_text_with_tag;
+
+        os << format_text("Test cases for known bugs:") << "\n";
+
+        for (std::map< std::string, std::string >::const_iterator iter =
+             xfails.begin(); iter != xfails.end(); iter++) {
+            const std::string& name = (*iter).first;
+            const std::string& reason = (*iter).second;
+
+            os << format_text_with_tag(reason, "    " + name + ": ", false)
+               << "\n";
+        }
+    }
+
     void
     write_eof(void)
     {
@@ -284,45 +301,36 @@
 
         if (!m_failed_tps.empty()) {
             (*m_os) << format_text("Failed (bogus) test programs:")
-                    << std::endl;
+                    << "\n";
             (*m_os) << format_text_with_tag(join(m_failed_tps, ", "),
-                                            "    ", false) << std::endl
-                    << std::endl;
+                                            "    ", false) << "\n\n";
         }
 
         if (!m_expected_failures_tcs.empty()) {
-            (*m_os) << format_text("Test cases for known bugs:") << std::endl;
-            (*m_os) << format_text_with_tag(join(m_expected_failures_tcs, ", "),
-                                            "    ", false) << std::endl
-                    << std::endl;
+            write_expected_failures(m_expected_failures_tcs, *m_os);
+            (*m_os) << "\n";
         }
 
         if (!m_failed_tcs.empty()) {
-            (*m_os) << format_text("Failed test cases:") << std::endl;
+            (*m_os) << format_text("Failed test cases:") << "\n";
             (*m_os) << format_text_with_tag(join(m_failed_tcs, ", "),
-                                            "    ", false) << std::endl
-                    << std::endl;
+                                            "    ", false) << "\n\n";
         }
 
         (*m_os) << format_text("Summary for " + to_string(m_ntps) +
-                               " test programs:")
-                << std::endl;
+                               " test programs:") << "\n";
         (*m_os) << format_text_with_tag(to_string(m_tcs_passed) +
                                         " passed test cases.",
-                                        "    ", false)
-                << std::endl;
+                                        "    ", false) << "\n";
         (*m_os) << format_text_with_tag(to_string(m_tcs_failed) +
                                         " failed test cases.",
-                                        "    ", false)
-                << std::endl;
+                                        "    ", false) << "\n";
         (*m_os) << format_text_with_tag(to_string(m_tcs_expected_failures) +
                                         " expected failed test cases.",
-                                        "    ", false)
-                << std::endl;
+                                        "    ", false) << "\n";
         (*m_os) << format_text_with_tag(to_string(m_tcs_skipped) +
                                         " skipped test cases.",
-                                        "    ", false)
-                << std::endl;
+                                        "    ", false) << "\n";
     }
 
 public:
@@ -376,41 +384,39 @@
     void
     write_info(const std::string& what, const std::string& val)
     {
-        (*m_os) << "<info class=\"" << what << "\">" << val << "</info>"
-                << std::endl;
+        (*m_os) << "<info class=\"" << what << "\">" << val << "</info>\n";
     }
 
     void
     write_tp_start(const std::string& tp, size_t ntcs)
     {
-        (*m_os) << "<tp id=\"" << attrval(tp) << "\">" << std::endl;
+        (*m_os) << "<tp id=\"" << attrval(tp) << "\">\n";
     }
 
     void
     write_tp_end(const std::string& reason)
     {
         if (!reason.empty())
-            (*m_os) << "<failed>" << elemval(reason) << "</failed>"
-                    << std::endl;
-        (*m_os) << "</tp>" << std::endl;
+            (*m_os) << "<failed>" << elemval(reason) << "</failed>\n";
+        (*m_os) << "</tp>\n";
     }
 
     void
     write_tc_start(const std::string& tcname)
     {
-        (*m_os) << "<tc id=\"" << attrval(tcname) << "\">" << std::endl;
+        (*m_os) << "<tc id=\"" << attrval(tcname) << "\">\n";
     }
 
     void
     write_tc_stdout_line(const std::string& line)
     {
-        (*m_os) << "<so>" << elemval(line) << "</so>" << std::endl;
+        (*m_os) << "<so>" << elemval(line) << "</so>\n";
     }
 
     void
     write_tc_stderr_line(const std::string& line)
     {
-        (*m_os) << "<se>" << elemval(line) << "</se>" << std::endl;
+        (*m_os) << "<se>" << elemval(line) << "</se>\n";
     }
 
     void
@@ -422,37 +428,33 @@
             state == "expected_failure" || state == "expected_signal" ||
             state == "expected_timeout") {
             (*m_os) << "<" << state << ">" << elemval(reason)
-                    << "</" << state << ">" << std::endl;
+                    << "</" << state << ">\n";
         } else if (state == "passed") {
-            (*m_os) << "<passed />" << std::endl;
+            (*m_os) << "<passed />\n";
         } else if (state == "failed") {
-            (*m_os) << "<failed>" << elemval(reason)
-                    << "</failed>" << std::endl;
+            (*m_os) << "<failed>" << elemval(reason) << "</failed>\n";
         } else if (state == "skipped") {
-            (*m_os) << "<skipped>" << elemval(reason)
-                    << "</skipped>" << std::endl;
+            (*m_os) << "<skipped>" << elemval(reason) << "</skipped>\n";
         } else
             UNREACHABLE;
-        (*m_os) << "</tc>" << std::endl;
+        (*m_os) << "</tc>\n";
     }
 
     void
     write_eof(void)
     {
-        (*m_os) << "</tests-results>" << std::endl;
+        (*m_os) << "</tests-results>\n";
     }
 
 public:
     xml_writer(const atf::fs::path& p) :
         m_os(open_outfile(p))
     {
-        (*m_os) << "<?xml version=\"1.0\"?>" << std::endl
+        (*m_os) << "<?xml version=\"1.0\"?>\n"
                 << "<!DOCTYPE tests-results PUBLIC "
                    "\"-//NetBSD//DTD ATF Tests Results 0.1//EN\" "
-                   "\"http://www.NetBSD.org/XML/atf/tests-results.dtd\";>"
-                << std::endl
-                << std::endl
-                << "<tests-results>" << std::endl;
+                   "\"http://www.NetBSD.org/XML/atf/tests-results.dtd\";>\n\n"
+                   "<tests-results>\n";
     }
 };
 

Index: src/external/bsd/atf/dist/atf-report/tests-results.css
diff -u src/external/bsd/atf/dist/atf-report/tests-results.css:1.2 src/external/bsd/atf/dist/atf-report/tests-results.css:1.3
--- src/external/bsd/atf/dist/atf-report/tests-results.css:1.2	Sat Sep  4 19:19:27 2010
+++ src/external/bsd/atf/dist/atf-report/tests-results.css	Wed Oct 20 09:17:23 2010
@@ -159,6 +159,6 @@
     background: #ffffaa;
 }
 
-table.tcs-summary td.tcr-exfail {
+table.tcs-summary td.tcr-xfail {
     background: #ffaaff;
 }

Index: src/external/bsd/atf/dist/atf-report/tests-results.xsl
diff -u src/external/bsd/atf/dist/atf-report/tests-results.xsl:1.3 src/external/bsd/atf/dist/atf-report/tests-results.xsl:1.4
--- src/external/bsd/atf/dist/atf-report/tests-results.xsl:1.3	Sat Sep 11 03:10:57 2010
+++ src/external/bsd/atf/dist/atf-report/tests-results.xsl	Wed Oct 20 09:17:23 2010
@@ -49,10 +49,12 @@
                 select="count(tests-results/tp/tc/failed)" />
   <xsl:variable name="ntcs-skipped"
                 select="count(tests-results/tp/tc/skipped)" />
-  <xsl:variable name="ntcs-exp-fail"
-                select="count(tests-results/tp/tc/expected_signal) +
-			count(tests-results/tp/tc/expected_timeout) +
-			count(tests-results/tp/tc/expected_failure)" />
+  <xsl:variable name="ntcs-xfail"
+                select="count(tests-results/tp/tc/expected_death) +
+                        count(tests-results/tp/tc/expected_exit) +
+                        count(tests-results/tp/tc/expected_failure) +
+                        count(tests-results/tp/tc/expected_signal) +
+                        count(tests-results/tp/tc/expected_timeout)" />
 
   <xsl:template match="/">
     <xsl:copy>
@@ -78,8 +80,8 @@
         <xsl:if test="$ntcs-failed > 0">
           <xsl:call-template name="failed-tcs-summary" />
         </xsl:if>
-        <xsl:if test="$ntcs-exp-fail > 0">
-          <xsl:call-template name="exp-fail-tcs-summary" />
+        <xsl:if test="$ntcs-xfail > 0">
+          <xsl:call-template name="xfail-tcs-summary" />
         </xsl:if>
         <xsl:if test="$ntcs-skipped > 0">
           <xsl:call-template name="skipped-tcs-summary" />
@@ -206,17 +208,17 @@
       </tr>
       <tr class="entry">
         <xsl:choose>
-          <xsl:when test="$ntcs-exp-fail > 0">
-            <td><p><a href="#exp-fail-tcs-summary">Expected-Fail test
-            cases</a></p></td>
+          <xsl:when test="$ntcs-xfail > 0">
+            <td><p><a href="#xfail-tcs-summary">Expected
+            failures</a></p></td>
             <td class="numeric-warning">
-              <p><xsl:value-of select="$ntcs-exp-fail" /></p>
+              <p><xsl:value-of select="$ntcs-xfail" /></p>
             </td>
           </xsl:when>
           <xsl:otherwise>
-            <td><p>Expected-Fail test cases</p></td>
+            <td><p>Expected failures</p></td>
             <td class="numeric">
-              <p><xsl:value-of select="$ntcs-exp-fail" /></p>
+              <p><xsl:value-of select="$ntcs-xfail" /></p>
             </td>
           </xsl:otherwise>
         </xsl:choose>
@@ -280,9 +282,9 @@
     </table>
   </xsl:template>
 
-  <xsl:template name="exp-fail-tcs-summary">
-    <a name="exp-fail-tcs-summary" />
-    <h2 id="exp-fail-tcs-summary">Expected-Fail test cases summary</h2>
+  <xsl:template name="xfail-tcs-summary">
+    <a name="xfail-tcs-summary" />
+    <h2 id="xfail-tcs-summary">Expected failures summary</h2>
 
     <table class="tcs-summary">
       <tr>
@@ -291,7 +293,7 @@
         <th><p>Reason</p></th>
       </tr>
       <xsl:apply-templates select="tp" mode="summary">
-        <xsl:with-param name="which">expected</xsl:with-param>
+        <xsl:with-param name="which">xfail</xsl:with-param>
       </xsl:apply-templates>
     </table>
   </xsl:template>
@@ -335,12 +337,16 @@
       <xsl:choose>
         <xsl:when test="$which = 'passed' and tc/passed">yes</xsl:when>
         <xsl:when test="$which = 'failed' and tc/failed">yes</xsl:when>
-        <xsl:when test="$which = 'expected' and
-			tc/expected_failure">yes</xsl:when>
-        <xsl:when test="$which = 'expected' and
-			tc/expected_timeout">yes</xsl:when>
-        <xsl:when test="$which = 'expected' and
-			tc/expected_signal">yes</xsl:when>
+        <xsl:when test="$which = 'xfail' and
+                        tc/expected_death">yes</xsl:when>
+        <xsl:when test="$which = 'xfail' and
+                        tc/expected_exit">yes</xsl:when>
+        <xsl:when test="$which = 'xfail' and
+                        tc/expected_failure">yes</xsl:when>
+        <xsl:when test="$which = 'xfail' and
+                        tc/expected_signal">yes</xsl:when>
+        <xsl:when test="$which = 'xfail' and
+                        tc/expected_timeout">yes</xsl:when>
         <xsl:when test="$which = 'skipped' and tc/skipped">yes</xsl:when>
         <xsl:when test="$which = 'all'">yes</xsl:when>
         <xsl:otherwise>no</xsl:otherwise>
@@ -369,12 +375,16 @@
       <xsl:choose>
         <xsl:when test="$which = 'passed' and ./passed">yes</xsl:when>
         <xsl:when test="$which = 'failed' and ./failed">yes</xsl:when>
-        <xsl:when test="$which = 'expected' and
-			./expected_signal">yes</xsl:when>
-        <xsl:when test="$which = 'expected' and
-			./expected_failure">yes</xsl:when>
-        <xsl:when test="$which = 'expected' and
-			./expected_timeout">yes</xsl:when>
+        <xsl:when test="$which = 'xfail' and
+                        ./expected_death">yes</xsl:when>
+        <xsl:when test="$which = 'xfail' and
+                        ./expected_exit">yes</xsl:when>
+        <xsl:when test="$which = 'xfail' and
+                        ./expected_failure">yes</xsl:when>
+        <xsl:when test="$which = 'xfail' and
+                        ./expected_signal">yes</xsl:when>
+        <xsl:when test="$which = 'xfail' and
+                        ./expected_timeout">yes</xsl:when>
         <xsl:when test="$which = 'skipped' and ./skipped">yes</xsl:when>
         <xsl:when test="$which = 'all'">yes</xsl:when>
         <xsl:otherwise>no</xsl:otherwise>
@@ -385,8 +395,8 @@
       <tr>
         <td class="tc-id">
           <xsl:choose>
-            <xsl:when test="failed|skipped|expected_failure|
-			    expected_timeout|expected_signal">
+            <xsl:when test="expected_death|expected_exit|expected_failure|
+                            expected_signal|expected_timeout|failed|skipped">
               <p><a href="#{$full-id}"><xsl:value-of select="@id" /></a></p>
             </xsl:when>
             <xsl:otherwise>
@@ -394,9 +404,10 @@
             </xsl:otherwise>
           </xsl:choose>
         </td>
-        <xsl:apply-templates select="passed|failed|skipped|
-				     expected_failure|expected_timeout|
-				     expected_signal" mode="tc" />
+        <xsl:apply-templates select="expected_death|expected_exit|
+                                     expected_failure|expected_timeout|
+                                     expected_signal|failed|passed|
+                                     skipped" mode="tc" />
       </tr>
     </xsl:if>
   </xsl:template>
@@ -406,16 +417,28 @@
     <td><p>N/A</p></td>
   </xsl:template>
 
+  <xsl:template match="expected_death" mode="tc">
+    <td class="tcr-xfail"><p>Expected death</p></td>
+    <td><p><xsl:apply-templates /></p></td>
+  </xsl:template>
+
+  <xsl:template match="expected_exit" mode="tc">
+    <td class="tcr-xfail"><p>Expected exit</p></td>
+    <td><p><xsl:apply-templates /></p></td>
+  </xsl:template>
+
   <xsl:template match="expected_failure" mode="tc">
-    <td class="tcr-exfail"><p>Expected Failure</p></td>
+    <td class="tcr-xfail"><p>Expected failure</p></td>
     <td><p><xsl:apply-templates /></p></td>
   </xsl:template>
+
   <xsl:template match="expected_timeout" mode="tc">
-    <td class="tcr-exfail"><p>Expected Timeout</p></td>
+    <td class="tcr-xfail"><p>Expected timeout</p></td>
     <td><p><xsl:apply-templates /></p></td>
   </xsl:template>
+
   <xsl:template match="expected_signal" mode="tc">
-    <td class="tcr-exfail"><p>Expected Signal</p></td>
+    <td class="tcr-xfail"><p>Expected signal</p></td>
     <td><p><xsl:apply-templates /></p></td>
   </xsl:template>
 
@@ -430,24 +453,18 @@
   </xsl:template>
 
   <xsl:template match="tp" mode="details">
-    <xsl:apply-templates select="tc[failed|skipped|expected_timeout|
-				    expected_failure|expected_signal]"
-			 mode="details" />
+    <xsl:apply-templates select="tc[expected_death|expected_exit|
+                                    expected_failure|expected_signal|
+                                    expected_timeout|failed|skipped]"
+                         mode="details" />
   </xsl:template>
 
   <xsl:template match="failed" mode="details">
     <p class="term"><strong>FAILED</strong>: <xsl:apply-templates /></p>
   </xsl:template>
 
-  <xsl:template match="expected_failure" mode="details">
-    <p class="term"><strong>XFAIL</strong>: <xsl:apply-templates /></p>
-  </xsl:template>
-
-  <xsl:template match="expected_timeout" mode="details">
-    <p class="term"><strong>XFAIL</strong>: <xsl:apply-templates /></p>
-  </xsl:template>
-
-  <xsl:template match="expected_signal" mode="details">
+  <xsl:template match="expected_death|expected_exit|expected_failure|
+                       expected_signal|expected_timeout" mode="details">
     <p class="term"><strong>XFAIL</strong>: <xsl:apply-templates /></p>
   </xsl:template>
 
@@ -465,9 +482,10 @@
     <xsl:value-of select="@id" /></h2>
 
     <h3>Termination reason</h3>
-    <xsl:apply-templates select="failed|skipped|expected_failure|
-				 expected_timeout|expected_signal"
-			 mode="details" />
+    <xsl:apply-templates select="expected_death|expected_exit|expected_failure|
+                                 expected_signal|expected_timeout|
+                                 failed|skipped"
+                         mode="details" />
 
     <xsl:if test="so">
       <h3>Standard output stream</h3>

Index: src/external/bsd/atf/dist/atf-run/atf-run.cpp
diff -u src/external/bsd/atf/dist/atf-run/atf-run.cpp:1.5 src/external/bsd/atf/dist/atf-run/atf-run.cpp:1.6
--- src/external/bsd/atf/dist/atf-run/atf-run.cpp:1.5	Sat Jul  3 08:11:26 2010
+++ src/external/bsd/atf/dist/atf-run/atf-run.cpp	Wed Oct 20 09:17:24 2010
@@ -47,19 +47,17 @@
 #include <map>
 #include <string>
 
-#include "atf-c++/application.hpp"
+#include "atf-c++/detail/application.hpp"
 #include "atf-c++/config.hpp"
-#include "atf-c++/env.hpp"
-#include "atf-c++/exceptions.hpp"
-#include "atf-c++/fs.hpp"
-#include "atf-c++/io.hpp"
-#include "atf-c++/parser.hpp"
-#include "atf-c++/process.hpp"
-#include "atf-c++/sanity.hpp"
-#include "atf-c++/signals.hpp"
 #include "atf-c++/tests.hpp"
-#include "atf-c++/text.hpp"
-#include "atf-c++/user.hpp"
+
+#include "atf-c++/detail/env.hpp"
+#include "atf-c++/detail/exceptions.hpp"
+#include "atf-c++/detail/fs.hpp"
+#include "atf-c++/detail/parser.hpp"
+#include "atf-c++/detail/process.hpp"
+#include "atf-c++/detail/sanity.hpp"
+#include "atf-c++/detail/text.hpp"
 
 #include "atffile.hpp"
 #include "config.hpp"
@@ -232,7 +230,7 @@
             } else {
                 return test_case_result("failed", -1, broken_reason);
             }
-        } catch (const std::runtime_error& e) {
+        } catch (const std::runtime_error&) {
             return test_case_result("failed", -1, broken_reason);
         }
     }
@@ -290,7 +288,7 @@
 
         try {
             tcr = read_test_case_result(resfile);
-        } catch (const std::runtime_error& e) {
+        } catch (const std::runtime_error&) {
             return test_case_result("failed", -1, "Test program received "
                 "signal " + atf::text::to_string(s.termsig()) +
                 (s.coredump() ? " (core dumped)" : ""));

Index: src/external/bsd/atf/dist/atf-run/test-program.cpp
diff -u src/external/bsd/atf/dist/atf-run/test-program.cpp:1.4 src/external/bsd/atf/dist/atf-run/test-program.cpp:1.5
--- src/external/bsd/atf/dist/atf-run/test-program.cpp:1.4	Thu Aug 26 15:28:31 2010
+++ src/external/bsd/atf/dist/atf-run/test-program.cpp	Wed Oct 20 09:17:24 2010
@@ -39,16 +39,18 @@
 #include <cstdlib>
 #include <cstring>
 #include <fstream>
+#include <iostream>
 
-#include "atf-c++/env.hpp"
-#include "atf-c++/parser.hpp"
-#include "atf-c++/process.hpp"
-#include "atf-c++/sanity.hpp"
-#include "atf-c++/signals.hpp"
-#include "atf-c++/text.hpp"
+#include "atf-c++/detail/env.hpp"
+#include "atf-c++/detail/parser.hpp"
+#include "atf-c++/detail/process.hpp"
+#include "atf-c++/detail/sanity.hpp"
+#include "atf-c++/detail/text.hpp"
 
 #include "config.hpp"
 #include "fs.hpp"
+#include "io.hpp"
+#include "signals.hpp"
 #include "test-program.hpp"
 #include "timer.hpp"
 
@@ -57,6 +59,20 @@
 
 namespace {
 
+static void
+check_stream(std::ostream& os)
+{
+    // If we receive a signal while writing to the stream, the bad bit gets set.
+    // Things seem to behave fine afterwards if we clear such error condition.
+    // However, I'm not sure if it's safe to query errno at this point.
+    if (os.bad()) {
+        if (errno == EINTR)
+            os.clear();
+        else
+            throw std::runtime_error("Failed");
+    }
+}
+
 namespace atf_tp {
 
 static const atf::parser::token_type eof_type = 0;
@@ -112,28 +128,6 @@
     }
 };
 
-class output_muxer : public atf::io::std_muxer {
-    impl::atf_tps_writer& m_writer;
-
-    void
-    got_stdout_line(const std::string& line)
-    {
-        m_writer.stdout_tc(line);
-    }
-
-    void
-    got_stderr_line(const std::string& line)
-    {
-        m_writer.stderr_tc(line);
-    }
-
-public:
-    output_muxer(impl::atf_tps_writer& writer) :
-        m_writer(writer)
-    {
-    }
-};
-
 struct get_metadata_params {
     const atf::fs::path& executable;
     const atf::tests::vars_map& config;
@@ -234,8 +228,8 @@
 
     ::umask(S_IWGRP | S_IWOTH);
 
-    for (int i = 1; i <= atf::signals::last_signo; i++)
-        atf::signals::reset(i);
+    for (int i = 1; i <= impl::last_signo; i++)
+        impl::reset(i);
 
     atf::env::set("HOME", workdir.str());
     atf::env::unset("LANG");
@@ -360,7 +354,7 @@
     } else {
         try {
             value = atf::text::to_type< int >(arg);
-        } catch (const std::runtime_error& e) {
+        } catch (const std::runtime_error&) {
             throw std::runtime_error("The value '" + arg + "' passed to the '" +
                 state + "' state must be an integer");
         }
@@ -410,7 +404,7 @@
     } else if (name == "has.cleanup") {
         try {
             (void)atf::text::to_bool(value);
-        } catch (const std::runtime_error& e) {
+        } catch (const std::runtime_error&) {
             throw parse_error(lineno, "The has.cleanup property requires a"
                               " boolean value");
         }
@@ -430,7 +424,7 @@
     } else if (name == "use.fs") {
         try {
             (void)atf::text::to_bool(value);
-        } catch (const std::runtime_error& e) {
+        } catch (const std::runtime_error&) {
             throw parse_error(lineno, "The use.fs property requires a boolean"
                               " value");
         }
@@ -538,14 +532,14 @@
 void
 impl::atf_tps_writer::info(const std::string& what, const std::string& val)
 {
-    m_os << "info: " << what << ", " << val << std::endl;
+    m_os << "info: " << what << ", " << val << "\n";
     m_os.flush();
 }
 
 void
 impl::atf_tps_writer::ntps(size_t p_ntps)
 {
-    m_os << "tps-count: " << p_ntps << std::endl;
+    m_os << "tps-count: " << p_ntps << "\n";
     m_os.flush();
 }
 
@@ -553,7 +547,7 @@
 impl::atf_tps_writer::start_tp(const std::string& tp, size_t ntcs)
 {
     m_tpname = tp;
-    m_os << "tp-start: " << tp << ", " << ntcs << std::endl;
+    m_os << "tp-start: " << tp << ", " << ntcs << "\n";
     m_os.flush();
 }
 
@@ -562,9 +556,9 @@
 {
     PRE(reason.find('\n') == std::string::npos);
     if (reason.empty())
-        m_os << "tp-end: " << m_tpname << std::endl;
+        m_os << "tp-end: " << m_tpname << "\n";
     else
-        m_os << "tp-end: " << m_tpname << ", " << reason << std::endl;
+        m_os << "tp-end: " << m_tpname << ", " << reason << "\n";
     m_os.flush();
 }
 
@@ -572,22 +566,26 @@
 impl::atf_tps_writer::start_tc(const std::string& tcname)
 {
     m_tcname = tcname;
-    m_os << "tc-start: " << tcname << std::endl;
+    m_os << "tc-start: " << tcname << "\n";
     m_os.flush();
 }
 
 void
 impl::atf_tps_writer::stdout_tc(const std::string& line)
 {
-    m_os << "tc-so:" << line << std::endl;
+    m_os << "tc-so:" << line << "\n";
+    check_stream(m_os);
     m_os.flush();
+    check_stream(m_os);
 }
 
 void
 impl::atf_tps_writer::stderr_tc(const std::string& line)
 {
-    m_os << "tc-se:" << line << std::endl;
+    m_os << "tc-se:" << line << "\n";
+    check_stream(m_os);
     m_os.flush();
+    check_stream(m_os);
 }
 
 void
@@ -597,7 +595,7 @@
     std::string str = "tc-end: " + m_tcname + ", " + state;
     if (!reason.empty())
         str += ", " + reason;
-    m_os << str << std::endl;
+    m_os << str << "\n";
     m_os.flush();
 }
 
@@ -612,8 +610,7 @@
                            atf::process::stream_inherit(),
                            static_cast< void * >(&params));
 
-    atf::io::file_handle outfh = child.stdout_fd();
-    atf::io::pistream outin(outfh);
+    impl::pistream outin(child.stdout_fd());
 
     metadata_reader parser(outin);
     parser.read();
@@ -648,14 +645,36 @@
 
 namespace {
 
-static bool sigchld_received;
+static volatile bool terminate_poll;
 
 static void
 sigchld_handler(const int signo)
 {
-    sigchld_received = true;
+    terminate_poll = true;
 }
 
+class child_muxer : public impl::muxer {
+    impl::atf_tps_writer& m_writer;
+
+    void
+    line_callback(const size_t index, const std::string& line)
+    {
+        switch (index) {
+        case 0: m_writer.stdout_tc(line); break;
+        case 1: m_writer.stderr_tc(line); break;
+        default: UNREACHABLE;
+        }
+    }
+
+public:
+    child_muxer(const int* fds, const size_t nfds,
+                impl::atf_tps_writer& writer) :
+        muxer(fds, nfds),
+        m_writer(writer)
+    {
+    }
+};
+
 } // anonymous namespace
 
 std::pair< std::string, atf::process::status >
@@ -679,39 +698,41 @@
                            atf::process::stream_capture(),
                            static_cast< void * >(&params));
 
+    terminate_poll = false;
+
     const atf::tests::vars_map::const_iterator iter = metadata.find("timeout");
     INV(iter != metadata.end());
     const unsigned int timeout =
         atf::text::to_type< unsigned int >((*iter).second);
     const pid_t child_pid = child.pid();
-    child_timer timeout_timer(timeout, child_pid);
 
     // Get the input stream of stdout and stderr.
-    atf::io::file_handle outfh = child.stdout_fd();
-    atf::io::unbuffered_istream outin(outfh);
-    atf::io::file_handle errfh = child.stderr_fd();
-    atf::io::unbuffered_istream errin(errfh);
+    impl::file_handle outfh = child.stdout_fd();
+    impl::file_handle errfh = child.stderr_fd();
+
+    bool timed_out = false;
 
     // Process the test case's output and multiplex it into our output
     // stream as we read it.
+    int fds[2] = {outfh.get(), errfh.get()};
+    child_muxer mux(fds, 2, writer);
     try {
-        atf::signals::signal_programmer sigchld(SIGCHLD, sigchld_handler);
-
-        output_muxer muxer(writer);
-        sigchld_received = false;
-        muxer.read(outin, errin, sigchld_received);
-        outin.close();
-        errin.close();
+        child_timer timeout_timer(timeout, child_pid, terminate_poll);
+        signal_programmer sigchld(SIGCHLD, sigchld_handler);
+        mux.mux(terminate_poll);
+        timed_out = timeout_timer.fired();
     } catch (...) {
         UNREACHABLE;
     }
 
+    ::killpg(child_pid, SIGTERM);
+    mux.flush();
     atf::process::status status = child.wait();
     ::killpg(child_pid, SIGKILL);
 
     std::string reason;
 
-    if (timeout_timer.fired()) {
+    if (timed_out) {
         // Don't assume the child process has been signaled due to the timeout
         // expiration as older versions did.  The child process may have exited
         // but we may have timed out due to a subchild process getting stuck.

Index: src/external/bsd/atf/dist/atf-run/test-program.hpp
diff -u src/external/bsd/atf/dist/atf-run/test-program.hpp:1.3 src/external/bsd/atf/dist/atf-run/test-program.hpp:1.4
--- src/external/bsd/atf/dist/atf-run/test-program.hpp:1.3	Sat Jul  3 08:11:26 2010
+++ src/external/bsd/atf/dist/atf-run/test-program.hpp	Wed Oct 20 09:17:24 2010
@@ -29,9 +29,10 @@
 
 #include <map>
 
-#include <atf-c++/fs.hpp>
-#include <atf-c++/process.hpp>
-#include <atf-c++/tests.hpp>
+#include "atf-c++/tests.hpp"
+
+#include "atf-c++/detail/fs.hpp"
+#include "atf-c++/detail/process.hpp"
 
 namespace atf {
 namespace atf_run {

Index: src/external/bsd/atf/dist/atf-version/atf-version.cpp
diff -u src/external/bsd/atf/dist/atf-version/atf-version.cpp:1.4 src/external/bsd/atf/dist/atf-version/atf-version.cpp:1.5
--- src/external/bsd/atf/dist/atf-version/atf-version.cpp:1.4	Sat Jul  3 08:11:26 2010
+++ src/external/bsd/atf/dist/atf-version/atf-version.cpp	Wed Oct 20 09:17:24 2010
@@ -34,8 +34,8 @@
 #include <cstdlib>
 #include <iostream>
 
-#include "atf-c++/application.hpp"
-#include "atf-c++/ui.hpp"
+#include "atf-c++/detail/application.hpp"
+#include "atf-c++/detail/ui.hpp"
 
 #include "revision.h"
 

Reply via email to