summaryrefslogtreecommitdiff
path: root/source4/build/pidl/tests/ndr_align.pl
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-05-17 17:32:25 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:16:52 -0500
commit6e3b2448eb6cc48a95eeec24f397d3243f9473bf (patch)
treefb15898b9a8b47e951db048a47cfe60169c4532e /source4/build/pidl/tests/ndr_align.pl
parent1751007e645d206f48d2efa4470fd99fbbecf2b8 (diff)
downloadsamba-6e3b2448eb6cc48a95eeec24f397d3243f9473bf.tar.gz
samba-6e3b2448eb6cc48a95eeec24f397d3243f9473bf.tar.bz2
samba-6e3b2448eb6cc48a95eeec24f397d3243f9473bf.zip
r6862: Add some more tests
Accept new command-line options --keep, --outputdir and --idl-compiler. We're currently at 34 IDL tests (...and counting) (This used to be commit 7004f9515b75bce5b46e444f1865d377fdae0afa)
Diffstat (limited to 'source4/build/pidl/tests/ndr_align.pl')
-rwxr-xr-xsource4/build/pidl/tests/ndr_align.pl65
1 files changed, 60 insertions, 5 deletions
diff --git a/source4/build/pidl/tests/ndr_align.pl b/source4/build/pidl/tests/ndr_align.pl
index c428dd32bd..03b09e8758 100755
--- a/source4/build/pidl/tests/ndr_align.pl
+++ b/source4/build/pidl/tests/ndr_align.pl
@@ -7,11 +7,11 @@ use FindBin qw($RealBin);
use lib "$RealBin/..";
use test;
-my %settings = (
- 'IDL-Arguments' => ['--quiet', '--parse', '--parser=ndr_test.c', '--header=ndr_test.h'],
- 'IncludeFiles' => ['ndr_test.h'],
- 'ExtraFiles' => ['ndr_test.c'],
-);
+my %settings = Test::GetSettings(@ARGV);
+
+$settings{'IDL-Arguments'} = ['--quiet', '--parse', '--parser=ndr_test.c', '--header=ndr_test.h'];
+$settings{'IncludeFiles'} = ['ndr_test.h'];
+$settings{'ExtraFiles'} = ['ndr_test.c'];
Test::test_idl('align-uint8-uint16', \%settings,
'
@@ -89,3 +89,58 @@ Test::test_idl('align-uint8-hyper', \%settings,
if (!data_blob_equal(&result_blob, &expected_blob))
return 2;
');
+
+Test::test_idl('noalignflag-uint8-uint16', \%settings,
+'
+ typedef [public] struct {
+ uint8 x;
+ uint16 y;
+ } bla;
+',
+'
+ struct ndr_push *ndr = ndr_push_init();
+ struct bla r;
+ uint8_t expected[] = { 0x0D, 0xef, 0xbe };
+ DATA_BLOB expected_blob = { expected, 3 };
+ DATA_BLOB result_blob;
+ ndr->flags |= LIBNDR_FLAG_NOALIGN;
+
+ r.x = 13;
+ r.y = 0xbeef;
+
+ if (NT_STATUS_IS_ERR(ndr_push_bla(ndr, NDR_SCALARS|NDR_BUFFERS, &r)))
+ return 1;
+
+ result_blob = ndr_push_blob(ndr);
+
+ if (!data_blob_equal(&result_blob, &expected_blob))
+ return 2;
+');
+
+Test::test_idl('align-blob-align2', \%settings,
+'
+ typedef [public] struct {
+ uint8 x;
+ [flag(LIBNDR_FLAG_ALIGN2)] DATA_BLOB data;
+ } bla;
+',
+'
+ struct ndr_push *ndr = ndr_push_init();
+ struct bla r;
+ uint8_t data[] = { 0x01, 0x02 };
+ uint8_t expected[] = { 0x0D, 0x00, 0x01, 0x02 };
+ DATA_BLOB expected_blob = { expected, 4 };
+ DATA_BLOB result_blob;
+
+ r.x = 13;
+ r.data.data = data;
+ r.data.length = 2;
+
+ if (NT_STATUS_IS_ERR(ndr_push_bla(ndr, NDR_SCALARS|NDR_BUFFERS, &r)))
+ return 1;
+
+ result_blob = ndr_push_blob(ndr);
+
+ if (!data_blob_equal(&result_blob, &expected_blob))
+ return 2;
+');