diff options
Diffstat (limited to '')
-rw-r--r-- | tools/pidl/tests/Util.pm | 1 | ||||
-rwxr-xr-x | tools/pidl/tests/header.pl | 21 | ||||
-rwxr-xr-x | tools/pidl/tests/ndr.pl | 3 | ||||
-rwxr-xr-x | tools/pidl/tests/ndr_align.pl | 11 | ||||
-rwxr-xr-x | tools/pidl/tests/ndr_alloc.pl | 1 | ||||
-rwxr-xr-x | tools/pidl/tests/ndr_array.pl | 1 | ||||
-rwxr-xr-x | tools/pidl/tests/ndr_compat.pl | 1 | ||||
-rwxr-xr-x | tools/pidl/tests/ndr_fullptr.pl | 3 | ||||
-rwxr-xr-x | tools/pidl/tests/ndr_refptr.pl | 37 | ||||
-rwxr-xr-x | tools/pidl/tests/ndr_represent.pl | 1 | ||||
-rwxr-xr-x | tools/pidl/tests/ndr_simple.pl | 1 | ||||
-rwxr-xr-x | tools/pidl/tests/ndr_string.pl | 1 | ||||
-rwxr-xr-x | tools/pidl/tests/ndr_tagtype.pl | 8 | ||||
-rwxr-xr-x | tools/pidl/tests/parse_idl.pl | 2 | ||||
-rwxr-xr-x | tools/pidl/tests/samba-ndr.pl | 1 | ||||
-rwxr-xr-x | tools/pidl/tests/samba3-cli.pl | 2 | ||||
-rwxr-xr-x | tools/pidl/tests/tdr.pl | 12 | ||||
-rwxr-xr-x | tools/pidl/tests/test_util.pl | 1 | ||||
-rwxr-xr-x | tools/pidl/tests/typelist.pl | 4 | ||||
-rwxr-xr-x | tools/pidl/tests/wireshark-ndr.pl | 48 |
20 files changed, 96 insertions, 64 deletions
diff --git a/tools/pidl/tests/Util.pm b/tools/pidl/tests/Util.pm index 86b521bf..a7b5a63f 100644 --- a/tools/pidl/tests/Util.pm +++ b/tools/pidl/tests/Util.pm @@ -9,6 +9,7 @@ require Exporter; @EXPORT = qw(test_samba4_ndr test_warnings test_errors); use strict; +use warnings; use FindBin qw($RealBin); use lib "$RealBin/../lib"; diff --git a/tools/pidl/tests/header.pl b/tools/pidl/tests/header.pl index db594844..dc8bbd7a 100755 --- a/tools/pidl/tests/header.pl +++ b/tools/pidl/tests/header.pl @@ -4,7 +4,7 @@ use strict; use warnings; -use Test::More tests => 27; +use Test::More tests => 30; use FindBin qw($RealBin); use lib "$RealBin"; use Util; @@ -23,6 +23,16 @@ sub parse_idl($) return Parse::Pidl::Samba4::Header::Parse($ndr); } +sub load_and_parse_idl($) +{ + my $text = shift; + my $ndr; + my $idl = Parse::Pidl::IDL::parse_string($text, "nofile"); + Parse::Pidl::Typelist::LoadIdl($idl, "noname"); + $ndr = Parse::Pidl::NDR::Parse($idl); + return Parse::Pidl::Samba4::Header::Parse($ndr); +} + like(parse_idl(""), qr/\/\* header auto-generated by pidl \*\/\n/sm, "includes work"); like(parse_idl("interface x {}"), qr/\/\* header auto-generated by pidl \*\/\n/sm, "simple empty interface doesn't cause overhead"); like(parse_idl("interface p { typedef struct { int y; } x; };"), @@ -59,6 +69,15 @@ like(parse_idl("interface p { typedef struct x { int p; } x; };"), like(parse_idl("cpp_quote(\"some-foo\")"), qr/some-foo/sm, "cpp quote"); +like(load_and_parse_idl("interface hang {typedef [public] struct { wsp_cbasestoragevariant a[SINGLE]; } foo; typedef [public,nodiscriminant,switch_type(uint16)] union { [case(VT_I1)] int8 vt_i1; [case(VT_VARIANT)] foo b; } variant_types; typedef [public] struct { [switch_is(vtype)] variant_types vvalue; } bar;};"), + qr/struct foo.*{.*struct wsp_cbasestoragevariant \*a.*struct bar \{.*union variant_types vvalue.*;/sm,"test for hang with nested struct with union"); + +like(load_and_parse_idl("interface hang { typedef struct { uint32 count; bar a[count];} foo ; typedef struct { foo b; } bar; };"), + qr/struct foo.*{.*struct bar \*a;/sm,"test for hang with nested struct"); + +like(load_and_parse_idl("interface hang { typedef struct { bar a; } foo ; typedef struct { foo b; } bar; };"), + qr/struct foo.*{.*struct bar a;/sm,"test for hang with uncompilable nested struct"); + # Make sure GenerateFunctionInEnv and GenerateFunctionOutEnv work my $fn = { ELEMENTS => [ { DIRECTION => ["in"], NAME => "foo" } ] }; is_deeply({ "foo" => "r->in.foo" }, GenerateFunctionInEnv($fn)); diff --git a/tools/pidl/tests/ndr.pl b/tools/pidl/tests/ndr.pl index b6fd4899..8f845452 100755 --- a/tools/pidl/tests/ndr.pl +++ b/tools/pidl/tests/ndr.pl @@ -4,7 +4,7 @@ use strict; use warnings; -use Test::More tests => 47; +use Test::More tests => 48; use FindBin qw($RealBin); use lib "$RealBin"; use Util; @@ -480,6 +480,7 @@ $ne = ParseElement($e, undef, 0); is($ne->{REPRESENTATION_TYPE}, "uint8"); is(align_type("hyper"), 8); +is(align_type("int64"), 8); is(align_type("double"), 8); is(align_type("uint32"), 4); is(align_type("uint16"), 2); diff --git a/tools/pidl/tests/ndr_align.pl b/tools/pidl/tests/ndr_align.pl index cc089eaa..80d61158 100755 --- a/tools/pidl/tests/ndr_align.pl +++ b/tools/pidl/tests/ndr_align.pl @@ -2,6 +2,7 @@ # NDR alignment tests # (C) 2005 Jelmer Vernooij. Published under the GNU GPL use strict; +use warnings; use Test::More tests => 5 * 8; use FindBin qw($RealBin); @@ -16,7 +17,7 @@ test_samba4_ndr('align-uint8-uint16', } bla; ', ' - struct ndr_push *ndr = ndr_push_init_ctx(NULL, NULL); + struct ndr_push *ndr = ndr_push_init_ctx(NULL); struct bla r; uint8_t expected[] = { 0x0D, 0x00, 0xef, 0xbe }; DATA_BLOB expected_blob = { expected, 4 }; @@ -41,7 +42,7 @@ test_samba4_ndr('align-uint8-uint32', } bla; ', ' - struct ndr_push *ndr = ndr_push_init_ctx(NULL, NULL); + struct ndr_push *ndr = ndr_push_init_ctx(NULL); struct bla r; uint8_t expected[] = { 0x0D, 0x00, 0x00, 0x00, 0xef, 0xbe, 0xef, 0xbe }; DATA_BLOB expected_blob = { expected, 8 }; @@ -67,7 +68,7 @@ test_samba4_ndr('align-uint8-hyper', } bla; ', ' - struct ndr_push *ndr = ndr_push_init_ctx(NULL, NULL); + struct ndr_push *ndr = ndr_push_init_ctx(NULL); struct bla r; uint8_t expected[] = { 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0xbe, 0xef, 0xbe, 0xef, 0xbe, 0xef, 0xbe }; @@ -93,7 +94,7 @@ test_samba4_ndr('noalignflag-uint8-uint16', } bla; ', ' - struct ndr_push *ndr = ndr_push_init_ctx(NULL, NULL); + struct ndr_push *ndr = ndr_push_init_ctx(NULL); struct bla r; uint8_t expected[] = { 0x0D, 0xef, 0xbe }; DATA_BLOB expected_blob = { expected, 3 }; @@ -121,7 +122,7 @@ test_samba4_ndr('align-blob-align2', } blie; ', ' - struct ndr_push *ndr = ndr_push_init_ctx(NULL, NULL); + struct ndr_push *ndr = ndr_push_init_ctx(NULL); struct blie r; uint8_t data[] = { 0x01, 0x02 }; uint8_t expected[] = { 0x0D, 0x00, 0x0E }; diff --git a/tools/pidl/tests/ndr_alloc.pl b/tools/pidl/tests/ndr_alloc.pl index 399fbd21..c708c3b5 100755 --- a/tools/pidl/tests/ndr_alloc.pl +++ b/tools/pidl/tests/ndr_alloc.pl @@ -2,6 +2,7 @@ # NDR allocation tests # (C) 2005 Jelmer Vernooij. Published under the GNU GPL use strict; +use warnings; use Test::More tests => 5 * 8; use FindBin qw($RealBin); diff --git a/tools/pidl/tests/ndr_array.pl b/tools/pidl/tests/ndr_array.pl index 2a6b5bbd..46ab83ec 100755 --- a/tools/pidl/tests/ndr_array.pl +++ b/tools/pidl/tests/ndr_array.pl @@ -3,6 +3,7 @@ # (C) 2005 Jelmer Vernooij <jelmer@samba.org> # Published under the GNU General Public License use strict; +use warnings; use Test::More tests => 8; use FindBin qw($RealBin); diff --git a/tools/pidl/tests/ndr_compat.pl b/tools/pidl/tests/ndr_compat.pl index 355e7f67..06f7efb4 100755 --- a/tools/pidl/tests/ndr_compat.pl +++ b/tools/pidl/tests/ndr_compat.pl @@ -2,6 +2,7 @@ # (C) 2007 Jelmer Vernooij <jelmer@samba.org> # Published under the GNU General Public License use strict; +use warnings; use Test::More tests => 2; use FindBin qw($RealBin); diff --git a/tools/pidl/tests/ndr_fullptr.pl b/tools/pidl/tests/ndr_fullptr.pl index cc6fca7a..109b368e 100755 --- a/tools/pidl/tests/ndr_fullptr.pl +++ b/tools/pidl/tests/ndr_fullptr.pl @@ -3,6 +3,7 @@ # (C) 2006 Jelmer Vernooij <jelmer@samba.org>. # Published under the GNU General Public License. use strict; +use warnings; use Test::More tests => 1 * 8; use FindBin qw($RealBin); @@ -17,7 +18,7 @@ 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_ctx(NULL, NULL); + struct ndr_push *ndr = ndr_push_init_ctx(NULL); uint32_t v = 13; struct echo_TestFull r; r.in.x = &v; diff --git a/tools/pidl/tests/ndr_refptr.pl b/tools/pidl/tests/ndr_refptr.pl index d5dd8395..94676a80 100755 --- a/tools/pidl/tests/ndr_refptr.pl +++ b/tools/pidl/tests/ndr_refptr.pl @@ -4,6 +4,7 @@ # (C) 2005 Jelmer Vernooij <jelmer@samba.org>. # Published under the GNU General Public License. use strict; +use warnings; use Test::More tests => 22 * 8; use FindBin qw($RealBin); @@ -18,7 +19,7 @@ test_samba4_ndr("noptr-push", [public] uint16 echo_TestRef([in] xstruct foo); ', ' - struct ndr_push *ndr = ndr_push_init_ctx(NULL, NULL); + struct ndr_push *ndr = ndr_push_init_ctx(NULL); uint16_t v = 13; struct echo_TestRef r; r.in.foo.x = v; @@ -48,7 +49,7 @@ test_samba4_ndr("ptr-embedded-push", ', ' uint16_t v = 13; - struct ndr_push *ndr = ndr_push_init_ctx(NULL, NULL); + struct ndr_push *ndr = ndr_push_init_ctx(NULL); struct echo_TestRef r; r.in.foo.x = &v; @@ -74,7 +75,7 @@ test_samba4_ndr("ptr-embedded-push-null", [public] uint16 echo_TestRef([in] xstruct foo); ', ' - struct ndr_push *ndr = ndr_push_init_ctx(NULL, NULL); + struct ndr_push *ndr = ndr_push_init_ctx(NULL); struct echo_TestRef r; r.in.foo.x = NULL; @@ -99,7 +100,7 @@ test_samba4_ndr("refptr-embedded-push", ', ' uint16_t v = 13; - struct ndr_push *ndr = ndr_push_init_ctx(NULL, NULL); + struct ndr_push *ndr = ndr_push_init_ctx(NULL); struct echo_TestRef r; r.in.foo.x = &v; @@ -126,7 +127,7 @@ test_samba4_ndr("refptr-embedded-push-null", [public] uint16 echo_TestRef([in] xstruct foo); ', ' - struct ndr_push *ndr = ndr_push_init_ctx(NULL, NULL); + struct ndr_push *ndr = ndr_push_init_ctx(NULL); struct echo_TestRef r; r.in.foo.x = NULL; @@ -144,7 +145,7 @@ test_samba4_ndr("ptr-top-push", [public] uint16 echo_TestRef([in] xstruct *foo); ', ' - struct ndr_push *ndr = ndr_push_init_ctx(NULL, NULL); + struct ndr_push *ndr = ndr_push_init_ctx(NULL); struct echo_TestRef r; struct xstruct s; s.x = 13; @@ -169,7 +170,7 @@ test_samba4_ndr("ptr-top-push-null", [public] uint16 echo_TestRef([in] xstruct *foo); ', ' - struct ndr_push *ndr = ndr_push_init_ctx(NULL, NULL); + struct ndr_push *ndr = ndr_push_init_ctx(NULL); struct echo_TestRef r; r.in.foo = NULL; @@ -189,7 +190,7 @@ test_samba4_ndr("refptr-top-push", [public] uint16 echo_TestRef([in,ref] xstruct *foo); ', ' - struct ndr_push *ndr = ndr_push_init_ctx(NULL, NULL); + struct ndr_push *ndr = ndr_push_init_ctx(NULL); struct echo_TestRef r; struct xstruct s; s.x = 13; @@ -214,7 +215,7 @@ test_samba4_ndr("refptr-top-push-null", [public] uint16 echo_TestRef([in,ref] xstruct *foo); ', ' - struct ndr_push *ndr = ndr_push_init_ctx(NULL, NULL); + struct ndr_push *ndr = ndr_push_init_ctx(NULL); struct echo_TestRef r; r.in.foo = NULL; @@ -233,7 +234,7 @@ test_samba4_ndr("uniqueptr-top-push", [public] uint16 echo_TestRef([in,unique] xstruct *foo); ', ' - struct ndr_push *ndr = ndr_push_init_ctx(NULL, NULL); + struct ndr_push *ndr = ndr_push_init_ctx(NULL); struct echo_TestRef r; struct xstruct s; s.x = 13; @@ -261,7 +262,7 @@ test_samba4_ndr("uniqueptr-top-push-null", [public] uint16 echo_TestRef([in,unique] xstruct *foo); ', ' - struct ndr_push *ndr = ndr_push_init_ctx(NULL, NULL); + struct ndr_push *ndr = ndr_push_init_ctx(NULL); struct echo_TestRef r; r.in.foo = NULL; @@ -381,7 +382,7 @@ test_samba4_ndr("ptr-top-push-double", ' [public] void echo_TestRef([in] uint16 **foo); ', -' struct ndr_push *ndr = ndr_push_init_ctx(NULL, NULL); +' struct ndr_push *ndr = ndr_push_init_ctx(NULL); struct echo_TestRef r; uint16_t v = 13; uint16_t *pv = &v; @@ -408,7 +409,7 @@ test_samba4_ndr("ptr-top-push-double-sndnull", ' [public] void echo_TestRef([in] uint16 **foo); ', -' struct ndr_push *ndr = ndr_push_init_ctx(NULL, NULL); +' struct ndr_push *ndr = ndr_push_init_ctx(NULL); struct echo_TestRef r; uint16_t *pv = NULL; r.in.foo = &pv; @@ -429,7 +430,7 @@ test_samba4_ndr("ptr-top-push-double-fstnull", ' [public] void echo_TestRef([in] uint16 **foo); ', -' struct ndr_push *ndr = ndr_push_init_ctx(NULL, NULL); +' struct ndr_push *ndr = ndr_push_init_ctx(NULL); struct echo_TestRef r; r.in.foo = NULL; @@ -445,7 +446,7 @@ test_samba4_ndr("refptr-top-push-double", ' [public] void echo_TestRef([in,ref] uint16 **foo); ', -' struct ndr_push *ndr = ndr_push_init_ctx(NULL, NULL); +' struct ndr_push *ndr = ndr_push_init_ctx(NULL); struct echo_TestRef r; uint16_t v = 13; uint16_t *pv = &v; @@ -473,7 +474,7 @@ test_samba4_ndr("refptr-top-push-double-sndnull", ' [public] void echo_TestRef([in,ref] uint16 **foo); ', -' struct ndr_push *ndr = ndr_push_init_ctx(NULL, NULL); +' struct ndr_push *ndr = ndr_push_init_ctx(NULL); struct echo_TestRef r; uint16_t *pv = NULL; r.in.foo = &pv; @@ -494,7 +495,7 @@ test_samba4_ndr("refptr-top-push-double-fstnull", ' [public] void echo_TestRef([in,ref] uint16 **foo); ', -' struct ndr_push *ndr = ndr_push_init_ctx(NULL, NULL); +' struct ndr_push *ndr = ndr_push_init_ctx(NULL); struct echo_TestRef r; r.in.foo = NULL; @@ -511,7 +512,7 @@ test_samba4_ndr("ignore-ptr", ' [public] void echo_TestRef([in,ignore] uint16 *foo, [in] uint16 *bar); ', -' struct ndr_push *ndr = ndr_push_init_ctx(NULL, NULL); +' struct ndr_push *ndr = ndr_push_init_ctx(NULL); struct echo_TestRef r; uint16_t v = 10; r.in.foo = &v; diff --git a/tools/pidl/tests/ndr_represent.pl b/tools/pidl/tests/ndr_represent.pl index 2d65fb92..af9a92b6 100755 --- a/tools/pidl/tests/ndr_represent.pl +++ b/tools/pidl/tests/ndr_represent.pl @@ -2,6 +2,7 @@ # NDR represent_as() / transmit_as() tests # (C) 2006 Jelmer Vernooij. Published under the GNU GPL use strict; +use warnings; use Test::More tests => 2 * 8; use FindBin qw($RealBin); diff --git a/tools/pidl/tests/ndr_simple.pl b/tools/pidl/tests/ndr_simple.pl index 15e07d56..c5c32445 100755 --- a/tools/pidl/tests/ndr_simple.pl +++ b/tools/pidl/tests/ndr_simple.pl @@ -3,6 +3,7 @@ # (C) 2005 Jelmer Vernooij <jelmer@samba.org> # Published under the GNU General Public License use strict; +use warnings; use Test::More tests => 8; use FindBin qw($RealBin); diff --git a/tools/pidl/tests/ndr_string.pl b/tools/pidl/tests/ndr_string.pl index 8e8b8ecb..aa5fd8b5 100755 --- a/tools/pidl/tests/ndr_string.pl +++ b/tools/pidl/tests/ndr_string.pl @@ -3,6 +3,7 @@ # (C) 2005 Jelmer Vernooij <jelmer@samba.org> # Published under the GNU General Public License use strict; +use warnings; use Test::More tests => 6 * 8; use FindBin qw($RealBin); diff --git a/tools/pidl/tests/ndr_tagtype.pl b/tools/pidl/tests/ndr_tagtype.pl index 3f9b717b..fa09cf77 100755 --- a/tools/pidl/tests/ndr_tagtype.pl +++ b/tools/pidl/tests/ndr_tagtype.pl @@ -2,7 +2,7 @@ # Support for tagged types # (C) 2005 Jelmer Vernooij. Published under the GNU GPL use strict; - +use warnings; use Test::More tests => 3 * 8; use FindBin qw($RealBin); use lib "$RealBin"; @@ -10,7 +10,7 @@ use Util qw(test_samba4_ndr); test_samba4_ndr('struct-notypedef', '[public] struct bla { uint8 x; }; ', ' - struct ndr_push *ndr = ndr_push_init_ctx(NULL, NULL); + struct ndr_push *ndr = ndr_push_init_ctx(NULL); struct bla r; uint8_t expected[] = { 0x0D }; DATA_BLOB expected_blob = { expected, 1 }; @@ -29,7 +29,7 @@ test_samba4_ndr('struct-notypedef', '[public] struct bla { uint8 x; }; ', test_samba4_ndr('struct-notypedef-used', '[public] struct bla { uint8 x; }; [public] void myfn([in] struct bla r); ', ' - struct ndr_push *ndr = ndr_push_init_ctx(NULL, NULL); + struct ndr_push *ndr = ndr_push_init_ctx(NULL); struct myfn fn; uint8_t expected[] = { 0x0D }; DATA_BLOB expected_blob = { expected, 1 }; @@ -49,7 +49,7 @@ test_samba4_ndr('struct-notypedef-used', '[public] struct bla { uint8 x; }; test_samba4_ndr('struct-notypedef-embedded', 'struct bla { uint8 x; }; [public] struct myst { struct bla r; }; ', ' - struct ndr_push *ndr = ndr_push_init_ctx(NULL, NULL); + struct ndr_push *ndr = ndr_push_init_ctx(NULL); struct myst st; uint8_t expected[] = { 0x0D }; DATA_BLOB expected_blob = { expected, 1 }; diff --git a/tools/pidl/tests/parse_idl.pl b/tools/pidl/tests/parse_idl.pl index 14138a37..caf701b3 100755 --- a/tools/pidl/tests/parse_idl.pl +++ b/tools/pidl/tests/parse_idl.pl @@ -3,7 +3,7 @@ # (C) 2005 Jelmer Vernooij <jelmer@samba.org> # Published under the GNU General Public License use strict; - +use warnings; use Test::More tests => 65 * 2 + 7; use FindBin qw($RealBin); use lib "$RealBin"; diff --git a/tools/pidl/tests/samba-ndr.pl b/tools/pidl/tests/samba-ndr.pl index 7c53cbc7..54a4e46d 100755 --- a/tools/pidl/tests/samba-ndr.pl +++ b/tools/pidl/tests/samba-ndr.pl @@ -8,7 +8,6 @@ use Test::More tests => 31; use FindBin qw($RealBin); use lib "$RealBin"; use Util; -use strict; use Parse::Pidl::Util qw(MyDumper); use Parse::Pidl::Samba4::NDR::Parser qw(check_null_pointer NeededFunction NeededElement NeededType diff --git a/tools/pidl/tests/samba3-cli.pl b/tools/pidl/tests/samba3-cli.pl index c758ef45..4349abb3 100755 --- a/tools/pidl/tests/samba3-cli.pl +++ b/tools/pidl/tests/samba3-cli.pl @@ -9,7 +9,7 @@ use FindBin qw($RealBin); use lib "$RealBin"; use Util; use Parse::Pidl::Util qw(MyDumper); -use Parse::Pidl::Samba3::ClientNDR qw(ParseFunction); +use Parse::Pidl::Samba3::ClientNDR; use Parse::Pidl::Samba4::Header qw(GenerateFunctionInEnv GenerateFunctionOutEnv); # Make sure GenerateFunctionInEnv and GenerateFunctionOutEnv work diff --git a/tools/pidl/tests/tdr.pl b/tools/pidl/tests/tdr.pl index d6cd7a03..41a560c8 100755 --- a/tools/pidl/tests/tdr.pl +++ b/tools/pidl/tests/tdr.pl @@ -13,18 +13,18 @@ use Parse::Pidl::Samba4::TDR qw(ParserType); my $tdr = new Parse::Pidl::Samba4::TDR(); $tdr->ParserType({TYPE => "STRUCT", NAME => "foo", PROPERTIES => {public => 1}}, "pull"); -is($tdr->{ret}, "NTSTATUS tdr_pull_foo (struct tdr_pull *tdr, TALLOC_CTX *mem_ctx, struct foo *v) +is($tdr->{res}, "NTSTATUS tdr_pull_foo (struct tdr_pull *tdr, TALLOC_CTX *mem_ctx, struct foo *v) { return NT_STATUS_OK; } "); -is($tdr->{ret_hdr}, "NTSTATUS tdr_pull_foo (struct tdr_pull *tdr, TALLOC_CTX *mem_ctx, struct foo *v);\n"); +is($tdr->{res_hdr}, "NTSTATUS tdr_pull_foo (struct tdr_pull *tdr, TALLOC_CTX *mem_ctx, struct foo *v);\n"); $tdr = new Parse::Pidl::Samba4::TDR(); $tdr->ParserType({TYPE => "UNION", NAME => "bar", PROPERTIES => {public => 1}}, "pull"); -is($tdr->{ret}, "NTSTATUS tdr_pull_bar(struct tdr_pull *tdr, TALLOC_CTX *mem_ctx, int level, union bar *v) +is($tdr->{res}, "NTSTATUS tdr_pull_bar(struct tdr_pull *tdr, TALLOC_CTX *mem_ctx, int level, union bar *v) { switch (level) { } @@ -33,11 +33,11 @@ is($tdr->{ret}, "NTSTATUS tdr_pull_bar(struct tdr_pull *tdr, TALLOC_CTX *mem_ctx } "); -is($tdr->{ret_hdr}, "NTSTATUS tdr_pull_bar(struct tdr_pull *tdr, TALLOC_CTX *mem_ctx, int level, union bar *v);\n"); +is($tdr->{res_hdr}, "NTSTATUS tdr_pull_bar(struct tdr_pull *tdr, TALLOC_CTX *mem_ctx, int level, union bar *v);\n"); $tdr = new Parse::Pidl::Samba4::TDR(); $tdr->ParserType({TYPE => "UNION", NAME => "bar", PROPERTIES => {}}, "pull"); -is($tdr->{ret}, "static NTSTATUS tdr_pull_bar(struct tdr_pull *tdr, TALLOC_CTX *mem_ctx, int level, union bar *v) +is($tdr->{res}, "static NTSTATUS tdr_pull_bar(struct tdr_pull *tdr, TALLOC_CTX *mem_ctx, int level, union bar *v) { switch (level) { } @@ -46,4 +46,4 @@ is($tdr->{ret}, "static NTSTATUS tdr_pull_bar(struct tdr_pull *tdr, TALLOC_CTX * } "); -is($tdr->{ret_hdr}, ""); +is($tdr->{res_hdr}, ""); diff --git a/tools/pidl/tests/test_util.pl b/tools/pidl/tests/test_util.pl index 2d59f628..93addcea 100755 --- a/tools/pidl/tests/test_util.pl +++ b/tools/pidl/tests/test_util.pl @@ -2,6 +2,7 @@ # (C) 2007 Jelmer Vernooij <jelmer@samba.org> # Published under the GNU General Public License use strict; +use warnings; use Test::More tests => 6; use FindBin qw($RealBin); diff --git a/tools/pidl/tests/typelist.pl b/tools/pidl/tests/typelist.pl index 681c0eac..e012c806 100755 --- a/tools/pidl/tests/typelist.pl +++ b/tools/pidl/tests/typelist.pl @@ -4,7 +4,7 @@ use strict; use warnings; -use Test::More tests => 56; +use Test::More tests => 58; use FindBin qw($RealBin); use lib "$RealBin"; use Util; @@ -21,6 +21,7 @@ is("int32", expandAlias("int32")); is("uint32_t", mapScalarType("uint32")); is("void", mapScalarType("void")); is("uint64_t", mapScalarType("hyper")); +is("int64_t", mapScalarType("int64")); is("double", mapScalarType("double")); my $x = { TYPE => "ENUM", NAME => "foo", EXTRADATA => 1 }; @@ -66,6 +67,7 @@ is(1, is_scalar({TYPE => "TYPEDEF", DATA => {TYPE => "ENUM" }})); is(1, is_scalar("mytypedef")); is(1, scalar_is_reference("string")); +is(1, scalar_is_reference("u16string")); is(0, scalar_is_reference("uint32")); is(0, scalar_is_reference({TYPE => "STRUCT", NAME => "echo_foobar"})); diff --git a/tools/pidl/tests/wireshark-ndr.pl b/tools/pidl/tests/wireshark-ndr.pl index 229315b0..0edb0ec2 100755 --- a/tools/pidl/tests/wireshark-ndr.pl +++ b/tools/pidl/tests/wireshark-ndr.pl @@ -45,7 +45,7 @@ is($x->{res}->{code}, 'void proto_reg_handoff_dcerpc_bla(void) is($x->{hf_used}->{hf_bla_opnum}, 1); $x->{conformance} = {}; -is("hf_bla_idx", +is("hf_bla_idx", $x->register_hf_field("hf_bla_idx", "bla", "my.filter", "FT_UINT32", "BASE_HEX", "NULL", 0xF, undef)); is_deeply($x->{conformance}, { header_fields => { @@ -68,7 +68,7 @@ $x->{conformance} = { fielddescription => { hf_bla_idx => { DESCRIPTION => "Some is("hf_bla_idx", $x->register_hf_field("hf_bla_idx", "bla", "my.filter", "FT_UINT32", "BASE_HEX", "NULL", 0xF, undef)); is_deeply($x->{conformance}, { - fielddescription => { + fielddescription => { hf_bla_idx => { DESCRIPTION => "Some Description", USED => 1 @@ -91,10 +91,10 @@ is_deeply($x->{conformance}, { $x->{conformance} = { fielddescription => { hf_bla_idx => { DESCRIPTION => "Some Description" }}}; is("hf_bla_idx", - $x->register_hf_field("hf_bla_idx", "bla", "my.filter", "FT_UINT32", "BASE_HEX", "NULL", 0xF, + $x->register_hf_field("hf_bla_idx", "bla", "my.filter", "FT_UINT32", "BASE_HEX", "NULL", 0xF, "Actual Description")); is_deeply($x->{conformance}, { - fielddescription => { + fielddescription => { hf_bla_idx => { DESCRIPTION => "Some Description" } }, header_fields => { @@ -120,14 +120,14 @@ is_deeply($x->{conformance}, { hf_renames => { hf_bla_idx => { USED => 1, NEWNAME => "hf_bloe_idx" } } }); $x->{hf_used} = { hf_bla => 1 }; -test_warnings("", sub { +test_warnings("", sub { $x->CheckUsed({ header_fields => { foo => { INDEX => "hf_bla" }}})}); $x->{hf_used} = { }; -test_warnings("hf field `hf_bla' not used\n", sub { +test_warnings("hf field `hf_bla' not used\n", sub { $x->CheckUsed({ header_fields => { foo => { INDEX => "hf_bla" }}})}); -test_warnings("hf field `hf_id' not used\n", +test_warnings("hf field `hf_id' not used\n", sub { $x->CheckUsed({ hf_renames => { hf_id => { @@ -171,7 +171,7 @@ test_warnings("nofile:1: type never used\n", types => { bla => { USED => 0, - POS => { FILE => "nofile", LINE => 1 } + POS => { FILE => "nofile", LINE => 1 } } } }); } ); @@ -191,39 +191,39 @@ is($x->{res}->{hdr}, "#include \"packet-dcerpc-bla.h\"\n\n"); $x = new Parse::Pidl::Wireshark::NDR(); $x->ProcessImport("\"bla.idl\"", "\"foo.idl\""); -is($x->{res}->{hdr}, "#include \"packet-dcerpc-bla.h\"\n" . +is($x->{res}->{hdr}, "#include \"packet-dcerpc-bla.h\"\n" . "#include \"packet-dcerpc-foo.h\"\n\n"); $x = new Parse::Pidl::Wireshark::NDR(); $x->ProcessInclude("foo.h", "bla.h", "bar.h"); -is($x->{res}->{hdr}, "#include \"foo.h\"\n" . - "#include \"bla.h\"\n" . +is($x->{res}->{hdr}, "#include \"foo.h\"\n" . + "#include \"bla.h\"\n" . "#include \"bar.h\"\n\n"); - + $x->{conformance} = {types => { bla => "brainslug" } }; is("brainslug", $x->find_type("bla")); -is(DumpEttList(["ett_t1", "ett_bla"]), - "\tstatic gint *ett[] = {\n" . +is(DumpEttList(["ett_t1", "ett_bla"]), + "\tstatic int *ett[] = {\n" . "\t\t&ett_t1,\n" . "\t\t&ett_bla,\n" . "\t};\n"); -is(DumpEttList(), "\tstatic gint *ett[] = {\n\t};\n"); -is(DumpEttList(["bla"]), "\tstatic gint *ett[] = {\n\t\t&bla,\n\t};\n"); +is(DumpEttList(), "\tstatic int *ett[] = {\n\t};\n"); +is(DumpEttList(["bla"]), "\tstatic int *ett[] = {\n\t\t&bla,\n\t};\n"); -is(DumpEttDeclaration(["void", "zoid"]), - "\n/* Ett declarations */\n" . - "static gint void = -1;\n" . - "static gint zoid = -1;\n" . +is(DumpEttDeclaration(["void", "zoid"]), + "\n/* Ett declarations */\n" . + "static int void;\n" . + "static int zoid;\n" . "\n"); is(DumpEttDeclaration(), "\n/* Ett declarations */\n\n"); $x->{conformance} = { header_fields => { - hf_bla => { INDEX => "hf_bla", NAME => "Bla", FILTER => "bla.field", FT_TYPE => "FT_UINT32", BASE_TYPE => "BASE_DEC", VALSSTRING => "NULL", MASK => 0xFF, BLURB => "NULL" } - } + hf_bla => { INDEX => "hf_bla", NAME => "Bla", FILTER => "bla.field", FT_TYPE => "FT_UINT32", BASE_TYPE => "BASE_DEC", VALSSTRING => "NULL", MASK => 0xFF, BLURB => "NULL" } + } }; is($x->DumpHfList(), "\tstatic hf_register_info hf[] = { @@ -234,14 +234,14 @@ is($x->DumpHfList(), "\tstatic hf_register_info hf[] = { is($x->DumpHfDeclaration(), " /* Header field declarations */ -static gint hf_bla = -1; +static int hf_bla; "); is(DumpFunctionTable({ NAME => "someif", FUNCTIONS => [ { NAME => "fn1", OPNUM => 3 }, { NAME => "someif_fn2", OPNUM => 2 } ] }), -'static dcerpc_sub_dissector someif_dissectors[] = { +'static const dcerpc_sub_dissector someif_dissectors[] = { { 3, "fn1", someif_dissect_fn1_request, someif_dissect_fn1_response}, { 2, "fn2", |