summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-11-18 01:36:02 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-11-18 01:36:02 +0100
commit1c07c30d31b4b588b59b845bdb5f85a0ba19f762 (patch)
treefe6e815464ae0ab1397567150978e04ea4fb3d46 /lib
parentab55ecb881bfabe427ecb874d2dff2b5c2a7e84a (diff)
parent9ea794417e8bad3da4236f4071a0d8a23612ac8a (diff)
downloadsamba-1c07c30d31b4b588b59b845bdb5f85a0ba19f762.tar.gz
samba-1c07c30d31b4b588b59b845bdb5f85a0ba19f762.tar.bz2
samba-1c07c30d31b4b588b59b845bdb5f85a0ba19f762.zip
Merge branch 'master' of ssh://git.samba.org/data/git/samba
Diffstat (limited to 'lib')
-rw-r--r--lib/torture/config.mk1
-rw-r--r--lib/torture/torture.h15
-rw-r--r--lib/util/util.c4
3 files changed, 20 insertions, 0 deletions
diff --git a/lib/torture/config.mk b/lib/torture/config.mk
index 8a7f2a3b6b..abd89260f6 100644
--- a/lib/torture/config.mk
+++ b/lib/torture/config.mk
@@ -4,6 +4,7 @@ PUBLIC_DEPENDENCIES = \
LIBSAMBA-HOSTCONFIG \
LIBSAMBA-UTIL \
LIBTALLOC
+CFLAGS = -I$(libtorturesrcdir) -I$(libtorturesrcdir)/../
torture_VERSION = 0.0.1
torture_SOVERSION = 0
diff --git a/lib/torture/torture.h b/lib/torture/torture.h
index f16d2707bb..73ea1eb643 100644
--- a/lib/torture/torture.h
+++ b/lib/torture/torture.h
@@ -284,6 +284,21 @@ void torture_result(struct torture_context *test,
} \
} while(0)
+#define torture_assert_data_blob_equal(torture_ctx,got,expected,cmt)\
+ do { const DATA_BLOB __got = (got), __expected = (expected); \
+ if (__got.length != __expected.length) { \
+ torture_result(torture_ctx, TORTURE_FAIL, \
+ __location__": "#got".len %d did not match "#expected" len %d: %s", \
+ (int)__got.length, (int)__expected.length, cmt); \
+ return false; \
+ } \
+ if (memcmp(__got.data, __expected.data, __got.length) != 0) { \
+ torture_result(torture_ctx, TORTURE_FAIL, \
+ __location__": "#got" of len %d did not match"#expected": %s", (int)__got.length, cmt); \
+ return false; \
+ } \
+ } while(0)
+
#define torture_assert_file_contains_text(torture_ctx,filename,expected,cmt)\
do { \
char *__got; \
diff --git a/lib/util/util.c b/lib/util/util.c
index 4e2a5aab09..7548d30b7e 100644
--- a/lib/util/util.c
+++ b/lib/util/util.c
@@ -701,10 +701,14 @@ _PUBLIC_ char *hex_encode_talloc(TALLOC_CTX *mem_ctx, const unsigned char *buff_
char *hex_buffer;
hex_buffer = talloc_array(mem_ctx, char, (len*2)+1);
+ if (!hex_buffer) {
+ return NULL;
+ }
for (i = 0; i < len; i++)
slprintf(&hex_buffer[i*2], 3, "%02X", buff_in[i]);
+ talloc_set_name_const(hex_buffer, hex_buffer);
return hex_buffer;
}