Inline outputting of subunit in libtorture.
authorJelmer Vernooij <jelmer@samba.org>
Sat, 13 Dec 2014 22:11:06 +0000 (22:11 +0000)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 6 Mar 2015 03:41:47 +0000 (04:41 +0100)
Change-Id: I2c7045c530183a6961cb253540579312c2767330
Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/subunit/c/wscript [deleted file]
lib/torture/subunit.c
lib/torture/wscript_build
lib/update-external.sh
wscript
wscript_build

diff --git a/lib/subunit/c/wscript b/lib/subunit/c/wscript
deleted file mode 100644 (file)
index f308b33..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/env python
-
-import Options
-
-def configure(conf):
-       if conf.CHECK_BUNDLED_SYSTEM_PKG('subunit', pkg='libsubunit'):
-               conf.define('USING_SYSTEM_SUBUNIT', 1)
-
-def build(bld):
-       if bld.CONFIG_SET('USING_SYSTEM_SUBUNIT'):
-               return
-
-       bld.SAMBA_LIBRARY('subunit',
-                         source='lib/child.c',
-                         private_library=True,
-                         includes='include')
index a190975..46f1b65 100644 (file)
 
 #include "includes.h"
 #include "lib/torture/torture.h"
-#include <subunit/child.h>
+
+static void subunit_send_event(char const * const event,
+               char const * const name,
+               char const * const details)
+{
+       if (NULL == details) {
+               printf("%s: %s\n", event, name);
+       } else {
+               printf("%s: %s [\n", event, name);
+               printf("%s", details);
+               if (details[strlen(details) - 1] != '\n')
+                       puts("");
+               puts("]");
+       }
+       fflush(stdout);
+}
 
 static void torture_subunit_suite_start(struct torture_context *ctx,
                                struct torture_suite *suite)
@@ -66,7 +81,7 @@ static void torture_subunit_test_start(struct torture_context *context,
                               struct torture_test *test)
 {
        char *fullname = torture_subunit_test_name(context, context->active_tcase, context->active_test);
-       subunit_test_start(fullname);
+       subunit_send_event("test", fullname, NULL);
        torture_subunit_report_time(context);
        talloc_free(fullname);
 }
@@ -75,21 +90,23 @@ static void torture_subunit_test_result(struct torture_context *context,
                                enum torture_result res, const char *reason)
 {
        char *fullname = torture_subunit_test_name(context, context->active_tcase, context->active_test);
+       const char *result_str = "unknown";
        torture_subunit_report_time(context);
        switch (res) {
        case TORTURE_OK:
-               subunit_test_pass(fullname);
+               result_str = "success";
                break;
        case TORTURE_FAIL:
-               subunit_test_fail(fullname, reason);
+               result_str = "failure";
                break;
        case TORTURE_ERROR:
-               subunit_test_error(fullname, reason);
+               result_str = "error";
                break;
        case TORTURE_SKIP:
-               subunit_test_skip(fullname, reason);
+               result_str = "skip";
                break;
        }
+       subunit_send_event(result_str, fullname, reason);
        talloc_free(fullname);
 }
 
index 732e24a..ad047e2 100644 (file)
@@ -4,6 +4,6 @@ bld.SAMBA_LIBRARY('torture',
        source='torture.c subunit.c simple.c',
        vnum='0.0.1',
        pc_files='torture.pc',
-       public_deps='samba-hostconfig samba-util errors talloc tevent subunit',
+       public_deps='samba-hostconfig samba-util errors talloc tevent',
        public_headers='torture.h'
        )
index 7c55321..d01722e 100755 (executable)
@@ -12,8 +12,6 @@ WORKDIR="`mktemp -d`"
 echo "Updating subunit..."
 git clone git://github.com/testing-cabal/subunit "$WORKDIR/subunit"
 rm -rf "$WORKDIR/subunit/.git"
-# Preserve wscript file
-cp "$LIBDIR/subunit/c/wscript" "$WORKDIR/subunit/c/wscript"
 rsync -avz --delete "$WORKDIR/subunit/" "$LIBDIR/subunit/"
 
 echo "Updating testtools..."
diff --git a/wscript b/wscript
index 2644cbc..f1d2e97 100644 (file)
--- a/wscript
+++ b/wscript
@@ -157,7 +157,6 @@ def configure(conf):
     conf.RECURSE('lib/util/charset')
     conf.RECURSE('source4/auth')
     conf.RECURSE('nsswitch')
-    conf.RECURSE('lib/subunit/c')
     conf.RECURSE('libcli/smbreadline')
     conf.RECURSE('lib/crypto')
     conf.RECURSE('pidl')
index d0fa87b..230f397 100644 (file)
@@ -111,7 +111,6 @@ bld.RECURSE('source4/libcli')
 bld.RECURSE('libcli/smb')
 bld.RECURSE('libcli/util')
 bld.RECURSE('libcli/cldap')
-bld.RECURSE('lib/subunit/c')
 bld.RECURSE('lib/smbconf')
 bld.RECURSE('lib/async_req')
 bld.RECURSE('lib/dbwrap')