summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2008-04-14 11:32:04 +0200
committerAndrew Tridgell <tridge@samba.org>2008-04-14 11:32:04 +0200
commit7361899e80c1001eb7d7c13b12ba72cbc3b758f2 (patch)
treeb8e7547f0981c487e328b1aad996850a5378fe35
parent275f32ae2df333c089343dd20fc4efee1bed2b7b (diff)
parent2bb20aa8a8ff1170fd4d2a349a421990b0d7c235 (diff)
downloadsamba-7361899e80c1001eb7d7c13b12ba72cbc3b758f2.tar.gz
samba-7361899e80c1001eb7d7c13b12ba72cbc3b758f2.tar.bz2
samba-7361899e80c1001eb7d7c13b12ba72cbc3b758f2.zip
Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into v4-0-test
(This used to be commit 068c973dbeed5b0f5ccab4f780ae7db3535f5910)
-rw-r--r--source4/build/smb_build/makefile.pm4
-rw-r--r--source4/lib/registry/tests/hive.c2
-rw-r--r--source4/lib/registry/tests/registry.c4
-rw-r--r--source4/lib/socket/testsuite.c6
-rw-r--r--source4/lib/util/tests/file.c4
-rw-r--r--source4/torture/auth/ntlmssp.c4
-rw-r--r--source4/torture/basic/base.c2
-rw-r--r--source4/torture/ndr/netlogon.c8
-rw-r--r--source4/torture/ui.h9
9 files changed, 28 insertions, 15 deletions
diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm
index fb3ac561fa..2470fa1459 100644
--- a/source4/build/smb_build/makefile.pm
+++ b/source4/build/smb_build/makefile.pm
@@ -220,6 +220,10 @@ sub SharedLibrary($$)
{
my ($self,$ctx) = @_;
+ if (!defined($ctx->{LIBRARY_SONAME})) {
+ $ctx->{LIBRARY_SONAME} = "";
+ }
+
$self->output("SHARED_LIBS += $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}\n") if (defined($ctx->{SO_VERSION}));
$self->_prepare_list($ctx, "DEPEND_LIST");
diff --git a/source4/lib/registry/tests/hive.c b/source4/lib/registry/tests/hive.c
index 70b0241b04..a16736c761 100644
--- a/source4/lib/registry/tests/hive.c
+++ b/source4/lib/registry/tests/hive.c
@@ -220,7 +220,7 @@ static bool test_get_value(struct torture_context *tctx, const void *test_data)
torture_assert_int_equal(tctx, value.length, 4, "value length");
torture_assert_int_equal(tctx, type, REG_DWORD, "value type");
- torture_assert_int_equal(tctx, data, IVAL(value.data, 0),
+ torture_assert_mem_equal(tctx, &data, value.data, sizeof(uint32_t),
"value data");
return true;
diff --git a/source4/lib/registry/tests/registry.c b/source4/lib/registry/tests/registry.c
index e5e34c11e0..b19a6abffb 100644
--- a/source4/lib/registry/tests/registry.c
+++ b/source4/lib/registry/tests/registry.c
@@ -428,7 +428,7 @@ static bool test_get_value(struct torture_context *tctx, void *_data)
torture_assert_werr_ok(tctx, error, "getting value");
torture_assert_int_equal(tctx, 4, data.length, "value length ok");
- torture_assert(tctx, memcmp(data.data, &value, 4) == 0,
+ torture_assert_mem_equal(tctx, data.data, &value, 4,
"value content ok");
torture_assert_int_equal(tctx, REG_DWORD, type, "value type");
@@ -496,7 +496,7 @@ static bool test_list_values(struct torture_context *tctx, void *_data)
torture_assert_str_equal(tctx, name, "bar", "value name");
torture_assert_int_equal(tctx, 4, data.length, "value length");
- torture_assert(tctx, memcmp(data.data, &value, 4) == 0,
+ torture_assert_mem_equal(tctx, data.data, &value, 4,
"value content");
torture_assert_int_equal(tctx, REG_DWORD, type, "value type");
diff --git a/source4/lib/socket/testsuite.c b/source4/lib/socket/testsuite.c
index 6d4d81a884..813412c7bc 100644
--- a/source4/lib/socket/testsuite.c
+++ b/source4/lib/socket/testsuite.c
@@ -86,7 +86,7 @@ static bool test_udp(struct torture_context *tctx)
torture_assert_int_equal(tctx, nread, size, "Unexpected recvfrom size");
- torture_assert(tctx, memcmp(blob2.data, blob.data, size) == 0,
+ torture_assert_mem_equal(tctx, blob2.data, blob.data, size,
"Bad data in recvfrom");
generate_random_buffer(blob.data, blob.length);
@@ -104,7 +104,7 @@ static bool test_udp(struct torture_context *tctx)
torture_assert_int_equal(tctx, from_addr->port, srv_addr->port,
"Unexpected recvfrom port");
- torture_assert(tctx, memcmp(blob2.data, blob.data, size) == 0,
+ torture_assert_mem_equal(tctx, blob2.data, blob.data, size,
"Bad data in recvfrom");
talloc_free(sock1);
@@ -181,7 +181,7 @@ static bool test_tcp(struct torture_context *tctx)
torture_assert_int_equal(tctx, nread, size, "Unexpected recvfrom size");
- torture_assert(tctx, memcmp(blob2.data, blob.data, size) == 0,
+ torture_assert_mem_equal(tctx, blob2.data, blob.data, size,
"Bad data in recv");
return true;
}
diff --git a/source4/lib/util/tests/file.c b/source4/lib/util/tests/file.c
index fe87293671..3377e833dc 100644
--- a/source4/lib/util/tests/file.c
+++ b/source4/lib/util/tests/file.c
@@ -45,9 +45,9 @@ static bool test_file_load_save(struct torture_context *tctx)
data = file_load(TEST_FILENAME, &len, mem_ctx);
torture_assert(tctx, data, "loading file");
- torture_assert(tctx, len == strlen(TEST_DATA), "Length");
+ torture_assert_int_equal(tctx, len, strlen(TEST_DATA), "Length");
- torture_assert(tctx, memcmp(data, TEST_DATA, len) == 0, "Contents");
+ torture_assert_mem_equal(tctx, data, TEST_DATA, len, "Contents");
unlink(TEST_FILENAME);
return true;
diff --git a/source4/torture/auth/ntlmssp.c b/source4/torture/auth/ntlmssp.c
index 9366de986a..917a24ad59 100644
--- a/source4/torture/auth/ntlmssp.c
+++ b/source4/torture/auth/ntlmssp.c
@@ -69,7 +69,7 @@ static bool torture_ntlmssp_self_check(struct torture_context *tctx)
torture_assert_int_equal(tctx, sig.length, expected_sig.length, "Wrong sig length");
- torture_assert(tctx, 0 == memcmp(sig.data, expected_sig.data, sig.length),
+ torture_assert_mem_equal(tctx, sig.data, expected_sig.data, sig.length,
"data mismatch");
torture_assert_ntstatus_equal(tctx,
@@ -123,7 +123,7 @@ static bool torture_ntlmssp_self_check(struct torture_context *tctx)
torture_assert_int_equal(tctx, sig.length, expected_sig.length, "Wrong sig length");
- torture_assert(tctx, 0 == memcmp(sig.data+8, expected_sig.data+8, sig.length-8),
+ torture_assert_mem_equal(tctx, sig.data+8, expected_sig.data+8, sig.length-8,
"data mismatch");
torture_assert_ntstatus_equal(tctx,
diff --git a/source4/torture/basic/base.c b/source4/torture/basic/base.c
index ac71d14116..3a3a7c2fd5 100644
--- a/source4/torture/basic/base.c
+++ b/source4/torture/basic/base.c
@@ -590,7 +590,7 @@ static bool rw_torture2(struct torture_context *tctx,
break;
}
- torture_assert(tctx, memcmp(buf_rd, buf, buf_size) == 0,
+ torture_assert_mem_equal(tctx, buf_rd, buf, buf_size,
"read/write compare failed\n");
}
diff --git a/source4/torture/ndr/netlogon.c b/source4/torture/ndr/netlogon.c
index 2f01a9d009..f498335bda 100644
--- a/source4/torture/ndr/netlogon.c
+++ b/source4/torture/ndr/netlogon.c
@@ -46,7 +46,7 @@ static bool netrserverauthenticate3_in_check(struct torture_context *tctx,
torture_assert_int_equal(tctx, r->in.secure_channel_type, 2, "secure channel type");
torture_assert_str_equal(tctx, r->in.computer_name, "NATIVE-2K", "computer name");
torture_assert_int_equal(tctx, *r->in.negotiate_flags, 0x6007ffff, "negotiate flags");
- torture_assert(tctx, memcmp(cred_expected, r->in.credentials->data, 8) == 0, "credentials");
+ torture_assert_mem_equal(tctx, cred_expected, r->in.credentials->data, 8, "credentials");
return true;
}
@@ -59,7 +59,7 @@ static bool netrserverauthenticate3_out_check(struct torture_context *tctx,
struct netr_ServerAuthenticate3 *r)
{
uint8_t cred_expected[8] = { 0x22, 0x0c, 0x86, 0x8a, 0xe9, 0x92, 0x93, 0xc9 };
- torture_assert(tctx, memcmp(cred_expected, r->out.credentials->data, 8) == 0, "credentials");
+ torture_assert_mem_equal(tctx, cred_expected, r->out.credentials->data, 8, "credentials");
torture_assert_int_equal(tctx, *r->out.negotiate_flags, 0x6007ffff, "negotiate flags");
torture_assert_int_equal(tctx, *r->out.rid, 0x454, "rid");
torture_assert_ntstatus_ok(tctx, r->out.result, "return code");
@@ -85,7 +85,7 @@ static bool netrserverreqchallenge_in_check(struct torture_context *tctx,
uint8_t cred_expected[8] = { 0xa3, 0x2c, 0xa2, 0x95, 0x40, 0xcc, 0xb7, 0xbb };
torture_assert_str_equal(tctx, r->in.server_name, "\\\\NATIVE-DC.NATIVE.BASE", "server name");
torture_assert_str_equal(tctx, r->in.computer_name, "NATIVE-2K", "account name");
- torture_assert(tctx, memcmp(cred_expected, r->in.credentials->data, 8) == 0, "credentials");
+ torture_assert_mem_equal(tctx, cred_expected, r->in.credentials->data, 8, "credentials");
return true;
}
@@ -98,7 +98,7 @@ static bool netrserverreqchallenge_out_check(struct torture_context *tctx,
struct netr_ServerReqChallenge *r)
{
uint8_t cred_expected[8] = { 0x22, 0xfc, 0xc1, 0x17, 0xc0, 0xae, 0x27, 0x8e };
- torture_assert(tctx, memcmp(cred_expected, r->out.credentials->data, 8) == 0, "credentials");
+ torture_assert_mem_equal(tctx, cred_expected, r->out.credentials->data, 8, "credentials");
torture_assert_ntstatus_ok(tctx, r->out.result, "return code");
return true;
diff --git a/source4/torture/ui.h b/source4/torture/ui.h
index 6645d9b012..ec4a658d74 100644
--- a/source4/torture/ui.h
+++ b/source4/torture/ui.h
@@ -253,6 +253,15 @@ void torture_result(struct torture_context *test,
} \
} while(0)
+#define torture_assert_mem_equal(torture_ctx,got,expected,len,cmt)\
+ do { const void *__got = (got), *__expected = (expected); \
+ if (memcmp(__got, __expected, len) != 0) { \
+ torture_result(torture_ctx, TORTURE_FAIL, \
+ __location__": "#got" of len %d did not match"#expected": %s", len, cmt); \
+ return false; \
+ } \
+ } while(0)
+
#define torture_assert_file_contains_text(torture_ctx,filename,expected,cmt)\
do { \
char *__got; \