summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-09-02 02:07:55 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:03:27 -0500
commitac2a7014837b1ce135e732fd7a9b950d9fbc1401 (patch)
tree57e68293fe845fd73cca4e1cf867c071ede8b7ff
parent0271566a5b3211735faad67e37e2d0474996b710 (diff)
downloadsamba-ac2a7014837b1ce135e732fd7a9b950d9fbc1401.tar.gz
samba-ac2a7014837b1ce135e732fd7a9b950d9fbc1401.tar.bz2
samba-ac2a7014837b1ce135e732fd7a9b950d9fbc1401.zip
r24882: Use the torture API in BASE-CHARSET.
(This used to be commit 93910d92cd431add876e98a12712253bee8c52e7)
-rw-r--r--source4/samba4-knownfail1
-rw-r--r--source4/samba4-skip1
-rw-r--r--source4/selftest/output/html.pm5
-rw-r--r--source4/torture/basic/base.c2
-rw-r--r--source4/torture/basic/charset.c160
-rw-r--r--source4/torture/raw/raw.c3
-rw-r--r--source4/torture/util_smb.c7
-rw-r--r--testdata/samba3/smb.conf20
8 files changed, 70 insertions, 129 deletions
diff --git a/source4/samba4-knownfail b/source4/samba4-knownfail
index 10027a49ed..5ef7ad9833 100644
--- a/source4/samba4-knownfail
+++ b/source4/samba4-knownfail
@@ -32,3 +32,4 @@ RPC-DRSUAPI.*/DsCrackNames
RPC-DRSUAPI.*/DsGetDomainControllerInfo
RPC-DRSUAPI.*/QuerySitesByCost
RPC-DRSUAPI.*/DsGetNCChange
+BASE-CHARSET.*/Testing partial surrogate
diff --git a/source4/samba4-skip b/source4/samba4-skip
index 9d9a6a675f..1e60313d0d 100644
--- a/source4/samba4-skip
+++ b/source4/samba4-skip
@@ -1,4 +1,3 @@
-BASE-CHARSET
BASE-DEFER_OPEN
BASE-DELAYWRITE
RAW-COMPOSITE
diff --git a/source4/selftest/output/html.pm b/source4/selftest/output/html.pm
index 2a2a12b63d..7f5d128983 100644
--- a/source4/selftest/output/html.pm
+++ b/source4/selftest/output/html.pm
@@ -309,10 +309,7 @@ sub missing_env($$$)
{
my ($self, $name, $envname) = @_;
- print INDEX "<tr>\n";
- print INDEX " <td class=\"testSuite\">$name</td>\n";
- print INDEX " <td class=\"resultSkipped\" colspan=\"2\">SKIPPED - environment `$envname` not available!</td>\n";
- print INDEX "</tr>\n";
+ $self->skip_testsuite($envname, $name, "environment `$envname` not available!");
}
sub skip_testsuite($$$$)
diff --git a/source4/torture/basic/base.c b/source4/torture/basic/base.c
index 9b2bb14106..2cb0c6a985 100644
--- a/source4/torture/basic/base.c
+++ b/source4/torture/basic/base.c
@@ -1741,7 +1741,7 @@ NTSTATUS torture_base_init(void)
torture_suite_add_1smb_test(suite, "PROPERTIES", torture_test_properties);
torture_suite_add_1smb_test(suite, "MANGLE", torture_mangle);
torture_suite_add_1smb_test(suite, "OPENATTR", torture_openattrtest);
- torture_suite_add_1smb_test(suite, "CHARSET", torture_charset);
+ torture_suite_add_suite(suite, torture_charset(suite));
torture_suite_add_1smb_test(suite, "CHKPATH", torture_chkpath_test);
torture_suite_add_1smb_test(suite, "SECLEAK", torture_sec_leak);
torture_suite_add_simple_test(suite, "DISCONNECT", torture_disconnect);
diff --git a/source4/torture/basic/charset.c b/source4/torture/basic/charset.c
index 3fa094e05c..b1e3b96c2b 100644
--- a/source4/torture/basic/charset.c
+++ b/source4/torture/basic/charset.c
@@ -33,7 +33,7 @@
the prefix BASEDIR is added before the name
*/
static NTSTATUS unicode_open(struct torture_context *tctx,
- struct smbcli_tree *tree,
+ struct smbcli_tree *tree,
TALLOC_CTX *mem_ctx,
uint32_t open_disposition,
const uint32_t *u_name,
@@ -82,7 +82,7 @@ static NTSTATUS unicode_open(struct torture_context *tctx,
io.ntcreatex.in.fname = fname2;
io.ntcreatex.in.open_disposition = open_disposition;
- status = smb_raw_open(tree, mem_ctx, &io);
+ status = smb_raw_open(tree, tctx, &io);
talloc_free(ucs_name);
@@ -93,172 +93,118 @@ static NTSTATUS unicode_open(struct torture_context *tctx,
/*
see if the server recognises composed characters
*/
-static BOOL test_composed(struct torture_context *tctx,
- struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_composed(struct torture_context *tctx,
+ struct smbcli_state *cli)
{
const uint32_t name1[] = {0x61, 0x308};
const uint32_t name2[] = {0xe4};
NTSTATUS status1, status2;
- printf("Testing composite character (a umlaut)\n");
-
- status1 = unicode_open(tctx, cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name1, 2);
- if (!NT_STATUS_IS_OK(status1)) {
- printf("Failed to create composed name - %s\n",
- nt_errstr(status1));
- return False;
- }
+ torture_assert(tctx, torture_setup_dir(cli, BASEDIR),
+ "setting up basedir");
- status2 = unicode_open(tctx, cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name2, 1);
+ status1 = unicode_open(tctx, cli->tree, tctx, NTCREATEX_DISP_CREATE, name1, 2);
+ torture_assert_ntstatus_ok(tctx, status1, "Failed to create composed name");
- if (!NT_STATUS_IS_OK(status2)) {
- printf("Failed to create accented character - %s\n",
- nt_errstr(status2));
- return False;
- }
+ status2 = unicode_open(tctx, cli->tree, tctx, NTCREATEX_DISP_CREATE, name2, 1);
+
+ torture_assert_ntstatus_ok(tctx, status2, "Failed to create accented character");
- return True;
+ return true;
}
/*
see if the server recognises a naked diacritical
*/
-static BOOL test_diacritical(struct torture_context *tctx,
- struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_diacritical(struct torture_context *tctx,
+ struct smbcli_state *cli)
{
const uint32_t name1[] = {0x308};
const uint32_t name2[] = {0x308, 0x308};
NTSTATUS status1, status2;
- printf("Testing naked diacritical (umlaut)\n");
-
- status1 = unicode_open(tctx, cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name1, 1);
+ torture_assert(tctx, torture_setup_dir(cli, BASEDIR),
+ "setting up basedir");
- if (!NT_STATUS_IS_OK(status1)) {
- printf("Failed to create naked diacritical - %s\n",
- nt_errstr(status1));
- return False;
- }
+ status1 = unicode_open(tctx, cli->tree, tctx, NTCREATEX_DISP_CREATE, name1, 1);
+
+ torture_assert_ntstatus_ok(tctx, status1, "Failed to create naked diacritical");
/* try a double diacritical */
- status2 = unicode_open(tctx, cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name2, 2);
+ status2 = unicode_open(tctx, cli->tree, tctx, NTCREATEX_DISP_CREATE, name2, 2);
- if (!NT_STATUS_IS_OK(status2)) {
- printf("Failed to create double naked diacritical - %s\n",
- nt_errstr(status2));
- return False;
- }
+ torture_assert_ntstatus_ok(tctx, status2, "Failed to create double naked diacritical");
- return True;
+ return true;
}
/*
see if the server recognises a partial surrogate pair
*/
-static BOOL test_surrogate(struct torture_context *tctx,
- struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_surrogate(struct torture_context *tctx,
+ struct smbcli_state *cli)
{
const uint32_t name1[] = {0xd800};
const uint32_t name2[] = {0xdc00};
const uint32_t name3[] = {0xd800, 0xdc00};
NTSTATUS status;
- printf("Testing partial surrogate\n");
+ torture_assert(tctx, torture_setup_dir(cli, BASEDIR),
+ "setting up basedir");
- status = unicode_open(tctx, cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name1, 1);
+ status = unicode_open(tctx, cli->tree, tctx, NTCREATEX_DISP_CREATE, name1, 1);
- if (!NT_STATUS_IS_OK(status)) {
- printf("Failed to create partial surrogate 1 - %s\n",
- nt_errstr(status));
- return False;
- }
+ torture_assert_ntstatus_ok(tctx, status, "Failed to create partial surrogate 1");
- status = unicode_open(tctx, cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name2, 1);
+ status = unicode_open(tctx, cli->tree, tctx, NTCREATEX_DISP_CREATE, name2, 1);
- if (!NT_STATUS_IS_OK(status)) {
- printf("Failed to create partial surrogate 2 - %s\n",
- nt_errstr(status));
- return False;
- }
+ torture_assert_ntstatus_ok(tctx, status, "Failed to create partial surrogate 2");
- status = unicode_open(tctx, cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name3, 2);
+ status = unicode_open(tctx, cli->tree, tctx, NTCREATEX_DISP_CREATE, name3, 2);
- if (!NT_STATUS_IS_OK(status)) {
- printf("Failed to create full surrogate - %s\n",
- nt_errstr(status));
- return False;
- }
+ torture_assert_ntstatus_ok(tctx, status, "Failed to create full surrogate");
- return True;
+ return true;
}
/*
see if the server recognises wide-a characters
*/
-static BOOL test_widea(struct torture_context *tctx,
- struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static bool test_widea(struct torture_context *tctx,
+ struct smbcli_state *cli)
{
const uint32_t name1[] = {'a'};
const uint32_t name2[] = {0xff41};
const uint32_t name3[] = {0xff21};
NTSTATUS status;
- printf("Testing wide-a\n");
-
- status = unicode_open(tctx, cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name1, 1);
+ torture_assert(tctx, torture_setup_dir(cli, BASEDIR),
+ "setting up basedir");
- if (!NT_STATUS_IS_OK(status)) {
- printf("Failed to create 'a' - %s\n",
- nt_errstr(status));
- return False;
- }
+ status = unicode_open(tctx, cli->tree, tctx, NTCREATEX_DISP_CREATE, name1, 1);
- status = unicode_open(tctx, cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name2, 1);
+ torture_assert_ntstatus_ok(tctx, status, "Failed to create 'a'");
- if (!NT_STATUS_IS_OK(status)) {
- printf("Failed to create wide-a - %s\n",
- nt_errstr(status));
- return False;
- }
+ status = unicode_open(tctx, cli->tree, tctx, NTCREATEX_DISP_CREATE, name2, 1);
- status = unicode_open(tctx, cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name3, 1);
+ torture_assert_ntstatus_ok(tctx, status, "Failed to create wide-a");
- if (!NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_COLLISION)) {
- printf("Expected %s creating wide-A - %s\n",
- nt_errstr(NT_STATUS_OBJECT_NAME_COLLISION),
- nt_errstr(status));
- return False;
- }
+ status = unicode_open(tctx, cli->tree, tctx, NTCREATEX_DISP_CREATE, name3, 1);
- return True;
+ torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OBJECT_NAME_COLLISION,
+ "Failed to create wide-A");
+
+ return true;
}
-BOOL torture_charset(struct torture_context *tctx, struct smbcli_state *cli)
+struct torture_suite *torture_charset(TALLOC_CTX *mem_ctx)
{
- BOOL ret = True;
- TALLOC_CTX *mem_ctx;
-
- mem_ctx = talloc_init("torture_charset");
-
- if (!torture_setup_dir(cli, BASEDIR)) {
- return False;
- }
-
- if (!test_composed(tctx, cli, mem_ctx)) {
- ret = False;
- }
+ struct torture_suite *suite = torture_suite_create(mem_ctx, "CHARSET");
- if (!test_diacritical(tctx, cli, mem_ctx)) {
- ret = False;
- }
-
- if (!test_surrogate(tctx, cli, mem_ctx)) {
- ret = False;
- }
-
- if (!test_widea(tctx, cli, mem_ctx)) {
- ret = False;
- }
+ torture_suite_add_1smb_test(suite, "Testing composite character (a umlaut)", test_composed);
+ torture_suite_add_1smb_test(suite, "Testing naked diacritical (umlaut)", test_diacritical);
+ torture_suite_add_1smb_test(suite, "Testing partial surrogate", test_surrogate);
+ torture_suite_add_1smb_test(suite, "Testing wide-a", test_widea);
- return ret;
+ return suite;
}
diff --git a/source4/torture/raw/raw.c b/source4/torture/raw/raw.c
index 0c4a28e0d6..88299c44cd 100644
--- a/source4/torture/raw/raw.c
+++ b/source4/torture/raw/raw.c
@@ -71,8 +71,7 @@ NTSTATUS torture_raw_init(void)
torture_samba3_posixtimedlock);
torture_suite_add_simple_test(suite, "SCAN-EAMAX", torture_max_eas);
- suite->description = talloc_strdup(suite,
- "Tests for the raw SMB interface");
+ suite->description = talloc_strdup(suite, "Tests for the raw SMB interface");
torture_register_suite(suite);
diff --git a/source4/torture/util_smb.c b/source4/torture/util_smb.c
index d077b3b515..8e4f3b56ee 100644
--- a/source4/torture/util_smb.c
+++ b/source4/torture/util_smb.c
@@ -829,10 +829,9 @@ static bool wrap_simple_1smb_test(struct torture_context *torture_ctx,
}
_PUBLIC_ struct torture_test *torture_suite_add_1smb_test(
- struct torture_suite *suite,
- const char *name,
- bool (*run) (struct torture_context *,
- struct smbcli_state *))
+ struct torture_suite *suite,
+ const char *name,
+ bool (*run) (struct torture_context *, struct smbcli_state *))
{
struct torture_test *test;
struct torture_tcase *tcase;
diff --git a/testdata/samba3/smb.conf b/testdata/samba3/smb.conf
index a903dc2c3e..b00397d2ee 100644
--- a/testdata/samba3/smb.conf
+++ b/testdata/samba3/smb.conf
@@ -5,19 +5,19 @@
debug level = 5
[cd1]
-path = /mnt/cd1
-public = yes
+ path = /mnt/cd1
+ public = yes
[cd2]
-path = /mnt/cd2
-public = yes
+ path = /mnt/cd2
+ public = yes
[media]
-path = /media
-public = yes
+ path = /media
+ public = yes
[tmp]
-path = /tmp
-guest only = yes
-public = yes
-read only = no
+ path = /tmp
+ guest only = yes
+ public = yes
+ read only = no