diff options
author | Kamen Mazdrashki <kamen.mazdrashki@postpath.com> | 2009-09-10 23:44:00 +0300 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2009-09-11 11:53:17 +1000 |
commit | 5088caa69e0a5f6822bbf6184c404eaf18783ed5 (patch) | |
tree | dc8e6875629c2d8768a5a532ec12eef33cb8e971 /source4/torture | |
parent | a03e0c478d0c298a7aea4aac8b2f9a1ffc25fd63 (diff) | |
download | samba-5088caa69e0a5f6822bbf6184c404eaf18783ed5.tar.gz samba-5088caa69e0a5f6822bbf6184c404eaf18783ed5.tar.bz2 samba-5088caa69e0a5f6822bbf6184c404eaf18783ed5.zip |
s4/tort: assert macro for drsuapi dcerpc call
The macro actually wraps common code pattern used in
almost every test for DRSUAPI interface
Diffstat (limited to 'source4/torture')
-rw-r--r-- | source4/torture/rpc/drsuapi.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/source4/torture/rpc/drsuapi.h b/source4/torture/rpc/drsuapi.h index e9a7dd5ad1..d32a35ee2c 100644 --- a/source4/torture/rpc/drsuapi.h +++ b/source4/torture/rpc/drsuapi.h @@ -23,6 +23,9 @@ #include "librpc/gen_ndr/drsuapi.h" +/** + * Data structure common for most of DRSUAPI tests + */ struct DsPrivate { struct dcerpc_pipe *pipe; struct policy_handle bind_handle; @@ -35,3 +38,26 @@ struct DsPrivate { struct test_join *join; }; + +/** + * Custom torture macro to check dcerpc_drsuapi_ call + * return values printing more friendly messages + * \param _tctx torture context + * \param _p DCERPC pipe handle + * \param _ntstatus NTSTATUS for dcerpc_drsuapi_ call + * \param _pr in/out DCEPRC request structure + * \param _msg error message prefix + */ +#define torture_drsuapi_assert_call(_tctx, _p, _ntstat, _pr, _msg) \ + do { \ + NTSTATUS __nt = _ntstat; \ + if (!NT_STATUS_IS_OK(__nt)) { \ + const char *errstr = nt_errstr(__nt); \ + if (NT_STATUS_EQUAL(__nt, NT_STATUS_NET_WRITE_FAULT)) { \ + errstr = dcerpc_errstr(_tctx, _p->last_fault_code); \ + } \ + torture_fail(tctx, talloc_asprintf(_tctx, "%s failed - %s", _msg, errstr)); \ + } \ + torture_assert_werr_ok(_tctx, (_pr)->out.result, _msg); \ + } while(0) + |