1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00

Inline outputting of subunit in libtorture.

Change-Id: I2c7045c530183a6961cb253540579312c2767330
Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Jelmer Vernooij 2014-12-13 22:11:06 +00:00 committed by Andrew Bartlett
parent ee0b548e9d
commit 1341e64772
6 changed files with 24 additions and 27 deletions

View File

@ -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')

View File

@ -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);
}

View 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'
)

View File

@ -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..."

View File

@ -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')

View 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')