From 430123e84e099f78ba794fdbf7de30d1169cd0cb Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 7 Sep 2011 15:35:55 +1000 Subject: torture-ndr: added support for testing push functions this allows us to check the symmetry of pull/push functions in NDR tests Pair-Programmed-With: Andrew Bartlett --- source4/torture/ndr/ndr.h | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'source4/torture/ndr/ndr.h') diff --git a/source4/torture/ndr/ndr.h b/source4/torture/ndr/ndr.h index 3de6b8b0d3..ee4db0aa68 100644 --- a/source4/torture/ndr/ndr.h +++ b/source4/torture/ndr/ndr.h @@ -24,9 +24,11 @@ #include "librpc/ndr/libndr.h" #include "libcli/security/security.h" -_PUBLIC_ struct torture_test *_torture_suite_add_ndr_pull_test( +_PUBLIC_ struct torture_test *_torture_suite_add_ndr_pullpush_test( struct torture_suite *suite, - const char *name, ndr_pull_flags_fn_t fn, + const char *name, + ndr_pull_flags_fn_t pull_fn, + ndr_push_flags_fn_t push_fn, DATA_BLOB db, size_t struct_size, int ndr_flags, @@ -41,20 +43,27 @@ _PUBLIC_ struct torture_test *_torture_suite_add_ndr_pull_inout_test( bool (*check_fn) (struct torture_context *ctx, void *data)); #define torture_suite_add_ndr_pull_test(suite,name,data,check_fn) \ - _torture_suite_add_ndr_pull_test(suite, #name, \ - (ndr_pull_flags_fn_t)ndr_pull_ ## name, data_blob_talloc(suite, data, sizeof(data)), \ - sizeof(struct name), 0, (bool (*) (struct torture_context *, void *)) check_fn); + _torture_suite_add_ndr_pullpush_test(suite, #name, \ + (ndr_pull_flags_fn_t)ndr_pull_ ## name, NULL, data_blob_const(data, sizeof(data)), \ + sizeof(struct name), NDR_SCALARS|NDR_BUFFERS, (bool (*) (struct torture_context *, void *)) check_fn); #define torture_suite_add_ndr_pull_fn_test(suite,name,data,flags,check_fn) \ - _torture_suite_add_ndr_pull_test(suite, #name "_" #flags, \ - (ndr_pull_flags_fn_t)ndr_pull_ ## name, data_blob_talloc(suite, data, sizeof(data)), \ + _torture_suite_add_ndr_pullpush_test(suite, #name "_" #flags, \ + (ndr_pull_flags_fn_t)ndr_pull_ ## name, NULL, data_blob_const(data, sizeof(data)), \ sizeof(struct name), flags, (bool (*) (struct torture_context *, void *)) check_fn); +#define torture_suite_add_ndr_pullpush_test(suite,name,data_blob,check_fn) \ + _torture_suite_add_ndr_pullpush_test(suite, #name, \ + (ndr_pull_flags_fn_t)ndr_pull_ ## name, \ + (ndr_push_flags_fn_t)ndr_push_ ## name, \ + data_blob, \ + sizeof(struct name), NDR_SCALARS|NDR_BUFFERS, (bool (*) (struct torture_context *, void *)) check_fn); + #define torture_suite_add_ndr_pull_io_test(suite,name,data_in,data_out,check_fn_out) \ _torture_suite_add_ndr_pull_inout_test(suite, #name "_INOUT", \ (ndr_pull_flags_fn_t)ndr_pull_ ## name, \ - data_blob_talloc(suite, data_in, sizeof(data_in)), \ - data_blob_talloc(suite, data_out, sizeof(data_out)), \ + data_blob_const(data_in, sizeof(data_in)), \ + data_blob_const(data_out, sizeof(data_out)), \ sizeof(struct name), \ (bool (*) (struct torture_context *, void *)) check_fn_out); -- cgit