summaryrefslogtreecommitdiff
path: root/source4/pidl/tests
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-11-23 16:02:20 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:28:26 -0500
commit8d870db811ef4f120d7df3b3f50243b47d94da2f (patch)
tree987861f5d8ce2ddc7f8bd810f88cc7ae5f8170ef /source4/pidl/tests
parent128fe5324b803e0989273c7033ec0b5c8bd3dbae (diff)
downloadsamba-8d870db811ef4f120d7df3b3f50243b47d94da2f.tar.gz
samba-8d870db811ef4f120d7df3b3f50243b47d94da2f.tar.bz2
samba-8d870db811ef4f120d7df3b3f50243b47d94da2f.zip
r19859: Reuse referrent ids when pushing full pointers (still need to
avoid pushing the referred object twice) and add test for full pointers. (This used to be commit 1638c8d234dbc85298000685e49570f23dfd0bf8)
Diffstat (limited to 'source4/pidl/tests')
-rw-r--r--source4/pidl/tests/Util.pm4
-rwxr-xr-xsource4/pidl/tests/ndr_fullptr.pl41
2 files changed, 43 insertions, 2 deletions
diff --git a/source4/pidl/tests/Util.pm b/source4/pidl/tests/Util.pm
index ccac1a6d7e..e0d87b2dac 100644
--- a/source4/pidl/tests/Util.pm
+++ b/source4/pidl/tests/Util.pm
@@ -35,7 +35,7 @@ sub test_samba4_ndr
SKIP: {
skip "no samba environment available, skipping compilation", 3
- if (system("pkg-config --exists dcerpc ndr") != 0);
+ if (system("pkg-config --exists ndr") != 0);
my $test_data_prefix = $ENV{TEST_DATA_PREFIX};
@@ -46,7 +46,7 @@ SKIP: {
$outfile = "test-$name";
}
- my $cflags = `pkg-config --libs --cflags dcerpc ndr`;
+ my $cflags = `pkg-config --libs --cflags ndr`;
open CC, "|cc -x c - -o $outfile $cflags";
print CC "#define uint_t unsigned int\n";
diff --git a/source4/pidl/tests/ndr_fullptr.pl b/source4/pidl/tests/ndr_fullptr.pl
new file mode 100755
index 0000000000..d9f2cd6b02
--- /dev/null
+++ b/source4/pidl/tests/ndr_fullptr.pl
@@ -0,0 +1,41 @@
+#!/usr/bin/perl
+# Simple tests for unique pointers
+# (C) 2006 Jelmer Vernooij <jelmer@samba.org>.
+# Published under the GNU General Public License.
+use strict;
+
+use Test::More tests => 1 * 8;
+use FindBin qw($RealBin);
+use lib "$RealBin/../lib";
+use lib "$RealBin";
+use Util qw(test_samba4_ndr);
+
+test_samba4_ndr("fullptr-push-dup",
+'
+ [public] uint16 echo_TestFull([in,ptr] uint32 *x, [in,ptr] uint32 *y);
+',
+'
+ struct ndr_push *ndr = ndr_push_init();
+ uint32_t v = 13;
+ struct echo_TestRef r;
+ r.in.x = &v;
+ r.in.y = &v;
+
+ if (NT_STATUS_IS_ERR(ndr_push_echo_TestRef(ndr, NDR_IN, &r))) {
+ fprintf(stderr, "push failed\n");
+ return 1;
+ }
+
+ if (ndr->offset != 12) {
+ fprintf(stderr, "Offset(%d) != 12\n", ndr->offset);
+ return 2;
+ }
+
+ if (ndr->data[0] != ndr->data[8] ||
+ ndr->data[1] != ndr->data[9] ||
+ ndr->data[2] != ndr->data[10] ||
+ ndr->data[3] != ndr->data[11]) {
+ fprintf(stderr, "Data incorrect\n");
+ return 3;
+ }
+');