summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-03-25 19:12:08 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:59:14 -0500
commit51c08bc26bc58e649b0e684d4dfd4a46485573e5 (patch)
tree617b589a2822b039de4a1420e4035b97be6d3d9f /source4
parent935af3eb1963761b4c8fd9e0e9902ad592f948bf (diff)
downloadsamba-51c08bc26bc58e649b0e684d4dfd4a46485573e5.tar.gz
samba-51c08bc26bc58e649b0e684d4dfd4a46485573e5.tar.bz2
samba-51c08bc26bc58e649b0e684d4dfd4a46485573e5.zip
r14725: Reduce amount of headers, add simple ui implementation (not used yet though)
(This used to be commit 141830116b059f032696c956832451a7b0f7c6cb)
Diffstat (limited to 'source4')
-rw-r--r--source4/torture/smbtorture.c42
1 files changed, 32 insertions, 10 deletions
diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c
index 1520ff741c..8aaa72c019 100644
--- a/source4/torture/smbtorture.c
+++ b/source4/torture/smbtorture.c
@@ -21,20 +21,15 @@
#include "includes.h"
#include "lib/cmdline/popt_common.h"
-#include "libcli/raw/libcliraw.h"
#include "system/time.h"
#include "system/wait.h"
#include "system/filesys.h"
-#include "libcli/raw/ioctl.h"
#include "libcli/libcli.h"
#include "lib/ldb/include/ldb.h"
#include "lib/events/events.h"
-#include "libcli/resolve/resolve.h"
-#include "auth/credentials/credentials.h"
-#include "libcli/ldap/ldap_client.h"
-#include "librpc/gen_ndr/ndr_nbt.h"
#include "torture/torture.h"
+#include "torture/ui.h"
#include "build.h"
#include "dlinklist.h"
#include "librpc/rpc/dcerpc.h"
@@ -44,7 +39,7 @@
/****************************************************************************
run a specified test or "ALL"
****************************************************************************/
-static BOOL run_test(const char *name)
+static BOOL run_test(struct torture_context *torture, const char *name)
{
BOOL ret = True;
struct torture_op *o;
@@ -52,7 +47,7 @@ static BOOL run_test(const char *name)
if (strequal(name,"ALL")) {
for (o = torture_ops; o; o = o->next) {
- if (!run_test(o->name)) {
+ if (!run_test(torture, o->name)) {
ret = False;
}
}
@@ -76,7 +71,7 @@ static BOOL run_test(const char *name)
} else {
struct timeval tv = timeval_current();
- if (!o->fn(NULL)) {
+ if (!o->fn(torture)) {
ret = False;
printf("TEST %s FAILED!\n", o->name);
}
@@ -220,6 +215,27 @@ static void max_runtime_handler(int sig)
exit(1);
}
+static void simple_test_start (struct torture_test *test)
+{
+ printf("Testing %s...\n", test->name);
+}
+
+static void simple_test_result (struct torture_test *test, enum torture_result res)
+{
+ printf("\t %d\n",res);
+}
+
+static void simple_comment (struct torture_test *test, const char *comment)
+{
+ printf("# %s\n", comment);
+}
+
+const static struct torture_ui_ops std_ui_ops = {
+ .comment = simple_comment,
+ .test_start = simple_test_start,
+ .test_result = simple_test_result
+};
+
/****************************************************************************
main program
****************************************************************************/
@@ -230,6 +246,7 @@ static void max_runtime_handler(int sig)
BOOL correct = True;
int max_runtime=0;
int argc_new;
+ struct torture_context *torture;
char **argv_new;
poptContext pc;
enum {OPT_LOADFILE=1000,OPT_UNCLIST,OPT_TIMELIMIT,OPT_DNS,
@@ -357,16 +374,21 @@ static void max_runtime_handler(int sig)
lp_set_cmdline("torture:binding", binding);
}
+ torture = talloc_zero(NULL, struct torture_context);
+ torture->ui_ops = &std_ui_ops;
+
if (argc_new == 0) {
printf("You must specify a test to run, or 'ALL'\n");
} else {
for (i=2;i<argc_new;i++) {
- if (!run_test(argv_new[i])) {
+ if (!run_test(torture, argv_new[i])) {
correct = False;
}
}
}
+ talloc_free(torture);
+
if (correct) {
return(0);
} else {