summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-12-03 17:51:50 +0100
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:47:36 +0100
commit6f1efbba065e0f0c9eaaa4a3c8c40ecfa1277107 (patch)
treec2062ee19b5cd157106dd8ce1b762364aaa1fd3b
parenta84863372c3bc51c3db0cdc8647b7e730e15a7c8 (diff)
downloadsamba-6f1efbba065e0f0c9eaaa4a3c8c40ecfa1277107.tar.gz
samba-6f1efbba065e0f0c9eaaa4a3c8c40ecfa1277107.tar.bz2
samba-6f1efbba065e0f0c9eaaa4a3c8c40ecfa1277107.zip
r26262: Add test for WERROR return code handling for Samba 3 client code.
(This used to be commit 6017b16f504dc7b092c22200951cb206b0a7e602)
-rwxr-xr-xsource4/pidl/tests/samba3-cli.pl41
1 files changed, 40 insertions, 1 deletions
diff --git a/source4/pidl/tests/samba3-cli.pl b/source4/pidl/tests/samba3-cli.pl
index 8c06ed8c27..5086300e46 100755
--- a/source4/pidl/tests/samba3-cli.pl
+++ b/source4/pidl/tests/samba3-cli.pl
@@ -4,7 +4,7 @@
use strict;
use warnings;
-use Test::More tests => 7;
+use Test::More tests => 8;
use FindBin qw($RealBin);
use lib "$RealBin";
use Util;
@@ -59,3 +59,42 @@ is($x->{res}, "NTSTATUS rpccli_bar(struct rpc_pipe_client *cli, TALLOC_CTX *mem_
}
");
+
+$x = new Parse::Pidl::Samba3::ClientNDR();
+
+$fn = { NAME => "bar", ELEMENTS => [ ], RETURN_TYPE => "WERROR" };
+$x->ParseFunction("foo", $fn);
+is($x->{res}, "NTSTATUS rpccli_bar(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror)
+{
+\tstruct bar r;
+\tNTSTATUS status;
+\t
+\t/* In parameters */
+\t
+\tif (DEBUGLEVEL >= 10)
+\t\tNDR_PRINT_IN_DEBUG(bar, &r);
+\t
+\tstatus = cli_do_rpc_ndr(cli, mem_ctx, PI_FOO, &ndr_table_foo, NDR_BAR, &r);
+\t
+\tif (!NT_STATUS_IS_OK(status)) {
+\t\treturn status;
+\t}
+\t
+\tif (DEBUGLEVEL >= 10)
+\t\tNDR_PRINT_OUT_DEBUG(bar, &r);
+\t
+\tif (NT_STATUS_IS_ERR(status)) {
+\t\treturn status;
+\t}
+\t
+\t/* Return variables */
+\t
+\t/* Return result */
+\tif (werror) {
+\t\t*werror = r.out.result;
+\t}
+\t
+\treturn werror_to_ntstatus(r.out.result);
+}
+
+");