From 1341e6477277dd8f21f419aa79d9517bba4caf0c Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 13 Dec 2014 22:11:06 +0000 Subject: Inline outputting of subunit in libtorture. Change-Id: I2c7045c530183a6961cb253540579312c2767330 Signed-off-by: Jelmer Vernooij Reviewed-by: Andrew Bartlett --- 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 f308b33e0f..0000000000 --- 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 a190975a08..46f1b65053 100644 --- a/lib/torture/subunit.c +++ b/lib/torture/subunit.c @@ -19,7 +19,22 @@ #include "includes.h" #include "lib/torture/torture.h" -#include + +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 732e24a822..ad047e211f 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 7c55321398..d01722e164 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 2644cbc132..f1d2e971fe 100644 --- 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') diff --git a/wscript_build b/wscript_build index d0fa87b81e..230f397dc7 100644 --- a/wscript_build +++ b/wscript_build @@ -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') -- cgit