diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2008-04-13 22:00:36 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2008-04-13 22:00:36 +0200 |
commit | 148d3b170ae00d4001fa011450c7238052d32ae2 (patch) | |
tree | 02eb3175d46a335ede787049caa1de1c563f20ca | |
parent | ae553dfcecdd605658dea73ccb6e577b059f478c (diff) | |
download | samba-148d3b170ae00d4001fa011450c7238052d32ae2.tar.gz samba-148d3b170ae00d4001fa011450c7238052d32ae2.tar.bz2 samba-148d3b170ae00d4001fa011450c7238052d32ae2.zip |
Use torture_assert_mem_equal() in a couple more places.
(This used to be commit e2c3fab9d1bf0482c15a115e7d373562ffe50b29)
-rw-r--r-- | source4/lib/registry/tests/registry.c | 2 | ||||
-rw-r--r-- | source4/lib/socket/testsuite.c | 6 | ||||
-rw-r--r-- | source4/lib/util/tests/file.c | 4 | ||||
-rw-r--r-- | source4/torture/auth/ntlmssp.c | 4 | ||||
-rw-r--r-- | source4/torture/basic/base.c | 2 | ||||
-rw-r--r-- | source4/torture/ndr/netlogon.c | 8 |
6 files changed, 13 insertions, 13 deletions
diff --git a/source4/lib/registry/tests/registry.c b/source4/lib/registry/tests/registry.c index 1780b4e772..b19a6abffb 100644 --- a/source4/lib/registry/tests/registry.c +++ b/source4/lib/registry/tests/registry.c @@ -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; |