diff --git a/external/bsd/atf/dist/atf-c++/detail/process.hpp b/external/bsd/atf/dist/atf-c++/detail/process.hpp index c8b12ad97fe7..6e33e0037d87 100644 --- a/external/bsd/atf/dist/atf-c++/detail/process.hpp +++ b/external/bsd/atf/dist/atf-c++/detail/process.hpp @@ -1,7 +1,7 @@ // // Automated Testing Framework (atf) // -// Copyright (c) 2008, 2009, 2010, 2011 The NetBSD Foundation, Inc. +// Copyright (c) 2008 The NetBSD Foundation, Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without diff --git a/external/bsd/atf/dist/atf-c++/detail/text.cpp b/external/bsd/atf/dist/atf-c++/detail/text.cpp index be4318d5d21d..66eebf0a77e7 100644 --- a/external/bsd/atf/dist/atf-c++/detail/text.cpp +++ b/external/bsd/atf/dist/atf-c++/detail/text.cpp @@ -1,7 +1,7 @@ // // Automated Testing Framework (atf) // -// Copyright (c) 2007, 2008, 2010 The NetBSD Foundation, Inc. +// Copyright (c) 2007 The NetBSD Foundation, Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without @@ -33,7 +33,6 @@ extern "C" { #include #include -#include extern "C" { #include "../../atf-c/error.h" @@ -136,10 +135,26 @@ impl::to_bool(const std::string& str) } int64_t -impl::to_number(const std::string& str) +impl::to_bytes(std::string str) { - int64_t num; - ::dehumanize_number(str.c_str(), &num); - return num; + if (str.empty()) + throw std::runtime_error("Empty value"); + + const char unit = str[str.length() - 1]; + int64_t multiplier; + switch (unit) { + case 'k': case 'K': multiplier = 1 << 10; break; + case 'm': case 'M': multiplier = 1 << 20; break; + case 'g': case 'G': multiplier = 1 << 30; break; + case 't': case 'T': multiplier = int64_t(1) << 40; break; + default: + if (!std::isdigit(unit)) + throw std::runtime_error(std::string("Unknown size unit '") + unit + + "'"); + multiplier = 1; + } + if (multiplier != 1) + str.erase(str.length() - 1); + + return to_type< int64_t >(str) * multiplier; } - diff --git a/external/bsd/atf/dist/atf-c++/detail/text.hpp b/external/bsd/atf/dist/atf-c++/detail/text.hpp index 9da8a3da2fb1..6a1b027c1896 100644 --- a/external/bsd/atf/dist/atf-c++/detail/text.hpp +++ b/external/bsd/atf/dist/atf-c++/detail/text.hpp @@ -1,7 +1,7 @@ // // Automated Testing Framework (atf) // -// Copyright (c) 2007, 2008, 2010 The NetBSD Foundation, Inc. +// Copyright (c) 2007 The NetBSD Foundation, Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without @@ -30,6 +30,10 @@ #if !defined(_ATF_CXX_TEXT_HPP_) #define _ATF_CXX_TEXT_HPP_ +extern "C" { +#include +} + #include #include #include @@ -97,6 +101,11 @@ std::string trim(const std::string&); //! bool to_bool(const std::string&); +//! +//! \brief Converts the given string to a bytes size. +//! +int64_t to_bytes(std::string); + //! //! \brief Changes the case of a string to lowercase. //! @@ -105,13 +114,6 @@ bool to_bool(const std::string&); //! std::string to_lower(const std::string&); -//! -//! \brief Converts the given string to a number -//! -//! The string should be of the form ^[0-9]+[KMGT]$ or ^[0-9]$ -//! -int64_t to_number(const std::string&); - //! //! \brief Converts the given object to a string. //! @@ -140,7 +142,7 @@ to_type(const std::string& str) std::istringstream ss(str); T value; ss >> value; - if (!ss.eof() || (!ss.eof() && !ss.good())) + if (!ss.eof() || (ss.eof() && (ss.fail() || ss.bad()))) throw std::runtime_error("Cannot convert string to requested type"); return value; } diff --git a/external/bsd/atf/dist/atf-c++/tests.cpp b/external/bsd/atf/dist/atf-c++/tests.cpp index 95ab8c4786c5..cdc0dfbad4f3 100644 --- a/external/bsd/atf/dist/atf-c++/tests.cpp +++ b/external/bsd/atf/dist/atf-c++/tests.cpp @@ -1,7 +1,7 @@ // // Automated Testing Framework (atf) // -// Copyright (c) 2007, 2008, 2009, 2010, 2011 The NetBSD Foundation, Inc. +// Copyright (c) 2007 The NetBSD Foundation, Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without diff --git a/external/bsd/atf/dist/atf-c++/tests.hpp b/external/bsd/atf/dist/atf-c++/tests.hpp index 208e33da256b..af75229d3b83 100644 --- a/external/bsd/atf/dist/atf-c++/tests.hpp +++ b/external/bsd/atf/dist/atf-c++/tests.hpp @@ -1,7 +1,7 @@ // // Automated Testing Framework (atf) // -// Copyright (c) 2007, 2008, 2009, 2010 The NetBSD Foundation, Inc. +// Copyright (c) 2007 The NetBSD Foundation, Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without diff --git a/external/bsd/atf/dist/atf-c/defs.h.in b/external/bsd/atf/dist/atf-c/defs.h.in index 0d8a28eb98ba..7925107cf83a 100644 --- a/external/bsd/atf/dist/atf-c/defs.h.in +++ b/external/bsd/atf/dist/atf-c/defs.h.in @@ -1,7 +1,7 @@ /* * Automated Testing Framework (atf) * - * Copyright (c) 2008, 2011 The NetBSD Foundation, Inc. + * Copyright (c) 2008 The NetBSD Foundation, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,5 +32,6 @@ #define ATF_DEFS_ATTRIBUTE_FORMAT_PRINTF(a, b) @ATTRIBUTE_FORMAT_PRINTF@ #define ATF_DEFS_ATTRIBUTE_NORETURN @ATTRIBUTE_NORETURN@ +#define ATF_DEFS_ATTRIBUTE_UNUSED @ATTRIBUTE_UNUSED@ #endif /* !defined(ATF_C_DEFS_H) */ diff --git a/external/bsd/atf/dist/atf-c/detail/process.c b/external/bsd/atf/dist/atf-c/detail/process.c index f35faa70016f..bc36b570e7d3 100644 --- a/external/bsd/atf/dist/atf-c/detail/process.c +++ b/external/bsd/atf/dist/atf-c/detail/process.c @@ -1,7 +1,7 @@ /* * Automated Testing Framework (atf) * - * Copyright (c) 2007, 2008, 2009, 2010, 2011 The NetBSD Foundation, Inc. + * Copyright (c) 2007 The NetBSD Foundation, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -197,7 +197,7 @@ atf_process_status_init(atf_process_status_t *s, int status) } void -atf_process_status_fini(atf_process_status_t *s) +atf_process_status_fini(atf_process_status_t *s ATF_DEFS_ATTRIBUTE_UNUSED) { } diff --git a/external/bsd/atf/dist/atf-c/detail/process.h b/external/bsd/atf/dist/atf-c/detail/process.h index c5690bbd01a0..b4aad3d93a18 100644 --- a/external/bsd/atf/dist/atf-c/detail/process.h +++ b/external/bsd/atf/dist/atf-c/detail/process.h @@ -1,7 +1,7 @@ /* * Automated Testing Framework (atf) * - * Copyright (c) 2008, 2009, 2010, 2011 The NetBSD Foundation, Inc. + * Copyright (c) 2008 The NetBSD Foundation, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/external/bsd/atf/dist/atf-c/detail/process_test.c b/external/bsd/atf/dist/atf-c/detail/process_test.c index c59f2aa8b8df..229593bf8325 100644 --- a/external/bsd/atf/dist/atf-c/detail/process_test.c +++ b/external/bsd/atf/dist/atf-c/detail/process_test.c @@ -1,7 +1,7 @@ /* * Automated Testing Framework (atf) * - * Copyright (c) 2008, 2009, 2010, 2011 The NetBSD Foundation, Inc. + * Copyright (c) 2008 The NetBSD Foundation, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -28,8 +28,8 @@ */ #include -#include #include +#include #include #include @@ -135,13 +135,12 @@ capture_stream_process(void *v, atf_process_child_t *c) { struct capture_stream *s = v; - bool eof; switch (s->m_base.m_type) { case stdout_type: - eof = read_line(atf_process_child_stdout(c), &s->m_msg); + (void)read_line(atf_process_child_stdout(c), &s->m_msg); break; case stderr_type: - eof = read_line(atf_process_child_stderr(c), &s->m_msg); + (void)read_line(atf_process_child_stderr(c), &s->m_msg); break; default: UNREACHABLE; @@ -690,7 +689,7 @@ static void child_report_pid(void *) ATF_DEFS_ATTRIBUTE_NORETURN; static void -child_report_pid(void *v) +child_report_pid(void *v ATF_DEFS_ATTRIBUTE_UNUSED) { const pid_t pid = getpid(); if (write(STDOUT_FILENO, &pid, sizeof(pid)) != sizeof(pid)) @@ -731,7 +730,7 @@ ATF_TC_BODY(child_pid, tc) static void -child_loop(void *v) +child_loop(void *v ATF_DEFS_ATTRIBUTE_UNUSED) { for (;;) sleep(1); @@ -739,13 +738,13 @@ child_loop(void *v) static void -nop_signal(int sig) +nop_signal(int sig ATF_DEFS_ATTRIBUTE_UNUSED) { } static void -child_spawn_loop_and_wait_eintr(void *v) +child_spawn_loop_and_wait_eintr(void *v ATF_DEFS_ATTRIBUTE_UNUSED) { atf_process_child_t child; atf_process_status_t status; diff --git a/external/bsd/atf/dist/atf-c/detail/test_helpers.c b/external/bsd/atf/dist/atf-c/detail/test_helpers.c index 4b5cee760db6..f83b3a004c5c 100644 --- a/external/bsd/atf/dist/atf-c/detail/test_helpers.c +++ b/external/bsd/atf/dist/atf-c/detail/test_helpers.c @@ -1,7 +1,7 @@ /* * Automated Testing Framework (atf) * - * Copyright (c) 2008, 2009, 2010 The NetBSD Foundation, Inc. + * Copyright (c) 2008 The NetBSD Foundation, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -77,7 +77,7 @@ build_check_c_o(const atf_tc_t *tc, const char *sfile, const char *failmsg) } void -header_check(const atf_tc_t *tc, const char *hdrname) +header_check(const char *hdrname) { FILE *srcfile; char failmsg[128]; diff --git a/external/bsd/atf/dist/atf-c/tc.c b/external/bsd/atf/dist/atf-c/tc.c index 7d590a7c6a95..cbdd00c4e0b0 100644 --- a/external/bsd/atf/dist/atf-c/tc.c +++ b/external/bsd/atf/dist/atf-c/tc.c @@ -1,7 +1,7 @@ /* * Automated Testing Framework (atf) * - * Copyright (c) 2008, 2009, 2010 The NetBSD Foundation, Inc. + * Copyright (c) 2008 The NetBSD Foundation, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -104,7 +104,7 @@ static void errno_test(struct context *, const char *, const size_t, const int, const char *, const bool, void (*)(struct context *, atf_dynstr_t *)); static atf_error_t check_prog_in_dir(const char *, void *); -static atf_error_t check_prog(struct context *, const char *, void *); +static atf_error_t check_prog(struct context *, const char *); static void context_init(struct context *ctx, const atf_tc_t *tc, const char *resfile) @@ -166,22 +166,24 @@ write_resfile(const int fd, const char *result, const int arg, INV(arg == -1 || reason != NULL); - iov[count].iov_base = __UNCONST(result); +#define UNCONST(a) ((void *)(unsigned long)(const void *)(a)) + 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); - } + 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; + 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); + r = atf_dynstr_cstring(reason); + iov[count].iov_base = UNCONST(r); + iov[count++].iov_len = strlen(r); } +#undef UNCONST iov[count].iov_base = NL; iov[count++].iov_len = sizeof(NL) - 1; @@ -460,7 +462,7 @@ out_p: } static atf_error_t -check_prog(struct context *ctx, const char *prog, void *data) +check_prog(struct context *ctx, const char *prog) { atf_error_t err; atf_fs_path_t p; @@ -874,7 +876,7 @@ _atf_tc_pass(struct context *ctx) static void _atf_tc_require_prog(struct context *ctx, const char *prog) { - check_fatal_error(check_prog(ctx, prog, NULL)); + check_fatal_error(check_prog(ctx, prog)); } static void diff --git a/external/bsd/atf/dist/atf-c/tc.h b/external/bsd/atf/dist/atf-c/tc.h index 8b38b5eb67c4..3f24186b0264 100644 --- a/external/bsd/atf/dist/atf-c/tc.h +++ b/external/bsd/atf/dist/atf-c/tc.h @@ -1,7 +1,7 @@ /* * Automated Testing Framework (atf) * - * Copyright (c) 2008, 2009, 2010, 2011 The NetBSD Foundation, Inc. + * Copyright (c) 2008 The NetBSD Foundation, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/external/bsd/atf/dist/atf-config/integration_test.sh b/external/bsd/atf/dist/atf-config/integration_test.sh index 13b0e637b907..5d6505a4176e 100644 --- a/external/bsd/atf/dist/atf-config/integration_test.sh +++ b/external/bsd/atf/dist/atf-config/integration_test.sh @@ -1,7 +1,7 @@ # # Automated Testing Framework (atf) # -# Copyright (c) 2007, 2008, 2009, 2010 The NetBSD Foundation, Inc. +# Copyright (c) 2007 The NetBSD Foundation, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without diff --git a/external/bsd/atf/dist/atf-report/atf-report.cpp b/external/bsd/atf/dist/atf-report/atf-report.cpp index 525433cb59c0..fffe9dd41e91 100644 --- a/external/bsd/atf/dist/atf-report/atf-report.cpp +++ b/external/bsd/atf/dist/atf-report/atf-report.cpp @@ -1,7 +1,7 @@ // // Automated Testing Framework (atf) // -// Copyright (c) 2007, 2008 The NetBSD Foundation, Inc. +// Copyright (c) 2007 The NetBSD Foundation, Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without @@ -27,13 +27,21 @@ // IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // +extern "C" { +#include +} + #include #include +#include #include #include +#include #include #include +#include "atf-c/defs.h" + #include "atf-c++/detail/application.hpp" #include "atf-c++/detail/fs.hpp" #include "atf-c++/detail/sanity.hpp" @@ -44,7 +52,7 @@ typedef std::auto_ptr< std::ostream > ostream_ptr; -ostream_ptr +static ostream_ptr open_outfile(const atf::fs::path& path) { ostream_ptr osp; @@ -57,6 +65,16 @@ open_outfile(const atf::fs::path& path) return osp; } +static std::string +format_tv(struct timeval* tv) +{ + std::ostringstream output; + output << static_cast< long >(tv->tv_sec) << '.' + << std::setfill('0') << std::setw(6) + << static_cast< long >(tv->tv_usec); + return output.str(); +} + // ------------------------------------------------------------------------ // The "writer" interface. // ------------------------------------------------------------------------ @@ -80,11 +98,12 @@ public: virtual void write_info(const std::string&, const std::string&) {} virtual void write_ntps(size_t) {} virtual void write_tp_start(const std::string&, size_t) {} - virtual void write_tp_end(const std::string&) {} + virtual void write_tp_end(struct timeval*, const std::string&) {} virtual void write_tc_start(const std::string&) {} virtual void write_tc_stdout_line(const std::string&) {} virtual void write_tc_stderr_line(const std::string&) {} - virtual void write_tc_end(const std::string&, const std::string&) {} + virtual void write_tc_end(const std::string&, struct timeval*, + const std::string&) {} virtual void write_eof(void) {} }; @@ -115,7 +134,8 @@ public: virtual void - write_tp_start(const std::string& name, size_t ntcs) + write_tp_start(const std::string& name, + size_t ntcs ATF_DEFS_ATTRIBUTE_UNUSED) { m_tpname = name; m_failed = false; @@ -123,14 +143,17 @@ public: virtual void - write_tp_end(const std::string& reason) + write_tp_end(struct timeval* tv, const std::string& reason) { + const std::string timestamp = format_tv(tv); + if (!reason.empty()) - (*m_os) << "tp, " << m_tpname << ", bogus, " << reason << "\n"; + (*m_os) << "tp, " << timestamp << ", " << m_tpname << ", bogus, " + << reason << "\n"; else if (m_failed) - (*m_os) << "tp, " << m_tpname << ", failed\n"; + (*m_os) << "tp, " << timestamp << ", "<< m_tpname << ", failed\n"; else - (*m_os) << "tp, " << m_tpname << ", passed\n"; + (*m_os) << "tp, " << timestamp << ", "<< m_tpname << ", passed\n"; } virtual @@ -142,12 +165,13 @@ public: virtual void - write_tc_end(const std::string& state, const std::string& reason) + write_tc_end(const std::string& state, struct timeval* tv, + const std::string& reason) { - std::string str = "tc, " + m_tpname + ", " + m_tcname + ", " + state; + std::string str = m_tpname + ", " + m_tcname + ", " + state; if (!reason.empty()) str += ", " + reason; - (*m_os) << str << "\n"; + (*m_os) << "tc, " << format_tv(tv) << ", " << str << "\n"; if (state == "failed") m_failed = true; @@ -211,7 +235,7 @@ class ticker_writer : public writer { } void - write_tp_end(const std::string& reason) + write_tp_end(struct timeval* tv, const std::string& reason) { using atf::ui::format_text_with_tag; @@ -225,7 +249,7 @@ class ticker_writer : public writer { << "\n"; m_failed_tps.push_back(m_tpname); } - (*m_os) << "\n"; + (*m_os) << "[" << format_tv(tv) << "s]\n\n"; (*m_os).flush(); m_tpname.clear(); @@ -241,10 +265,13 @@ class ticker_writer : public writer { } void - write_tc_end(const std::string& state, const std::string& reason) + write_tc_end(const std::string& state, struct timeval* tv, + const std::string& reason) { std::string str; + (*m_os) << "[" << format_tv(tv) << "s] "; + if (state == "expected_death" || state == "expected_exit" || state == "expected_failure" || state == "expected_signal" || state == "expected_timeout") { @@ -267,7 +294,7 @@ class ticker_writer : public writer { // 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 << "\n"; + (*m_os) << str << '\n'; m_tcname = ""; } @@ -388,16 +415,18 @@ class xml_writer : public writer { } void - write_tp_start(const std::string& tp, size_t ntcs) + write_tp_start(const std::string& tp, + size_t ntcs ATF_DEFS_ATTRIBUTE_UNUSED) { (*m_os) << "\n"; } void - write_tp_end(const std::string& reason) + write_tp_end(struct timeval* tv, const std::string& reason) { if (!reason.empty()) (*m_os) << "" << elemval(reason) << "\n"; + (*m_os) << "" << format_tv(tv) << ""; (*m_os) << "\n"; } @@ -420,7 +449,8 @@ class xml_writer : public writer { } void - write_tc_end(const std::string& state, const std::string& reason) + write_tc_end(const std::string& state, struct timeval* tv, + const std::string& reason) { std::string str; @@ -437,6 +467,7 @@ class xml_writer : public writer { (*m_os) << "" << elemval(reason) << "\n"; } else UNREACHABLE; + (*m_os) << "" << format_tv(tv) << ""; (*m_os) << "\n"; } @@ -450,7 +481,7 @@ public: xml_writer(const atf::fs::path& p) : m_os(open_outfile(p)) { - (*m_os) << "\n" + (*m_os) << "\n" << "\n\n" @@ -498,11 +529,11 @@ class converter : public atf::atf_report::atf_tps_reader { } void - got_tp_end(const std::string& reason) + got_tp_end(struct timeval* tv, const std::string& reason) { for (outs_vector::iterator iter = m_outs.begin(); iter != m_outs.end(); iter++) - (*iter)->write_tp_end(reason); + (*iter)->write_tp_end(tv, reason); } void @@ -530,11 +561,12 @@ class converter : public atf::atf_report::atf_tps_reader { } void - got_tc_end(const std::string& state, const std::string& reason) + got_tc_end(const std::string& state, struct timeval* tv, + const std::string& reason) { for (outs_vector::iterator iter = m_outs.begin(); iter != m_outs.end(); iter++) - (*iter)->write_tc_end(state, reason); + (*iter)->write_tc_end(state, tv, reason); } void @@ -638,6 +670,9 @@ atf_report::specific_options(void) int atf_report::main(void) { + if (m_argc > 0) + throw std::runtime_error("No arguments allowed"); + if (m_oflags.empty()) m_oflags.push_back(fmt_path_pair("ticker", atf::fs::path("-"))); diff --git a/external/bsd/atf/dist/atf-report/tests-results.css b/external/bsd/atf/dist/atf-report/tests-results.css index 62f17f40c1db..fc7371bc30b2 100644 --- a/external/bsd/atf/dist/atf-report/tests-results.css +++ b/external/bsd/atf/dist/atf-report/tests-results.css @@ -1,7 +1,7 @@ /* * Automated Testing Framework (atf) * - * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc. + * Copyright (c) 2007 The NetBSD Foundation, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,6 +31,10 @@ body { margin: 0 0 0 0; } +.nobr { + white-space: nowrap; +} + h1 { background: black; color: white; @@ -56,6 +60,11 @@ h3 { padding: 3pt; } +p.details { + margin-left: 20pt; + margin-right: 20pt; +} + p.term { margin-left: 40pt; margin-right: 40pt; @@ -138,9 +147,15 @@ table.tcs-summary th { padding: 3pt 6pt 3pt 6pt; } +table.tcs-summary td.numeric { + text-align: right; + width: 1pt; +} + table.tcs-summary td.tp-id { background: #dddddd; font-weight: bold; + width: 1pt; } table.tcs-summary td.tc-id p { @@ -149,16 +164,24 @@ table.tcs-summary td.tc-id p { table.tcs-summary td.tcr-passed { background: #aaffaa; + width: 1pt; } table.tcs-summary td.tcr-failed { background: #ffaaaa; + width: 1pt; } table.tcs-summary td.tcr-skipped { background: #ffffaa; + width: 1pt; } table.tcs-summary td.tcr-xfail { background: #ffaaff; + width: 1pt; +} + +table.tcs-summary td.tcr-reason { + width: 100%; } diff --git a/external/bsd/atf/dist/atf-report/tests-results.xsl b/external/bsd/atf/dist/atf-report/tests-results.xsl index aca81e6a99b2..40b96d953c81 100644 --- a/external/bsd/atf/dist/atf-report/tests-results.xsl +++ b/external/bsd/atf/dist/atf-report/tests-results.xsl @@ -4,7 +4,7 @@