diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-05-17 13:50:47 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:16:51 -0500 |
commit | 9d56a6d8f86a2285231d1707635ce8a5bb996b1a (patch) | |
tree | a0cc41e088ff1cc9f03f5ca1b620f9080a7b7972 /source4/build/pidl/tests/ndr_align.pl | |
parent | fe597fd1e28b92766e174249b10739fb2fe4a35f (diff) | |
download | samba-9d56a6d8f86a2285231d1707635ce8a5bb996b1a.tar.gz samba-9d56a6d8f86a2285231d1707635ce8a5bb996b1a.tar.bz2 samba-9d56a6d8f86a2285231d1707635ce8a5bb996b1a.zip |
r6859: Add ndr_align tests, use environment variables ($CC, $CFLAGS, $LDFLAGS)
where possible.
(This used to be commit 077f4105aceba99a7ac4de21a20bb758fcc01203)
Diffstat (limited to 'source4/build/pidl/tests/ndr_align.pl')
-rwxr-xr-x | source4/build/pidl/tests/ndr_align.pl | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/source4/build/pidl/tests/ndr_align.pl b/source4/build/pidl/tests/ndr_align.pl new file mode 100755 index 0000000000..5947c2998f --- /dev/null +++ b/source4/build/pidl/tests/ndr_align.pl @@ -0,0 +1,39 @@ +#!/usr/bin/perl +# NDR alignment tests +# (C) 2005 Jelmer Vernooij. Published under the GNU GPL +use strict; + +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'], +); + +Test::test_idl('align-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, 0x00, 0xbe, 0xef }; + DATA_BLOB expected_blob = { expected, 4 }; + DATA_BLOB result_blob; + 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; +'); |