Commit 1341e647 authored by Jelmer Vernooij's avatar Jelmer Vernooij Committed by Andrew Bartlett

Inline outputting of subunit in libtorture.

Change-Id: I2c7045c530183a6961cb253540579312c2767330
Signed-off-by: Jelmer Vernooij's avatarJelmer Vernooij <jelmer@samba.org>
Reviewed-by: default avatarAndrew Bartlett <abartlet@samba.org>
parent ee0b548e
#!/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')
......@@ -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);
}
......
......@@ -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'
)
......@@ -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..."
......
......@@ -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')
......
......@@ -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')
......
Markdown is supported
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