Source-Changes-HG archive

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

[src/trunk]: src/external/bsd/kyua-cli/dist Update kyua-cli to 0.7:



details:   https://anonhg.NetBSD.org/src/rev/7d8ebf758282
branches:  trunk
changeset: 790651:7d8ebf758282
user:      jmmv <jmmv%NetBSD.org@localhost>
date:      Fri Oct 18 23:40:04 2013 +0000

description:
Update kyua-cli to 0.7:

The major reason for this update is to support the just-imported lutok-0.3
and, in turn, support the eventual update of the in-tree lua to 5.2.

Changes:

Experimental version released on October 18th, 2013.

* Made failures from testers more resilent.  If a tester fails, the
  corresponding test case will be marked as broken instead of causing
  kyua to exit.

* Added the '--results-filter' option to the 'report-html' command and
  set its default value to skip passed results from HTML reports.  This
  is to keep these reports more succint and to avoid generating tons of
  detail files that will be, in general, useless.

* Switched to use Lutok 0.3 to gain compatibility with Lua 5.2.

* Issue 69: Cope with the lack of AM_PROG_AR in configure.ac, which
  first appeared in Automake 1.11.2.  Fixes a problem in Ubuntu 10.04
  LTS, which appears stuck in 1.11.1.

diffstat:

 external/bsd/kyua-cli/dist/NEWS                                |  25 ++-
 external/bsd/kyua-cli/dist/bootstrap/package.m4                |   4 +-
 external/bsd/kyua-cli/dist/bootstrap/testsuite                 |  10 +-
 external/bsd/kyua-cli/dist/cli/cmd_report.cpp                  |  60 +------
 external/bsd/kyua-cli/dist/cli/cmd_report_html.cpp             |  82 ++++++++-
 external/bsd/kyua-cli/dist/cli/common.cpp                      |  67 ++++++++
 external/bsd/kyua-cli/dist/cli/common.hpp                      |  14 +-
 external/bsd/kyua-cli/dist/cli/common_test.cpp                 |  83 ++++++++++
 external/bsd/kyua-cli/dist/doc/kyua-report-html.1.in           |  21 ++-
 external/bsd/kyua-cli/dist/engine/action.hpp                   |   5 +-
 external/bsd/kyua-cli/dist/engine/context.hpp                  |   4 +-
 external/bsd/kyua-cli/dist/engine/drivers/debug_test.hpp       |   3 +-
 external/bsd/kyua-cli/dist/engine/drivers/list_tests.hpp       |   3 +-
 external/bsd/kyua-cli/dist/engine/drivers/run_tests.hpp        |   3 +-
 external/bsd/kyua-cli/dist/engine/drivers/scan_action.hpp      |   3 +-
 external/bsd/kyua-cli/dist/engine/filters.hpp                  |   3 +-
 external/bsd/kyua-cli/dist/engine/metadata.hpp                 |   5 +-
 external/bsd/kyua-cli/dist/engine/metadata_test.cpp            |   2 +-
 external/bsd/kyua-cli/dist/engine/test_case.cpp                |  68 +++++--
 external/bsd/kyua-cli/dist/engine/test_case.hpp                |   6 +-
 external/bsd/kyua-cli/dist/engine/test_case_test.cpp           |  43 +++++
 external/bsd/kyua-cli/dist/engine/test_program.hpp             |   6 +-
 external/bsd/kyua-cli/dist/engine/test_program_test.cpp        |  58 ++++++
 external/bsd/kyua-cli/dist/engine/testers.cpp                  |   3 +-
 external/bsd/kyua-cli/dist/engine/testers_test.cpp             |  76 ++++++++-
 external/bsd/kyua-cli/dist/integration/cmd_debug_test.sh       |   7 +-
 external/bsd/kyua-cli/dist/integration/cmd_list_test.sh        |   7 +-
 external/bsd/kyua-cli/dist/integration/cmd_report_html_test.sh |  76 ++++++--
 external/bsd/kyua-cli/dist/integration/cmd_test_test.sh        |   7 +-
 external/bsd/kyua-cli/dist/misc/index.html                     |  10 +-
 external/bsd/kyua-cli/dist/store/backend.hpp                   |   4 +-
 external/bsd/kyua-cli/dist/store/transaction.cpp               |   4 +-
 external/bsd/kyua-cli/dist/store/transaction.hpp               |   8 +-
 external/bsd/kyua-cli/dist/utils/cmdline/exceptions.hpp        |   1 +
 external/bsd/kyua-cli/dist/utils/config/lua_module.cpp         |  27 ++-
 external/bsd/kyua-cli/dist/utils/config/tree.hpp               |   4 +-
 external/bsd/kyua-cli/dist/utils/datetime.cpp                  |   8 +-
 external/bsd/kyua-cli/dist/utils/datetime.hpp                  |   9 +-
 external/bsd/kyua-cli/dist/utils/format/exceptions.hpp         |   1 +
 external/bsd/kyua-cli/dist/utils/fs/auto_cleaners.hpp          |   6 +-
 external/bsd/kyua-cli/dist/utils/fs/exceptions.hpp             |   1 +
 external/bsd/kyua-cli/dist/utils/passwd.hpp                    |   3 +-
 external/bsd/kyua-cli/dist/utils/process/child.cpp             |   2 +-
 external/bsd/kyua-cli/dist/utils/shared_ptr.hpp                |  46 +++++
 external/bsd/kyua-cli/dist/utils/signals/misc_test.cpp         |   9 +-
 external/bsd/kyua-cli/dist/utils/sqlite/database.hpp           |   4 +-
 external/bsd/kyua-cli/dist/utils/sqlite/statement.hpp          |   5 +-
 external/bsd/kyua-cli/dist/utils/sqlite/transaction.hpp        |   4 +-
 external/bsd/kyua-cli/dist/utils/units.cpp                     |   6 +-
 external/bsd/kyua-cli/dist/utils/units.hpp                     |   7 +-
 50 files changed, 707 insertions(+), 216 deletions(-)

diffs (truncated from 2020 to 300 lines):

diff -r 7bfc504f75fb -r 7d8ebf758282 external/bsd/kyua-cli/dist/NEWS
--- a/external/bsd/kyua-cli/dist/NEWS   Fri Oct 18 23:37:37 2013 +0000
+++ b/external/bsd/kyua-cli/dist/NEWS   Fri Oct 18 23:40:04 2013 +0000
@@ -1,3 +1,24 @@
+Changes in version 0.7
+======================
+
+Experimental version released on October 18th, 2013.
+
+* Made failures from testers more resilent.  If a tester fails, the
+  corresponding test case will be marked as broken instead of causing
+  kyua to exit.
+
+* Added the '--results-filter' option to the 'report-html' command and
+  set its default value to skip passed results from HTML reports.  This
+  is to keep these reports more succint and to avoid generating tons of
+  detail files that will be, in general, useless.
+
+* Switched to use Lutok 0.3 to gain compatibility with Lua 5.2.
+
+* Issue 69: Cope with the lack of AM_PROG_AR in configure.ac, which
+  first appeared in Automake 1.11.2.  Fixes a problem in Ubuntu 10.04
+  LTS, which appears stuck in 1.11.1.
+
+
 Changes in version 0.6
 ======================
 
@@ -52,8 +73,8 @@
 * Removed the GDB build-time configuration variable.  This is now part
   of the kyua-testers package.
 
-* Rewrote the Kyuafile parsing code in C++, which results in a much
-  simpler implementation.  As a side-effect, this gets rid of the
+* Issue 31: Rewrote the Kyuafile parsing code in C++, which results in
+  a much simpler implementation.  As a side-effect, this gets rid of the
   external Lua files required by 'kyua', which in turn make the tool
   self-contained.
 
diff -r 7bfc504f75fb -r 7d8ebf758282 external/bsd/kyua-cli/dist/bootstrap/package.m4
--- a/external/bsd/kyua-cli/dist/bootstrap/package.m4   Fri Oct 18 23:37:37 2013 +0000
+++ b/external/bsd/kyua-cli/dist/bootstrap/package.m4   Fri Oct 18 23:40:04 2013 +0000
@@ -1,6 +1,6 @@
 # Signature of the current package.
 m4_define(AT_PACKAGE_NAME,      Kyua - Command line interface)
 m4_define(AT_PACKAGE_TARNAME,   kyua-cli)
-m4_define(AT_PACKAGE_VERSION,   0.6)
-m4_define(AT_PACKAGE_STRING,    Kyua - Command line interface 0.6)
+m4_define(AT_PACKAGE_VERSION,   0.7)
+m4_define(AT_PACKAGE_STRING,    Kyua - Command line interface 0.7)
 m4_define(AT_PACKAGE_BUGREPORT, kyua-discuss%googlegroups.com@localhost)
diff -r 7bfc504f75fb -r 7d8ebf758282 external/bsd/kyua-cli/dist/bootstrap/testsuite
--- a/external/bsd/kyua-cli/dist/bootstrap/testsuite    Fri Oct 18 23:37:37 2013 +0000
+++ b/external/bsd/kyua-cli/dist/bootstrap/testsuite    Fri Oct 18 23:40:04 2013 +0000
@@ -911,7 +911,7 @@
 # List of tests.
 if $at_list_p; then
   cat <<_ATEOF || at_write_fail=1
-Kyua - Command line interface 0.6 test suite: bootstrapping tests test groups:
+Kyua - Command line interface 0.7 test suite: bootstrapping tests test groups:
 
  NUM: FILE-NAME:LINE     TEST-GROUP-NAME
       KEYWORDS
@@ -952,7 +952,7 @@
   exit $at_write_fail
 fi
 if $at_version_p; then
-  $as_echo "$as_me (Kyua - Command line interface 0.6)" &&
+  $as_echo "$as_me (Kyua - Command line interface 0.7)" &&
   cat <<\_ATEOF || at_write_fail=1
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1129,11 +1129,11 @@
 
 # Banners and logs.
 $as_echo "## ------------------------------------------------------------------ ##
-## Kyua - Command line interface 0.6 test suite: bootstrapping tests. ##
+## Kyua - Command line interface 0.7 test suite: bootstrapping tests. ##
 ## ------------------------------------------------------------------ ##"
 {
   $as_echo "## ------------------------------------------------------------------ ##
-## Kyua - Command line interface 0.6 test suite: bootstrapping tests. ##
+## Kyua - Command line interface 0.7 test suite: bootstrapping tests. ##
 ## ------------------------------------------------------------------ ##"
   echo
 
@@ -1977,7 +1977,7 @@
   $as_echo "Please send $at_msg and all information you think might help:
 
    To: <kyua-discuss%googlegroups.com@localhost>
-   Subject: [Kyua - Command line interface 0.6] $as_me: $at_fail_list${at_fail_list:+ failed${at_xpass_list:+, }}$at_xpass_list${at_xpass_list:+ passed unexpectedly}
+   Subject: [Kyua - Command line interface 0.7] $as_me: $at_fail_list${at_fail_list:+ failed${at_xpass_list:+, }}$at_xpass_list${at_xpass_list:+ passed unexpectedly}
 
 You may investigate any problem if you feel able to do so, in which
 case the test suite provides a good starting point.  Its output may
diff -r 7bfc504f75fb -r 7d8ebf758282 external/bsd/kyua-cli/dist/cli/cmd_report.cpp
--- a/external/bsd/kyua-cli/dist/cli/cmd_report.cpp     Fri Oct 18 23:37:37 2013 +0000
+++ b/external/bsd/kyua-cli/dist/cli/cmd_report.cpp     Fri Oct 18 23:40:04 2013 +0000
@@ -58,45 +58,6 @@
 namespace {
 
 
-/// Collection of result types.
-///
-/// This is a vector rather than a set because we want to respect the order in
-/// which the user provided the types.
-typedef std::vector< engine::test_result::result_type > result_types;
-
-
-/// Converts a set of result type names to identifiers.
-///
-/// \param names The collection of names to process; may be empty.
-///
-/// \return The result type identifiers corresponding to the input names.
-///
-/// \throw std::runtime_error If any name in the input names is invalid.
-static result_types
-parse_types(const std::vector< std::string >& names)
-{
-    using engine::test_result;
-    typedef std::map< std::string, test_result::result_type > types_map;
-    types_map valid_types;
-    valid_types["broken"] = test_result::broken;
-    valid_types["failed"] = test_result::failed;
-    valid_types["passed"] = test_result::passed;
-    valid_types["skipped"] = test_result::skipped;
-    valid_types["xfail"] = test_result::expected_failure;
-
-    result_types types;
-    for (std::vector< std::string >::const_iterator iter = names.begin();
-         iter != names.end(); ++iter) {
-        const types_map::const_iterator match = valid_types.find(*iter);
-        if (match == valid_types.end())
-            throw std::runtime_error(F("Unknown result type '%s'") % *iter);
-        else
-            types.push_back((*match).second);
-    }
-    return types;
-}
-
-
 /// Generates a plain-text report intended to be printed to the console.
 class console_hooks : public scan_action::base_hooks {
     /// Indirection to print the output to the correct file stream.
@@ -106,7 +67,7 @@
     const bool _show_context;
 
     /// Collection of result types to include in the report.
-    const result_types& _results_filters;
+    const cli::result_types& _results_filters;
 
     /// The action ID loaded.
     int64_t _action_id;
@@ -218,7 +179,7 @@
     ///     Cannot be empty.
     console_hooks(cmdline::ui* ui_, const fs::path& outfile_,
                   const bool show_context_,
-                  const result_types& results_filters_) :
+                  const cli::result_types& results_filters_) :
         _writer(ui_, outfile_),
         _show_context(show_context_),
         _results_filters(results_filters_)
@@ -265,7 +226,7 @@
         titles[engine::test_result::passed] = "Passed tests";
         titles[engine::test_result::skipped] = "Skipped tests";
 
-        for (result_types::const_iterator iter = _results_filters.begin();
+        for (cli::result_types::const_iterator iter = _results_filters.begin();
              iter != _results_filters.end(); ++iter) {
             const types_map::const_iterator match = titles.find(*iter);
             INV_MSG(match != titles.end(), "Conditional does not match user "
@@ -350,9 +311,7 @@
     add_option(cmdline::path_option(
         "output", "The file to which to write the report",
         "path", "/dev/stdout"));
-    add_option(cmdline::list_option(
-        "results-filter", "Comma-separated list of result types to include in "
-        "the report", "types", "skipped,xfail,broken,failed"));
+    add_option(results_filter_option);
 }
 
 
@@ -372,16 +331,7 @@
     if (cmdline.has_option("action"))
         action_id = cmdline.get_option< cmdline::int_option >("action");
 
-    result_types types = parse_types(
-        cmdline.get_option< cmdline::list_option >("results-filter"));
-    if (types.empty()) {
-        types.push_back(engine::test_result::passed);
-        types.push_back(engine::test_result::skipped);
-        types.push_back(engine::test_result::expected_failure);
-        types.push_back(engine::test_result::broken);
-        types.push_back(engine::test_result::failed);
-    }
-
+    const result_types types = get_result_types(cmdline);
     console_hooks hooks(
         ui, cmdline.get_option< cmdline::path_option >("output"),
         cmdline.has_option("show-context"), types);
diff -r 7bfc504f75fb -r 7d8ebf758282 external/bsd/kyua-cli/dist/cli/cmd_report_html.cpp
--- a/external/bsd/kyua-cli/dist/cli/cmd_report_html.cpp        Fri Oct 18 23:37:37 2013 +0000
+++ b/external/bsd/kyua-cli/dist/cli/cmd_report_html.cpp        Fri Oct 18 23:40:04 2013 +0000
@@ -28,6 +28,7 @@
 
 #include "cli/cmd_report_html.hpp"
 
+#include <algorithm>
 #include <cerrno>
 #include <cstdlib>
 #include <stdexcept>
@@ -139,9 +140,15 @@
     /// The top directory in which to create the HTML files.
     fs::path _directory;
 
+    /// Collection of result types to include in the report.
+    const cli::result_types& _results_filters;
+
     /// Templates accumulator to generate the index.html file.
     text::templates_def _summary_templates;
 
+    /// Mapping of result types to the amount of tests with such result.
+    std::map< engine::test_result::result_type, std::size_t > _types_count;
+
     /// Generates a common set of templates for all of our files.
     ///
     /// \return A new templates object with common parameters.
@@ -157,10 +164,19 @@
     ///
     /// \param test_case The test case to be added.
     /// \param result The result of the test case.
+    /// \param has_detail If true, the result of the test case has not been
+    ///     filtered and therefore there exists a separate file for the test
+    ///     with all of its information.
     void
     add_to_summary(const engine::test_case& test_case,
-                   const engine::test_result& result)
+                   const engine::test_result& result,
+                   const bool has_detail)
     {
+        ++_types_count[result.type()];
+
+        if (!has_detail)
+            return;
+
         std::string test_cases_vector;
         std::string test_cases_file_vector;
         switch (result.type()) {
@@ -221,16 +237,40 @@
         text::instantiate(templates, template_file, output_path);
     }
 
+    /// Gets the number of tests with a given result type.
+    ///
+    /// \param type The type to be queried.
+    ///
+    /// \return The number of tests of the given type, or 0 if none have yet
+    /// been registered by add_to_summary().
+    std::size_t
+    get_count(const engine::test_result::result_type type) const
+    {
+        const std::map< engine::test_result::result_type,
+                        std::size_t >::const_iterator
+            iter = _types_count.find(type);
+        if (iter == _types_count.end())
+            return 0;
+        else
+            return (*iter).second;
+    }
+
 public:
     /// Constructor for the hooks.
     ///
     /// \param ui_ User interface object where to report progress.
     /// \param directory_ The directory in which to create the HTML files.
-    html_hooks(cmdline::ui* ui_, const fs::path& directory_) :
+    /// \param results_filters_ The result types to include in the report.
+    ///     Cannot be empty.
+    html_hooks(cmdline::ui* ui_, const fs::path& directory_,
+               const cli::result_types& results_filters_) :
         _ui(ui_),
         _directory(directory_),
+        _results_filters(results_filters_),
         _summary_templates(common_templates())
     {
+        PRE(!results_filters_.empty());
+
         // Keep in sync with add_to_summary().
         _summary_templates.add_vector("broken_test_cases");
         _summary_templates.add_vector("broken_test_cases_file");
@@ -274,7 +314,13 @@
         const engine::test_case& test_case = *test_program->find(
             iter.test_case_name());
 
-        add_to_summary(test_case, result);
+        if (std::find(_results_filters.begin(), _results_filters.end(),
+                      result.type()) == _results_filters.end()) {
+            add_to_summary(test_case, result, false);
+            return;
+        }



Home | Main Index | Thread Index | Old Index