summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/build/smb_build/makefile.pm15
-rw-r--r--source4/lib/talloc/config.mk4
-rw-r--r--source4/main.mk7
-rwxr-xr-xsource4/script/installtorture.sh18
-rwxr-xr-xsource4/script/uninstalltorture.sh15
-rw-r--r--source4/torture/local/dbspeed.c2
-rw-r--r--source4/torture/smbtorture.c38
-rw-r--r--source4/torture/torture.c35
-rw-r--r--source4/torture/torture.h7
-rw-r--r--source4/torture/ui.c9
-rw-r--r--source4/torture/ui.h4
11 files changed, 84 insertions, 70 deletions
diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm
index 0d448773a6..91ee7186a5 100644
--- a/source4/build/smb_build/makefile.pm
+++ b/source4/build/smb_build/makefile.pm
@@ -366,18 +366,17 @@ sub Binary($$)
my ($self,$ctx) = @_;
my $installdir;
- my $localdir;
+ my $extradir = "";
- if (defined($ctx->{INSTALLDIR}) && $ctx->{INSTALLDIR} eq "TORTUREDIR") {
- $localdir = "bin/torture";
- } else {
- $localdir = "bin";
+ if (defined($ctx->{INSTALLDIR}) && $ctx->{INSTALLDIR} =~ /^TORTUREDIR/) {
+ $extradir = "/torture" . substr($ctx->{INSTALLDIR}, length("TORTUREDIR"));
}
+ my $localdir = "bin$extradir";
if ($self->{duplicate_build}) {
- $installdir = "bin/install";
+ $installdir = "bin/install$extradir";
} else {
- $installdir = $localdir;
+ $installdir = "bin$extradir";
}
push(@{$self->{all_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST)");
@@ -387,7 +386,7 @@ sub Binary($$)
push (@{$self->{sbin_progs}}, "$installdir/$ctx->{BINARY}");
} elsif ($ctx->{INSTALLDIR} eq "BINDIR") {
push (@{$self->{bin_progs}}, "$installdir/$ctx->{BINARY}");
- } elsif ($ctx->{INSTALLDIR} eq "TORTUREDIR") {
+ } elsif ($ctx->{INSTALLDIR} =~ /^TORTUREDIR/) {
push (@{$self->{torture_progs}}, "$installdir/$ctx->{BINARY}");
}
diff --git a/source4/lib/talloc/config.mk b/source4/lib/talloc/config.mk
index 19059ca4dc..0b06687dab 100644
--- a/source4/lib/talloc/config.mk
+++ b/source4/lib/talloc/config.mk
@@ -12,7 +12,7 @@ DESCRIPTION = A hierarchical pool based memory system with destructors
# End LIBRARY LIBTALLOC
################################################
-[BINARY::LOCAL-TALLOC]
+[BINARY::TALLOC]
OBJ_FILES = testsuite.o
PRIVATE_DEPENDENCIES = LIBTALLOC
-INSTALLDIR = TORTUREDIR
+INSTALLDIR = TORTUREDIR/LOCAL
diff --git a/source4/main.mk b/source4/main.mk
index 42c471da80..3767ecab10 100644
--- a/source4/main.mk
+++ b/source4/main.mk
@@ -136,12 +136,9 @@ installbin: $(SBIN_PROGS) $(BIN_PROGS) installdirs
$(DESTDIR)$(LIBDIR) \
$(DESTDIR)$(VARDIR) \
$(BIN_PROGS)
- @$(SHELL) $(srcdir)/script/installbin.sh \
+ @$(SHELL) $(srcdir)/script/installtorture.sh \
$(INSTALLPERMS) \
- $(DESTDIR)$(BASEDIR) \
$(DESTDIR)$(TORTUREDIR) \
- $(DESTDIR)$(LIBDIR) \
- $(DESTDIR)$(VARDIR) \
$(TORTURE_PROGS)
installlib: $(INSTALLABLE_SHARED_LIBS) $(STATIC_LIBS) installdirs
@@ -175,7 +172,7 @@ uninstallmisc:
uninstallbin:
@$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(SBIN_PROGS)
@$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(BIN_PROGS)
- @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(TORTUREDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(TORTURE_PROGS)
+ @$(SHELL) $(srcdir)/script/uninstalltorture.sh $(DESTDIR)$(TORTUREDIR) $(TORTURE_PROGS)
uninstalllib:
@$(SHELL) $(srcdir)/script/uninstalllib.sh $(DESTDIR)$(LIBDIR) $(SHARED_LIBS)
diff --git a/source4/script/installtorture.sh b/source4/script/installtorture.sh
new file mode 100755
index 0000000000..db7ad9110c
--- /dev/null
+++ b/source4/script/installtorture.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+INSTALLPERMS=$1
+TORTUREDIR=$2
+shift
+shift
+
+for p in $*; do
+ p2=`dirname $p`
+ base=`basename $p`
+ DESTDIR=$TORTUREDIR/`basename $p2`
+ mkdir -p $DESTDIR
+ echo Installing $p as $DESTDIR/$base
+ cp -f $p $DESTDIR/
+ chmod $INSTALLPERMS $DESTDIR/$base
+done
+
+exit 0
diff --git a/source4/script/uninstalltorture.sh b/source4/script/uninstalltorture.sh
new file mode 100755
index 0000000000..0c6e4ec991
--- /dev/null
+++ b/source4/script/uninstalltorture.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+TORTUREDIR=$1
+shift
+shift
+
+for p in $*; do
+ p2=`dirname $p`
+ base=`basename $p`
+ DESTDIR=$TORTUREDIR/`basename $p2`
+ echo Removing $DESTDIR/$base
+ rm -f $p $DESTDIR/
+done
+
+exit 0
diff --git a/source4/torture/local/dbspeed.c b/source4/torture/local/dbspeed.c
index 757c13cf6e..3f9607eb81 100644
--- a/source4/torture/local/dbspeed.c
+++ b/source4/torture/local/dbspeed.c
@@ -245,7 +245,7 @@ failed:
struct torture_suite *torture_local_dbspeed(TALLOC_CTX *mem_ctx)
{
- struct torture_suite *s = torture_suite_create(mem_ctx, "LOCAL-DBSPEED");
+ struct torture_suite *s = torture_suite_create(mem_ctx, "DBSPEED");
torture_suite_add_simple_tcase(s, "tdb_speed", test_tdb_speed, NULL);
torture_suite_add_simple_tcase(s, "ldb_speed", test_ldb_speed, NULL);
return s;
diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c
index 3d7a75f8cf..3733d72492 100644
--- a/source4/torture/smbtorture.c
+++ b/source4/torture/smbtorture.c
@@ -43,18 +43,18 @@ static bool run_matching(struct torture_context *torture,
bool ret = true;
if (suite == NULL) {
- struct torture_suite_list *o;
+ struct torture_suite *o;
- for (o = torture_suites; o; o = o->next) {
- if (gen_fnmatch(expr, o->suite->name) == 0) {
+ for (o = torture_root->children; o; o = o->next) {
+ if (gen_fnmatch(expr, o->name) == 0) {
*matched = true;
init_iconv();
- ret &= torture_run_suite(torture, o->suite);
+ ret &= torture_run_suite(torture, o);
continue;
}
ret &= run_matching(torture,
- o->suite->name, expr, o->suite, matched);
+ o->name, expr, o, matched);
}
} else {
char *name;
@@ -99,11 +99,11 @@ static bool run_test(struct torture_context *torture, const char *name)
{
bool ret = true;
bool matched = false;
- struct torture_suite_list *o;
+ struct torture_suite *o;
if (strequal(name, "ALL")) {
- for (o = torture_suites; o; o = o->next) {
- ret &= torture_run_suite(torture, o->suite);
+ for (o = torture_root->children; o; o = o->next) {
+ ret &= torture_run_suite(torture, o);
}
return ret;
}
@@ -160,7 +160,7 @@ static void parse_dns(const char *dns)
static void usage(poptContext pc)
{
- struct torture_suite_list *o;
+ struct torture_suite *o;
struct torture_suite *s;
struct torture_tcase *t;
int i;
@@ -217,24 +217,24 @@ static void usage(poptContext pc)
printf("Tests are:");
- for (o = torture_suites; o; o = o->next) {
- printf("\n%s (%s):\n ", o->suite->description, o->suite->name);
+ for (o = torture_root->children; o; o = o->next) {
+ printf("\n%s (%s):\n ", o->description, o->name);
i = 0;
- for (s = o->suite->children; s; s = s->next) {
- if (i + strlen(o->suite->name) + strlen(s->name) >= (MAX_COLS - 3)) {
+ for (s = o->children; s; s = s->next) {
+ if (i + strlen(o->name) + strlen(s->name) >= (MAX_COLS - 3)) {
printf("\n ");
i = 0;
}
- i+=printf("%s-%s ", o->suite->name, s->name);
+ i+=printf("%s-%s ", o->name, s->name);
}
- for (t = o->suite->testcases; t; t = t->next) {
- if (i + strlen(o->suite->name) + strlen(t->name) >= (MAX_COLS - 3)) {
+ for (t = o->testcases; t; t = t->next) {
+ if (i + strlen(o->name) + strlen(t->name) >= (MAX_COLS - 3)) {
printf("\n ");
i = 0;
}
- i+=printf("%s-%s ", o->suite->name, t->name);
+ i+=printf("%s-%s ", o->name, t->name);
}
if (i) printf("\n");
@@ -532,10 +532,10 @@ const static struct torture_ui_ops quiet_ui_ops = {
subunit_dir = lp_parm_string_list(-1, "torture", "subunitdir", ":");
if (subunit_dir == NULL)
- torture_subunit_load_testsuites(dyn_TORTUREDIR);
+ torture_subunit_load_testsuites(dyn_TORTUREDIR, true, NULL);
else {
for (i = 0; subunit_dir[i]; i++)
- torture_subunit_load_testsuites(subunit_dir[i]);
+ torture_subunit_load_testsuites(subunit_dir[i], true, NULL);
}
diff --git a/source4/torture/torture.c b/source4/torture/torture.c
index d5cb0511f7..f83a7330c2 100644
--- a/source4/torture/torture.c
+++ b/source4/torture/torture.c
@@ -33,42 +33,23 @@ _PUBLIC_ int torture_seed=0;
_PUBLIC_ int torture_numasync=100;
_PUBLIC_ bool torture_showall = false;
-struct torture_suite_list *torture_suites = NULL;
+struct torture_suite *torture_root = NULL;
-NTSTATUS torture_register_suite(struct torture_suite *suite)
+bool torture_register_suite(struct torture_suite *suite)
{
- struct torture_suite_list *p, *n;
+ if (!suite)
+ return true;
- if (!suite) {
- return NT_STATUS_OK;
- }
-
- n = talloc(talloc_autofree_context(), struct torture_suite_list);
- n->suite = suite;
-
- for (p = torture_suites; p; p = p->next) {
- if (strcmp(p->suite->name, suite->name) == 0) {
- /* Check for duplicates */
- DEBUG(0,("There already is a suite registered with the name %s!\n", suite->name));
- return NT_STATUS_OBJECT_NAME_COLLISION;
- }
-
- if (strcmp(p->suite->name, suite->name) < 0 &&
- (!p->next || strcmp(p->next->suite->name, suite->name) > 0)) {
- DLIST_ADD_AFTER(torture_suites, n, p);
- return NT_STATUS_OK;
- }
- }
-
- DLIST_ADD_END(torture_suites, n, struct torture_suite_list *);
-
- return NT_STATUS_OK;
+ return torture_suite_add_suite(torture_root, suite);
}
int torture_init(void)
{
init_module_fn static_init[] = STATIC_torture_MODULES;
init_module_fn *shared_init = load_samba_modules(NULL, "torture");
+
+ torture_root = talloc_zero(talloc_autofree_context(),
+ struct torture_suite);
run_init_functions(static_init);
run_init_functions(shared_init);
diff --git a/source4/torture/torture.h b/source4/torture/torture.h
index 1a1cd7aba9..a88c1c3654 100644
--- a/source4/torture/torture.h
+++ b/source4/torture/torture.h
@@ -26,12 +26,7 @@
struct smbcli_state;
-struct torture_suite_list {
- struct torture_suite *suite;
- struct torture_suite_list *prev, *next;
-};
-
-extern struct torture_suite_list * torture_suites;
+extern struct torture_suite *torture_root;
extern BOOL use_oplocks;
extern BOOL torture_showall;
diff --git a/source4/torture/ui.c b/source4/torture/ui.c
index 32b632a3e8..d8bff6cca3 100644
--- a/source4/torture/ui.c
+++ b/source4/torture/ui.c
@@ -394,9 +394,14 @@ bool torture_suite_add_suite(struct torture_suite *suite,
}
-struct torture_suite *torture_find_suite(const char *name)
+struct torture_suite *torture_find_suite(struct torture_suite *parent,
+ const char *name)
{
- /* FIXME */
+ struct torture_suite *child;
+
+ for (child = parent->children; child; child = child->next)
+ if (!strcmp(child->name, name))
+ return child;
return NULL;
}
diff --git a/source4/torture/ui.h b/source4/torture/ui.h
index b4e3585031..b145989046 100644
--- a/source4/torture/ui.h
+++ b/source4/torture/ui.h
@@ -294,4 +294,8 @@ bool torture_setting_bool(struct torture_context *test,
/* Helper function commonly used */
bool torture_teardown_free(struct torture_context *torture, void *data);
+struct torture_suite *torture_find_suite(struct torture_suite *parent,
+ const char *name);
+
+
#endif /* __TORTURE_UI_H__ */