summaryrefslogtreecommitdiff
path: root/source4/torture/smb2/smb2.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-05-23 16:24:07 +0200
committerJelmer Vernooij <jelmer@samba.org>2008-05-23 16:24:07 +0200
commitcceac63aaab26a72e2f3fd150dd1e4e83a0e5279 (patch)
tree6203cca724fc5f17f068e3fd4d0b403fdff3f8f9 /source4/torture/smb2/smb2.c
parent7c7880695b02df4cbe0faab959846c63d0cc0536 (diff)
parent72fce654072b2d7317ff21c95558bd365701d5dd (diff)
downloadsamba-cceac63aaab26a72e2f3fd150dd1e4e83a0e5279.tar.gz
samba-cceac63aaab26a72e2f3fd150dd1e4e83a0e5279.tar.bz2
samba-cceac63aaab26a72e2f3fd150dd1e4e83a0e5279.zip
Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into v4-0-wsgi
Conflicts: source/scripting/python/samba/provision.py (This used to be commit d27de633656f8a699222df77c4c58326890889a2)
Diffstat (limited to 'source4/torture/smb2/smb2.c')
-rw-r--r--source4/torture/smb2/smb2.c65
1 files changed, 61 insertions, 4 deletions
diff --git a/source4/torture/smb2/smb2.c b/source4/torture/smb2/smb2.c
index d07611264b..37eadcf7fd 100644
--- a/source4/torture/smb2/smb2.c
+++ b/source4/torture/smb2/smb2.c
@@ -21,7 +21,7 @@
#include "libcli/smb2/smb2.h"
#include "libcli/smb2/smb2_calls.h"
-#include "torture/torture.h"
+#include "torture/smbtorture.h"
#include "torture/smb2/proto.h"
#include "lib/util/dlinklist.h"
@@ -47,9 +47,9 @@ static bool wrap_simple_1smb2_test(struct torture_context *torture_ctx,
}
struct torture_test *torture_suite_add_1smb2_test(struct torture_suite *suite,
- const char *name,
- bool (*run) (struct torture_context *,
- struct smb2_tree *))
+ const char *name,
+ bool (*run)(struct torture_context *,
+ struct smb2_tree *))
{
struct torture_test *test;
struct torture_tcase *tcase;
@@ -69,6 +69,61 @@ struct torture_test *torture_suite_add_1smb2_test(struct torture_suite *suite,
return test;
}
+
+static bool wrap_simple_2smb2_test(struct torture_context *torture_ctx,
+ struct torture_tcase *tcase,
+ struct torture_test *test)
+{
+ bool (*fn) (struct torture_context *, struct smb2_tree *, struct smb2_tree *);
+ bool ret;
+
+ struct smb2_tree *tree1;
+ struct smb2_tree *tree2;
+ TALLOC_CTX *mem_ctx = talloc_new(torture_ctx);
+
+ if (!torture_smb2_connection(torture_ctx, &tree1) ||
+ !torture_smb2_connection(torture_ctx, &tree2)) {
+ return false;
+ }
+
+ talloc_steal(mem_ctx, tree1);
+ talloc_steal(mem_ctx, tree2);
+
+ fn = test->fn;
+
+ ret = fn(torture_ctx, tree1, tree2);
+
+ /* the test may already closed some of the connections */
+ talloc_free(mem_ctx);
+
+ return ret;
+}
+
+
+_PUBLIC_ struct torture_test *torture_suite_add_2smb2_test(struct torture_suite *suite,
+ const char *name,
+ bool (*run)(struct torture_context *,
+ struct smb2_tree *,
+ struct smb2_tree *))
+{
+ struct torture_test *test;
+ struct torture_tcase *tcase;
+
+ tcase = torture_suite_add_tcase(suite, name);
+
+ test = talloc(tcase, struct torture_test);
+
+ test->name = talloc_strdup(test, name);
+ test->description = NULL;
+ test->run = wrap_simple_2smb2_test;
+ test->fn = run;
+ test->dangerous = false;
+
+ DLIST_ADD_END(tcase->tests, test, struct torture_test *);
+
+ return test;
+}
+
NTSTATUS torture_smb2_init(void)
{
struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "SMB2");
@@ -82,6 +137,8 @@ NTSTATUS torture_smb2_init(void)
torture_suite_add_simple_test(suite, "FIND", torture_smb2_find);
torture_suite_add_suite(suite, torture_smb2_lock_init());
torture_suite_add_simple_test(suite, "NOTIFY", torture_smb2_notify);
+ torture_suite_add_2smb2_test(suite, "PERSISTENT-HANDLES1", torture_smb2_persistent_handles1);
+ torture_suite_add_1smb2_test(suite, "OPLOCK-BATCH1", torture_smb2_oplock_batch1);
suite->description = talloc_strdup(suite, "SMB2-specific tests");