Source-Changes-HG archive

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

[src/trunk]: src/external/bsd/kyua-testers/dist Initial import of Kyua Tester...



details:   https://anonhg.NetBSD.org/src/rev/513048d4ad92
branches:  trunk
changeset: 785033:513048d4ad92
user:      jmmv <jmmv%NetBSD.org@localhost>
date:      Tue Feb 19 06:01:39 2013 +0000

description:
Initial import of Kyua Testers, version 0.1:

This is a component of Kyua and its build will be guarded by the MKKYUA
knob.  core@ has approved this import.

Description:

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.

This module, kyua-testers, provides scriptable interfaces to interact
with test programs of various kinds.  The interface of such testers
allows the caller to execute a single test case of a single test program
in a controlled and homogeneous manner.

diffstat:

 external/bsd/kyua-testers/dist/AUTHORS                |    1 +
 external/bsd/kyua-testers/dist/COPYING                |   27 +
 external/bsd/kyua-testers/dist/Kyuafile               |   21 +
 external/bsd/kyua-testers/dist/NEWS                   |   16 +
 external/bsd/kyua-testers/dist/README                 |   22 +
 external/bsd/kyua-testers/dist/atf_helpers.c          |  193 ++++
 external/bsd/kyua-testers/dist/atf_inttest.c          |  284 ++++++
 external/bsd/kyua-testers/dist/atf_list.c             |  333 +++++++
 external/bsd/kyua-testers/dist/atf_list.h             |   43 +
 external/bsd/kyua-testers/dist/atf_list_test.c        |  237 +++++
 external/bsd/kyua-testers/dist/atf_main.c             |  523 +++++++++++
 external/bsd/kyua-testers/dist/atf_result.c           |  763 +++++++++++++++++
 external/bsd/kyua-testers/dist/atf_result.h           |   46 +
 external/bsd/kyua-testers/dist/atf_result_test.c      |  533 ++++++++++++
 external/bsd/kyua-testers/dist/cli.c                  |  260 +++++
 external/bsd/kyua-testers/dist/cli.h                  |  103 ++
 external/bsd/kyua-testers/dist/cli_fwd.h              |   43 +
 external/bsd/kyua-testers/dist/cli_test.c             |  607 +++++++++++++
 external/bsd/kyua-testers/dist/common_inttest.h       |  180 ++++
 external/bsd/kyua-testers/dist/env.c                  |  105 ++
 external/bsd/kyua-testers/dist/env.h                  |   42 +
 external/bsd/kyua-testers/dist/env_test.c             |   61 +
 external/bsd/kyua-testers/dist/error.c                |  576 +++++++++++++
 external/bsd/kyua-testers/dist/error.h                |  117 ++
 external/bsd/kyua-testers/dist/error_fwd.h            |   43 +
 external/bsd/kyua-testers/dist/error_test.c           |  416 +++++++++
 external/bsd/kyua-testers/dist/fs.c                   |  577 +++++++++++++
 external/bsd/kyua-testers/dist/fs.h                   |   45 +
 external/bsd/kyua-testers/dist/fs_test.c              |  576 +++++++++++++
 external/bsd/kyua-testers/dist/kyua-atf-interface.7   |  405 +++++++++
 external/bsd/kyua-testers/dist/kyua-atf-tester.1.in   |  133 +++
 external/bsd/kyua-testers/dist/kyua-plain-interface.7 |   63 +
 external/bsd/kyua-testers/dist/kyua-plain-tester.1.in |   60 +
 external/bsd/kyua-testers/dist/kyua-tester-list.5     |  103 ++
 external/bsd/kyua-testers/dist/kyua-tester-result.5   |   66 +
 external/bsd/kyua-testers/dist/kyua-tester.1.in       |  205 ++++
 external/bsd/kyua-testers/dist/kyua-testers.pc.in     |    5 +
 external/bsd/kyua-testers/dist/plain_helpers.c        |  110 ++
 external/bsd/kyua-testers/dist/plain_inttest.c        |  179 ++++
 external/bsd/kyua-testers/dist/plain_main.c           |  196 ++++
 external/bsd/kyua-testers/dist/result.c               |   81 +
 external/bsd/kyua-testers/dist/result.h               |   53 +
 external/bsd/kyua-testers/dist/result_test.c          |  119 ++
 external/bsd/kyua-testers/dist/run.c                  |  594 +++++++++++++
 external/bsd/kyua-testers/dist/run.h                  |   85 +
 external/bsd/kyua-testers/dist/run_fwd.h              |   43 +
 external/bsd/kyua-testers/dist/run_test.c             |  790 ++++++++++++++++++
 external/bsd/kyua-testers/dist/stacktrace.c           |  364 ++++++++
 external/bsd/kyua-testers/dist/stacktrace.h           |   50 +
 external/bsd/kyua-testers/dist/stacktrace_helper.c    |   36 +
 external/bsd/kyua-testers/dist/stacktrace_test.c      |  327 +++++++
 external/bsd/kyua-testers/dist/text.c                 |  117 ++
 external/bsd/kyua-testers/dist/text.h                 |   46 +
 external/bsd/kyua-testers/dist/text_test.c            |  112 ++
 54 files changed, 11135 insertions(+), 0 deletions(-)

diffs (truncated from 11351 to 300 lines):

diff -r 63de4a9c3a23 -r 513048d4ad92 external/bsd/kyua-testers/dist/AUTHORS
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/kyua-testers/dist/AUTHORS    Tue Feb 19 06:01:39 2013 +0000
@@ -0,0 +1,1 @@
+* Julio Merino <jmmv%google.com@localhost>
diff -r 63de4a9c3a23 -r 513048d4ad92 external/bsd/kyua-testers/dist/COPYING
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/kyua-testers/dist/COPYING    Tue Feb 19 06:01:39 2013 +0000
@@ -0,0 +1,27 @@
+Copyright 2012 Google Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in the
+  documentation and/or other materials provided with the distribution.
+* Neither the name of Google Inc. nor the names of its contributors
+  may be used to endorse or promote products derived from this software
+  without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff -r 63de4a9c3a23 -r 513048d4ad92 external/bsd/kyua-testers/dist/Kyuafile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/kyua-testers/dist/Kyuafile   Tue Feb 19 06:01:39 2013 +0000
@@ -0,0 +1,21 @@
+syntax("kyuafile", 1)
+
+test_suite("kyua")
+
+-- Tests for common modules.
+atf_test_program{name="cli_test"}
+atf_test_program{name="env_test"}
+atf_test_program{name="error_test"}
+atf_test_program{name="fs_test"}
+atf_test_program{name="result_test"}
+atf_test_program{name="run_test"}
+atf_test_program{name="stacktrace_test"}
+atf_test_program{name="text_test"}
+
+-- Tests for the atf_tester.
+atf_test_program{name="atf_list_test"}
+atf_test_program{name="atf_result_test"}
+atf_test_program{name="atf_inttest"}
+
+-- Tests for the plain_tester.
+atf_test_program{name="plain_inttest"}
diff -r 63de4a9c3a23 -r 513048d4ad92 external/bsd/kyua-testers/dist/NEWS
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/kyua-testers/dist/NEWS       Tue Feb 19 06:01:39 2013 +0000
@@ -0,0 +1,16 @@
+Changes in version 0.1
+======================
+
+Experimental version released on February 19th, 2013.
+
+This is the first public release of the kyua-testers package.
+
+The goal of this first release is to adopt all the test case execution
+code of kyua-cli 0.5 and ship it as a collection of independent tester
+binaries.  The kyua-cli package will rely on these binaries to run the
+tests, which provides better modularity and simplicity to the
+architecture of Kyua.
+
+The code in this package is all C as opposed to the current C++ codebase
+of kyua-cli, which means that the overall build times of Kyua are now
+reduced.
diff -r 63de4a9c3a23 -r 513048d4ad92 external/bsd/kyua-testers/dist/README
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/kyua-testers/dist/README     Tue Feb 19 06:01:39 2013 +0000
@@ -0,0 +1,22 @@
+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.
+
+This module, kyua-testers, provides scriptable interfaces to interact
+with test programs of various kinds.  The interface of such testers
+allows the caller to execute a single test case of a single test program
+in a controlled and homogeneous manner.
+
+For further information on the contents of this distribution file,
+please refer to the following other documents:
+
+* AUTHORS: List of authors and contributors to this project.
+* COPYING: License information.
+* INSTALL: Compilation and installation instructions.
+* NEWS: List of major changes between formal releases.
+
+For general project information, please visit:
+
+    http://code.google.com/p/kyua/
diff -r 63de4a9c3a23 -r 513048d4ad92 external/bsd/kyua-testers/dist/atf_helpers.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/kyua-testers/dist/atf_helpers.c      Tue Feb 19 06:01:39 2013 +0000
@@ -0,0 +1,193 @@
+// Copyright 2012 Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+//   notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above copyright
+//   notice, this list of conditions and the following disclaimer in the
+//   documentation and/or other materials provided with the distribution.
+// * Neither the name of Google Inc. nor the names of its contributors
+//   may be used to endorse or promote products derived from this software
+//   without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <atf-c.h>
+
+
+ATF_TC_WITHOUT_HEAD(fail);
+ATF_TC_BODY(fail, tc)
+{
+    fprintf(stdout, "First line to stdout\n");
+    fprintf(stderr, "First line to stderr\n");
+    atf_tc_fail("This is the failure message");
+}
+
+
+ATF_TC_WITHOUT_HEAD(pass);
+ATF_TC_BODY(pass, tc)
+{
+    fprintf(stdout, "First line to stdout\n");
+    fprintf(stdout, "Second line to stdout\n");
+    fprintf(stderr, "First line to stderr\n");
+    fprintf(stderr, "Second line to stderr\n");
+}
+
+
+ATF_TC_WITHOUT_HEAD(signal);
+ATF_TC_BODY(signal, tc)
+{
+    fprintf(stderr, "About to die due to SIGABRT!\n");
+    abort();
+}
+
+
+ATF_TC_WITHOUT_HEAD(sleep);
+ATF_TC_BODY(sleep, tc)
+{
+    sleep(300);
+}
+
+
+ATF_TC_WITH_CLEANUP(cleanup_check_work_directory);
+ATF_TC_HEAD(cleanup_check_work_directory, tc) { }
+ATF_TC_BODY(cleanup_check_work_directory, tc)
+{
+    fprintf(stdout, "Body stdout\n");
+    fprintf(stderr, "Body stderr\n");
+    atf_utils_create_file("cookie-in-work-directory", "the value\n");
+}
+ATF_TC_CLEANUP(cleanup_check_work_directory, tc)
+{
+    fprintf(stdout, "Cleanup stdout\n");
+    fprintf(stderr, "Cleanup stderr\n");
+    if (atf_utils_compare_file("cookie-in-work-directory", "the value\n")) {
+        printf("Cleanup properly ran in the same directory as the body\n");
+    } else {
+        printf("Cleanup did not run in the same directory as the body\n");
+    }
+}
+
+
+ATF_TC_WITH_CLEANUP(cleanup_fail);
+ATF_TC_HEAD(cleanup_fail, tc) { }
+ATF_TC_BODY(cleanup_fail, tc)
+{
+}
+ATF_TC_CLEANUP(cleanup_fail, tc)
+{
+    exit(EXIT_FAILURE);
+}
+
+
+ATF_TC_WITH_CLEANUP(cleanup_signal);
+ATF_TC_HEAD(cleanup_signal, tc) { }
+ATF_TC_BODY(cleanup_signal, tc) { }
+ATF_TC_CLEANUP(cleanup_signal, tc)
+{
+    fprintf(stderr, "About to die due to SIGABRT!\n");
+    abort();
+}
+
+
+ATF_TC_WITH_CLEANUP(cleanup_sleep);
+ATF_TC_HEAD(cleanup_sleep, tc) { }
+ATF_TC_BODY(cleanup_sleep, tc) { }
+ATF_TC_CLEANUP(cleanup_sleep, tc)
+{
+    sleep(300);
+}
+
+
+ATF_TC_WITH_CLEANUP(body_and_cleanup_fail);
+ATF_TC_HEAD(body_and_cleanup_fail, tc) { }
+ATF_TC_BODY(body_and_cleanup_fail, tc)
+{
+    atf_tc_fail("Body fails");
+}
+ATF_TC_CLEANUP(body_and_cleanup_fail, tc)
+{
+    printf("Killing cleanup\n");
+    fflush(stdout);
+    kill(getpid(), SIGKILL);
+}
+
+
+/// Prints a configuration variable if it exists.
+///
+/// \param tc Caller test case.
+/// \param part Identifier for the part of the test case.
+/// \param name Name of the configuration variable.
+static void
+print_config_var(const atf_tc_t* tc, const char* part, const char* name)
+{
+    if (atf_tc_has_config_var(tc, name))
+        printf("%s %s %s\n", part, name, atf_tc_get_config_var(tc, name));
+}
+
+
+/// Prints the configuration variables of the test case.
+///
+/// Ideally we'd print all variables but the ATF interface does not have an API
+/// to iterate over them all.  Instead, this just prints the variables we are
+/// interested in for testing purposes.
+///
+/// \param tc Caller test case.
+/// \param part Identifier for the part of the test case.
+static void
+print_config_vars(const atf_tc_t* tc, const char* part)
+{
+    print_config_var(tc, part, "my-var1");
+    print_config_var(tc, part, "v2");
+}
+
+
+ATF_TC_WITH_CLEANUP(print_config);
+ATF_TC_HEAD(print_config, tc) {}
+ATF_TC_BODY(print_config, tc)
+{
+    print_config_vars(tc, "body");
+}
+ATF_TC_CLEANUP(print_config, tc)
+{
+    print_config_vars(tc, "cleanup");
+}
+
+
+ATF_TP_ADD_TCS(tp)
+{
+    ATF_TP_ADD_TC(tp, fail);
+    ATF_TP_ADD_TC(tp, pass);
+    ATF_TP_ADD_TC(tp, signal);
+    ATF_TP_ADD_TC(tp, sleep);
+
+    ATF_TP_ADD_TC(tp, cleanup_check_work_directory);
+    ATF_TP_ADD_TC(tp, cleanup_fail);
+    ATF_TP_ADD_TC(tp, cleanup_signal);
+    ATF_TP_ADD_TC(tp, cleanup_sleep);
+
+    ATF_TP_ADD_TC(tp, body_and_cleanup_fail);
+



Home | Main Index | Thread Index | Old Index