Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC)
- Fix for possible unset uid/gid in toproto
- Fix for default mtree style
- Update libelf
- Importing libexecinfo
- Resynchronize GCC, mpc, gmp, mpfr
- build.sh: Replace params with show-params.
This has been done as the make target has been renamed in the same
way, while a new target named params has been added. This new
target generates a file containing all the parameters, instead of
printing it on the console.
- Update test48 with new etc/services (Fix by Ben Gras <ben@minix3.org)
get getservbyport() out of the inner loop
Change-Id: Ie6ad5226fa2621ff9f0dee8782ea48f9443d2091
This commit is contained in:
67
external/bsd/kyua-cli/dist/cli/common.cpp
vendored
67
external/bsd/kyua-cli/dist/cli/common.cpp
vendored
@@ -68,6 +68,12 @@ const cmdline::path_option cli::kyuafile_option(
|
||||
"file", "Kyuafile");
|
||||
|
||||
|
||||
/// Standard definition of the option to specify filters on test results.
|
||||
const cmdline::list_option cli::results_filter_option(
|
||||
"results-filter", "Comma-separated list of result types to include in "
|
||||
"the report", "types", "skipped,xfail,broken,failed");
|
||||
|
||||
|
||||
/// Standard definition of the option to specify the store.
|
||||
const cmdline::path_option cli::store_option(
|
||||
's', "store",
|
||||
@@ -75,6 +81,44 @@ const cmdline::path_option cli::store_option(
|
||||
"file", "~/.kyua/store.db");
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
|
||||
/// 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 cli::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;
|
||||
|
||||
cli::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;
|
||||
}
|
||||
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
|
||||
/// Gets the path to the build root, if any.
|
||||
///
|
||||
/// This is just syntactic sugar to simplify quierying the 'build_root_option'.
|
||||
@@ -129,6 +173,29 @@ cli::kyuafile_path(const cmdline::parsed_cmdline& cmdline)
|
||||
}
|
||||
|
||||
|
||||
/// Gets the filters for the result types.
|
||||
///
|
||||
/// \param cmdline The parsed command line.
|
||||
///
|
||||
/// \return A collection of result types to be used for filtering.
|
||||
///
|
||||
/// \throw std::runtime_error If any of the user-provided filters is invalid.
|
||||
cli::result_types
|
||||
cli::get_result_types(const utils::cmdline::parsed_cmdline& cmdline)
|
||||
{
|
||||
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);
|
||||
}
|
||||
return types;
|
||||
}
|
||||
|
||||
|
||||
/// Gets the path to the store to be used.
|
||||
///
|
||||
/// This has the side-effect of creating the directory in which to store the
|
||||
|
||||
Reference in New Issue
Block a user