summaryrefslogtreecommitdiff
path: root/source4/pidl/tests
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-02-19 19:42:51 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:48:37 -0500
commit29cdad41817f5bb3c9c79c4cbb8f94244b21b9e1 (patch)
treedc9cc868617571fe7381229e81fa2ccfebc62b54 /source4/pidl/tests
parent908bc58cdd2642fe61f6e3a07e9d362de6e18ae6 (diff)
downloadsamba-29cdad41817f5bb3c9c79c4cbb8f94244b21b9e1.tar.gz
samba-29cdad41817f5bb3c9c79c4cbb8f94244b21b9e1.tar.bz2
samba-29cdad41817f5bb3c9c79c4cbb8f94244b21b9e1.zip
r21455: Fix a bug in our handling of conformant arrays. The conformant array was
always pushed, even if just the buffers part of a struct had to be pushed. Pull was not affected. (This used to be commit ffe387920473fb365f740942098085eb40299c84)
Diffstat (limited to 'source4/pidl/tests')
-rwxr-xr-xsource4/pidl/tests/samba-ndr.pl42
1 files changed, 40 insertions, 2 deletions
diff --git a/source4/pidl/tests/samba-ndr.pl b/source4/pidl/tests/samba-ndr.pl
index 28b41e4486..a528265e64 100755
--- a/source4/pidl/tests/samba-ndr.pl
+++ b/source4/pidl/tests/samba-ndr.pl
@@ -4,14 +4,14 @@
use strict;
use warnings;
-use Test::More tests => 32;
+use Test::More tests => 34;
use FindBin qw($RealBin);
use lib "$RealBin";
use Util;
use Parse::Pidl::Util qw(MyDumper);
use Parse::Pidl::Samba4::NDR::Parser qw(check_null_pointer
GenerateFunctionInEnv GenerateFunctionOutEnv GenerateStructEnv
- EnvSubstituteValue NeededFunction NeededElement NeededType);
+ EnvSubstituteValue NeededFunction NeededElement NeededType $res);
my $output;
sub print_fn($) { my $x = shift; $output.=$x; }
@@ -253,3 +253,41 @@ is_deeply($needed, { pull_bla => 1, push_bla => 1, print_bla => 1, print_rep =>
pull_bar => 1, push_bar => 1,
ndr_bar_to_rep => 1, ndr_rep_to_bar => 1});
+$res = "";
+Parse::Pidl::Samba4::NDR::Parser::ParseStructPush({
+ NAME => "mystruct",
+ TYPE => "STRUCT",
+ PROPERTIES => {},
+ ALIGN => 4,
+ ELEMENTS => [ ]}, "mystruct", "x");
+is($res, "if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+}
+if (ndr_flags & NDR_BUFFERS) {
+}
+");
+
+$res = "";
+my $e = {
+ NAME => "el1",
+ TYPE => "mytype",
+ REPRESENTATION_TYPE => "mytype",
+ PROPERTIES => {},
+ LEVELS => [
+ { LEVEL_INDEX => 0, TYPE => "DATA", DATA_TYPE => "mytype" }
+] };
+Parse::Pidl::Samba4::NDR::Parser::ParseStructPush({
+ NAME => "mystruct",
+ TYPE => "STRUCT",
+ PROPERTIES => {},
+ ALIGN => 4,
+ SURROUNDING_ELEMENT => $e,
+ ELEMENTS => [ $e ]}, "mystruct", "x");
+is($res, "if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_string_array_size(ndr, x->el1)));
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_mytype(ndr, NDR_SCALARS, &x->el1));
+}
+if (ndr_flags & NDR_BUFFERS) {
+}
+");