Commit 59533e01 authored by bdrewery's avatar bdrewery
Browse files

New port: devel/kyua:

Kyua (pronounced Q.A.) is a testing framework for both developers and
users.  Kyua is different from most other testing frameworks in that it
puts the end user experience before anything else.  There are multiple
reasons for users to run the tests themselves, and Kyua ensures that
they can do so in the most convenient way.

At the moment, Kyua is focused on implementing a solid foundation and a
powerful command-line tool to run tests implemented with the Automated
Testing Framework (ATF).  Later on, Kyua will also provide a set of
language bindings (C, C++ and shell, at the least) to ease the
implementation of test cases in a variety of programming languages.

In effect, Kyua is intended to be a replacement for ATF.

WWW: https://code.google.com/p/kyua/

PR:		ports/177641
Submitted by:	asomers
Reviewed by:	Garrett Cooper <yaneurabeya@gmail.com>
parent 2e722589
......@@ -914,6 +914,7 @@
SUBDIR += kprof
SUBDIR += kscope
SUBDIR += kyra
SUBDIR += kyua
SUBDIR += kyua-testers
SUBDIR += lasi
SUBDIR += lcov
......
# Created by: Alan Somers <asomers@freebsd.org>
# $FreeBSD$
PORTNAME= kyua
PORTVERSION= 0.6
CATEGORIES= devel
MASTER_SITES= ${MASTER_SITE_GOOGLE_CODE}
PROJECTHOST= kyua
DISTNAME= kyua-cli-${DISTVERSIONPREFIX}${DISTVERSION}${DISTVERSIONSUFFIX}
MAINTAINER= asomers@freebsd.org
COMMENT= Kyua (automated testing framework) - Command line interface
LICENSE= BSD
LIB_DEPENDS= lutok:${PORTSDIR}/devel/lutok
LIB_DEPENDS+= sqlite3:${PORTSDIR}/databases/sqlite3
BUILD_DEPENDS= ${LOCALBASE}/libexec/kyua-atf-tester:${PORTSDIR}/devel/kyua-testers
RUN_DEPENDS:= ${BUILD_DEPENDS}
GNU_CONFIGURE= yes
USES= pkgconfig
OPTIONS_DEFINE= DOCS EXAMPLES
.include <bsd.port.options.mk>
CONFIGURE_ARGS+= --without-doxygen
CONFIGURE_ARGS+= --docdir=${DOCSDIR}
# TODO: install the tests, once FreeBSD has a system for ports to install tests
CONFIGURE_ARGS+= --without-atf
MAKE_FLAGS+= pkgdatadir=${DATADIR}
.if ! ${PORT_OPTIONS:MDOCS}
MAKE_FLAGS+= doc_DATA=
.endif
.if ! ${PORT_OPTIONS:MEXAMPLES}
MAKE_FLAGS+= dist_examples_DATA=
.endif
PLIST_FILES= bin/kyua
PORTDATA= misc store examples
PORTDOCS= AUTHORS COPYING NEWS README
MAN1= kyua-about.1 kyua-config.1 kyua-db-exec.1 kyua-db-migrate.1
MAN1+= kyua-debug.1 kyua-help.1 kyua-list.1 kyua-report-html.1
MAN1+= kyua-report.1 kyua-test.1 kyua.1
MAN5= kyua.conf.5 kyuafile.5
MAN7= kyua-build-root.7 kyua-test-filters.7
.include <bsd.port.mk>
SHA256 (kyua-cli-0.6.tar.gz) = b422d63a6db02e806d6da355486dcf6857aa54338d83a0c8b90c7da7dd4f0642
SIZE (kyua-cli-0.6.tar.gz) = 487249
--- utils/config/nodes.cpp.old
+++ utils/config/nodes.cpp
@@ -112,11 +112,11 @@ config::detail::inner_node::lookup_ro(const tree_key& key,
return (*child_iter).second;
} else {
PRE(key_pos < key.size() - 1);
- try {
- const inner_node& child = dynamic_cast< const inner_node& >(
- *(*child_iter).second);
- return child.lookup_ro(key, key_pos + 1);
- } catch (const std::bad_cast& e) {
+ const inner_node* child = dynamic_cast< const inner_node* >(
+ (*child_iter).second);
+ if (child != NULL) {
+ return child->lookup_ro(key, key_pos + 1);
+ } else {
throw unknown_key_error(
key, "Cannot address incomplete configuration property '%s'");
}
@@ -163,21 +163,19 @@ config::detail::inner_node::lookup_rw(const tree_key& key,
}
if (key_pos == key.size() - 1) {
- try {
- leaf_node& child = dynamic_cast< leaf_node& >(
- *(*child_iter).second);
- return &child;
- } catch (const std::bad_cast& unused_error) {
+ leaf_node* child = dynamic_cast< leaf_node* >((*child_iter).second);
+ if (child != NULL) {
+ return child;
+ } else {
throw value_error(F("Invalid value for key '%s'") %
flatten_key(key));
}
} else {
PRE(key_pos < key.size() - 1);
- try {
- inner_node& child = dynamic_cast< inner_node& >(
- *(*child_iter).second);
- return child.lookup_rw(key, key_pos + 1, new_node);
- } catch (const std::bad_cast& e) {
+ inner_node* child = dynamic_cast< inner_node* >((*child_iter).second);
+ if (child != NULL) {
+ return child->lookup_rw(key, key_pos + 1, new_node);
+ } else {
throw unknown_key_error(
key, "Cannot address incomplete configuration property '%s'");
}
@@ -198,13 +196,14 @@ config::detail::inner_node::all_properties(properties_map& properties,
iter != _children.end(); ++iter) {
tree_key child_key = key;
child_key.push_back((*iter).first);
- try {
- leaf_node& child = dynamic_cast< leaf_node& >(*(*iter).second);
- if (child.is_set())
- properties[flatten_key(child_key)] = child.to_string();
- } catch (const std::bad_cast& unused_error) {
- inner_node& child = dynamic_cast< inner_node& >(*(*iter).second);
- child.all_properties(properties, child_key);
+ leaf_node* child = dynamic_cast< leaf_node* >((*iter).second);
+ if (child != NULL) {
+ if (child->is_set())
+ properties[flatten_key(child_key)] = child->to_string();
+ } else {
+ inner_node* child2 = dynamic_cast< inner_node* >((*iter).second);
+ INV(child2 != NULL);
+ child2->all_properties(properties, child_key);
}
}
}
@@ -261,11 +260,11 @@ config::detail::static_inner_node::define(const tree_key& key,
_children.insert(children_map::value_type(key[key_pos], child_ptr));
child_ptr->define(key, key_pos + 1, new_node);
} else {
- try {
- static_inner_node& child = dynamic_cast< static_inner_node& >(
- *(*child_iter).second);
- child.define(key, key_pos + 1, new_node);
- } catch (const std::bad_cast& e) {
+ static_inner_node* child = dynamic_cast< static_inner_node* >(
+ (*child_iter).second);
+ if (child != NULL) {
+ child->define(key, key_pos + 1, new_node);
+ } else {
UNREACHABLE;
}
}
--- utils/config/nodes.ipp.orig 2013-03-28 12:56:35.697127706 -0600
+++ utils/config/nodes.ipp 2013-03-28 12:56:49.139128561 -0600
@@ -39,6 +39,7 @@
#include "utils/format/macros.hpp"
#include "utils/optional.ipp"
#include "utils/text/exceptions.hpp"
+#include "utils/units.hpp"
#include "utils/text/operations.ipp"
#include "utils/sanity.hpp"
--- utils/config/tree.cpp.old
+++ utils/config/tree.cpp
@@ -109,11 +109,10 @@ config::tree::is_set(const std::string& dotted_key) const
const detail::tree_key key = detail::parse_key(dotted_key);
try {
const detail::base_node* raw_node = _root->lookup_ro(key, 0);
- try {
- const leaf_node& child = dynamic_cast< const leaf_node& >(
- *raw_node);
- return child.is_set();
- } catch (const std::bad_cast& unused_error) {
+ const leaf_node* child = dynamic_cast< const leaf_node* >(raw_node);
+ if (child != NULL) {
+ return child->is_set();
+ } else {
return false;
}
} catch (const unknown_key_error& unused_error) {
@@ -134,10 +133,10 @@ config::tree::push_lua(const std::string& dotted_key, lutok::state& state) const
{
const detail::tree_key key = detail::parse_key(dotted_key);
const detail::base_node* raw_node = _root->lookup_ro(key, 0);
- try {
- const leaf_node& child = dynamic_cast< const leaf_node& >(*raw_node);
- child.push_lua(state);
- } catch (const std::bad_cast& unused_error) {
+ const leaf_node* child = dynamic_cast< const leaf_node* >(raw_node);
+ if (child != NULL) {
+ child->push_lua(state);
+ } else {
throw unknown_key_error(key);
}
}
@@ -159,10 +158,10 @@ config::tree::set_lua(const std::string& dotted_key, lutok::state& state,
const detail::tree_key key = detail::parse_key(dotted_key);
detail::base_node* raw_node = _root->lookup_rw(
key, 0, detail::new_node< string_node >);
- try {
- leaf_node& child = dynamic_cast< leaf_node& >(*raw_node);
- child.set_lua(state, value_index);
- } catch (const std::bad_cast& unused_error) {
+ leaf_node* child = dynamic_cast< leaf_node* >(raw_node);
+ if (child != NULL) {
+ child->set_lua(state, value_index);
+ } else {
throw value_error(F("Invalid value for key '%s'") %
detail::flatten_key(key));
}
@@ -182,10 +181,10 @@ config::tree::lookup_string(const std::string& dotted_key) const
{
const detail::tree_key key = detail::parse_key(dotted_key);
const detail::base_node* raw_node = _root->lookup_ro(key, 0);
- try {
- const leaf_node& child = dynamic_cast< const leaf_node& >(*raw_node);
- return child.to_string();
- } catch (const std::bad_cast& unused_error) {
+ const leaf_node* child = dynamic_cast< const leaf_node* >(raw_node);
+ if (child != NULL) {
+ return child->to_string();
+ } else {
throw unknown_key_error(key);
}
}
@@ -210,10 +209,10 @@ config::tree::set_string(const std::string& dotted_key,
const detail::tree_key key = detail::parse_key(dotted_key);
detail::base_node* raw_node = _root->lookup_rw(
key, 0, detail::new_node< string_node >);
- try {
- leaf_node& child = dynamic_cast< leaf_node& >(*raw_node);
- child.set_string(raw_value);
- } catch (const std::bad_cast& unused_error) {
+ leaf_node* child = dynamic_cast< leaf_node* >(raw_node);
+ if (child != NULL) {
+ child->set_string(raw_value);
+ } else {
throw value_error(F("Invalid value for key '%s'") %
detail::flatten_key(key));
}
@@ -247,11 +246,11 @@ config::tree::all_properties(const std::string& dotted_key,
key = detail::parse_key(dotted_key);
raw_node = _root->lookup_ro(key, 0);
}
- try {
- const detail::inner_node& child =
- dynamic_cast< const detail::inner_node& >(*raw_node);
- child.all_properties(properties, key);
- } catch (const std::bad_cast& unused_error) {
+ const detail::inner_node* child =
+ dynamic_cast< const detail::inner_node* >(raw_node);
+ if (child != NULL) {
+ child->all_properties(properties, key);
+ } else {
INV(!dotted_key.empty());
throw value_error(F("Cannot export properties from a leaf node; "
"'%s' given") % dotted_key);
--- utils/config/tree.ipp.old
+++ utils/config/tree.ipp
@@ -79,13 +79,13 @@ config::tree::lookup(const std::string& dotted_key) const
{
const detail::tree_key key = detail::parse_key(dotted_key);
const detail::base_node* raw_node = _root->lookup_ro(key, 0);
- try {
- const LeafType& child = dynamic_cast< const LeafType& >(*raw_node);
- if (child.is_set())
- return child.value();
+ const LeafType* child = dynamic_cast< const LeafType* >(raw_node);
+ if (child != NULL) {
+ if (child->is_set())
+ return child->value();
else
throw unknown_key_error(key);
- } catch (const std::bad_cast& unused_error) {
+ } else {
throw unknown_key_error(key);
}
}
@@ -107,13 +107,13 @@ config::tree::lookup_rw(const std::string& dotted_key)
const detail::tree_key key = detail::parse_key(dotted_key);
detail::base_node* raw_node = _root->lookup_rw(
key, 0, detail::new_node< LeafType >);
- try {
- LeafType& child = dynamic_cast< LeafType& >(*raw_node);
- if (child.is_set())
- return child.value();
+ LeafType* child = dynamic_cast< LeafType* >(raw_node);
+ if (child != NULL) {
+ if (child->is_set())
+ return child->value();
else
throw unknown_key_error(key);
- } catch (const std::bad_cast& unused_error) {
+ } else {
throw unknown_key_error(key);
}
}
@@ -136,10 +136,10 @@ config::tree::set(const std::string& dotted_key,
const detail::tree_key key = detail::parse_key(dotted_key);
leaf_node* raw_node = _root->lookup_rw(key, 0,
detail::new_node< LeafType >);
- try {
- LeafType& child = dynamic_cast< LeafType& >(*raw_node);
- child.set(value);
- } catch (const std::bad_cast& unused_error) {
+ LeafType* child = dynamic_cast< LeafType* >(raw_node);
+ if (child != NULL) {
+ child->set(value);
+ } else {
throw value_error(F("Invalid value for key '%s'") %
detail::flatten_key(key));
}
Kyua (pronounced Q.A.) is a testing framework for both developers and
users. Kyua is different from most other testing frameworks in that it
puts the end user experience before anything else. There are multiple
reasons for users to run the tests themselves, and Kyua ensures that
they can do so in the most convenient way.
At the moment, Kyua is focused on implementing a solid foundation and a
powerful command-line tool to run tests implemented with the Automated
Testing Framework (ATF). Later on, Kyua will also provide a set of
language bindings (C, C++ and shell, at the least) to ease the
implementation of test cases in a variety of programming languages.
In effect, Kyua is intended to be a replacement for ATF.
WWW: https://code.google.com/p/kyua/
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment