[PATCH 14/55] Inline outputting of subunit in libtorture.

Jelmer Vernooij jelmer at samba.org
Fri Feb 6 12:03:46 MST 2015


Change-Id: I2c7045c530183a6961cb253540579312c2767330
Signed-off-by: Jelmer Vernooij <jelmer at samba.org>
---
 lib/subunit/c/wscript     | 16 ----------------
 lib/torture/subunit.c     | 29 +++++++++++++++++++++++------
 lib/torture/wscript_build |  2 +-
 lib/update-external.sh    |  2 --
 wscript                   |  1 -
 wscript_build             |  1 -
 6 files changed, 24 insertions(+), 27 deletions(-)
 delete mode 100644 lib/subunit/c/wscript

diff --git a/lib/subunit/c/wscript b/lib/subunit/c/wscript
deleted file mode 100644
index f308b33..0000000
--- a/lib/subunit/c/wscript
+++ /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')
diff --git a/lib/torture/subunit.c b/lib/torture/subunit.c
index a190975..46f1b65 100644
--- a/lib/torture/subunit.c
+++ b/lib/torture/subunit.c
@@ -19,7 +19,22 @@
 
 #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);
 }
 
diff --git a/lib/torture/wscript_build b/lib/torture/wscript_build
index 732e24a..ad047e2 100644
--- a/lib/torture/wscript_build
+++ b/lib/torture/wscript_build
@@ -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'
 	)
diff --git a/lib/update-external.sh b/lib/update-external.sh
index 7c55321..d01722e 100755
--- a/lib/update-external.sh
+++ b/lib/update-external.sh
@@ -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 d5a4ccb..63ccd68 100644
--- a/wscript
+++ b/wscript
@@ -161,7 +161,6 @@ def configure(conf):
     conf.RECURSE('lib/resolv_wrapper')
     conf.RECURSE('lib/socket_wrapper')
     conf.RECURSE('lib/uid_wrapper')
-    conf.RECURSE('lib/subunit/c')
     conf.RECURSE('libcli/smbreadline')
     conf.RECURSE('lib/crypto')
     conf.RECURSE('pidl')
diff --git a/wscript_build b/wscript_build
index fc41974..06e5780 100644
--- a/wscript_build
+++ b/wscript_build
@@ -106,7 +106,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')
-- 
2.1.4



More information about the samba-technical mailing list