wireshark/tools/pidl/tests/ndr_string.pl

85 lines
1.8 KiB
Perl
Raw Normal View History

#!/usr/bin/perl
# String tests for pidl
# (C) 2005 Jelmer Vernooij <jelmer@samba.org>
# Published under the GNU General Public License
use strict;
use Test::More tests => 3 * 8;
Update from samba tree revision 12430 to 12487 ============================ Samba log start ============ ------------------------------------------------------------------------ r12462 | jelmer | 2005-12-24 22:57:51 +0100 (Sat, 24 Dec 2005) | 2 lines Hide oo magic from callers of the parser ------------------------------------------------------------------------ r12463 | jelmer | 2005-12-24 23:11:44 +0100 (Sat, 24 Dec 2005) | 2 lines Rename 'Samba' namespace to 'Samba4' ------------------------------------------------------------------------ r12464 | jelmer | 2005-12-25 00:32:50 +0100 (Sun, 25 Dec 2005) | 4 lines Add simple IDL parsing tests for pidl using the standard perl testing framework (Test::Simple, distributed with perl itself). Run these tests from 'make test' ------------------------------------------------------------------------ r12465 | jelmer | 2005-12-25 02:33:35 +0100 (Sun, 25 Dec 2005) | 3 lines Merge Parse::Pidl::Samba4::NDR::Header into Parse::Pidl::Samba4::NDR::Parser. Small optimization to avoid including NDR headers multiple times ------------------------------------------------------------------------ r12470 | jelmer | 2005-12-25 04:04:13 +0100 (Sun, 25 Dec 2005) | 3 lines Add helper module for pidl tests Convert other pidl tests to use Test::More and run them from 'make test' ------------------------------------------------------------------------ r12480 | jelmer | 2005-12-25 15:11:59 +0100 (Sun, 25 Dec 2005) | 2 lines Extend testsuite ------------------------------------------------------------------------ r12481 | jelmer | 2005-12-25 15:59:21 +0100 (Sun, 25 Dec 2005) | 4 lines Move parser-specific utility functions to idl.yp, remove some unused functions Allow the use of non-typedef structs and unions when declaring variables. Allow the use of the 'signed' and 'unsigned' qualifiers for integer types ------------------------------------------------------------------------ r12482 | jelmer | 2005-12-25 15:59:39 +0100 (Sun, 25 Dec 2005) | 2 lines Add some more tests ------------------------------------------------------------------------ r12483 | jelmer | 2005-12-25 16:19:55 +0100 (Sun, 25 Dec 2005) | 2 lines Remove --tdr-header option (merged into --tdr-parser) ------------------------------------------------------------------------ r12484 | jelmer | 2005-12-25 18:12:52 +0100 (Sun, 25 Dec 2005) | 2 lines Initial work on supporting non-typedeffed types ------------------------------------------------------------------------ ============================ Samba log end ============== svn path=/trunk/; revision=16896
2005-12-26 00:47:24 +00:00
use FindBin qw($RealBin);
use lib "$RealBin/../lib";
use lib "$RealBin";
use Util qw(test_samba4_ndr);
Update from samba tree revision 12430 to 12487 ============================ Samba log start ============ ------------------------------------------------------------------------ r12462 | jelmer | 2005-12-24 22:57:51 +0100 (Sat, 24 Dec 2005) | 2 lines Hide oo magic from callers of the parser ------------------------------------------------------------------------ r12463 | jelmer | 2005-12-24 23:11:44 +0100 (Sat, 24 Dec 2005) | 2 lines Rename 'Samba' namespace to 'Samba4' ------------------------------------------------------------------------ r12464 | jelmer | 2005-12-25 00:32:50 +0100 (Sun, 25 Dec 2005) | 4 lines Add simple IDL parsing tests for pidl using the standard perl testing framework (Test::Simple, distributed with perl itself). Run these tests from 'make test' ------------------------------------------------------------------------ r12465 | jelmer | 2005-12-25 02:33:35 +0100 (Sun, 25 Dec 2005) | 3 lines Merge Parse::Pidl::Samba4::NDR::Header into Parse::Pidl::Samba4::NDR::Parser. Small optimization to avoid including NDR headers multiple times ------------------------------------------------------------------------ r12470 | jelmer | 2005-12-25 04:04:13 +0100 (Sun, 25 Dec 2005) | 3 lines Add helper module for pidl tests Convert other pidl tests to use Test::More and run them from 'make test' ------------------------------------------------------------------------ r12480 | jelmer | 2005-12-25 15:11:59 +0100 (Sun, 25 Dec 2005) | 2 lines Extend testsuite ------------------------------------------------------------------------ r12481 | jelmer | 2005-12-25 15:59:21 +0100 (Sun, 25 Dec 2005) | 4 lines Move parser-specific utility functions to idl.yp, remove some unused functions Allow the use of non-typedef structs and unions when declaring variables. Allow the use of the 'signed' and 'unsigned' qualifiers for integer types ------------------------------------------------------------------------ r12482 | jelmer | 2005-12-25 15:59:39 +0100 (Sun, 25 Dec 2005) | 2 lines Add some more tests ------------------------------------------------------------------------ r12483 | jelmer | 2005-12-25 16:19:55 +0100 (Sun, 25 Dec 2005) | 2 lines Remove --tdr-header option (merged into --tdr-parser) ------------------------------------------------------------------------ r12484 | jelmer | 2005-12-25 18:12:52 +0100 (Sun, 25 Dec 2005) | 2 lines Initial work on supporting non-typedeffed types ------------------------------------------------------------------------ ============================ Samba log end ============== svn path=/trunk/; revision=16896
2005-12-26 00:47:24 +00:00
test_samba4_ndr("string-pull-empty",
' [public] void TestString([in,flag(STR_ASCII|LIBNDR_FLAG_STR_SIZE4)] string data);',
'
uint8_t data[] = { 0x00, 0x00, 0x00, 0x00 };
DATA_BLOB b = { data, 4 };
struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL);
struct TestString r;
r.in.data = NULL;
if (NT_STATUS_IS_ERR(ndr_pull_TestString(ndr, NDR_IN, &r)))
return 1;
if (r.in.data == NULL)
return 2;
if (r.in.data[0] != 0)
return 3;
');
Update from samba tree revision 12430 to 12487 ============================ Samba log start ============ ------------------------------------------------------------------------ r12462 | jelmer | 2005-12-24 22:57:51 +0100 (Sat, 24 Dec 2005) | 2 lines Hide oo magic from callers of the parser ------------------------------------------------------------------------ r12463 | jelmer | 2005-12-24 23:11:44 +0100 (Sat, 24 Dec 2005) | 2 lines Rename 'Samba' namespace to 'Samba4' ------------------------------------------------------------------------ r12464 | jelmer | 2005-12-25 00:32:50 +0100 (Sun, 25 Dec 2005) | 4 lines Add simple IDL parsing tests for pidl using the standard perl testing framework (Test::Simple, distributed with perl itself). Run these tests from 'make test' ------------------------------------------------------------------------ r12465 | jelmer | 2005-12-25 02:33:35 +0100 (Sun, 25 Dec 2005) | 3 lines Merge Parse::Pidl::Samba4::NDR::Header into Parse::Pidl::Samba4::NDR::Parser. Small optimization to avoid including NDR headers multiple times ------------------------------------------------------------------------ r12470 | jelmer | 2005-12-25 04:04:13 +0100 (Sun, 25 Dec 2005) | 3 lines Add helper module for pidl tests Convert other pidl tests to use Test::More and run them from 'make test' ------------------------------------------------------------------------ r12480 | jelmer | 2005-12-25 15:11:59 +0100 (Sun, 25 Dec 2005) | 2 lines Extend testsuite ------------------------------------------------------------------------ r12481 | jelmer | 2005-12-25 15:59:21 +0100 (Sun, 25 Dec 2005) | 4 lines Move parser-specific utility functions to idl.yp, remove some unused functions Allow the use of non-typedef structs and unions when declaring variables. Allow the use of the 'signed' and 'unsigned' qualifiers for integer types ------------------------------------------------------------------------ r12482 | jelmer | 2005-12-25 15:59:39 +0100 (Sun, 25 Dec 2005) | 2 lines Add some more tests ------------------------------------------------------------------------ r12483 | jelmer | 2005-12-25 16:19:55 +0100 (Sun, 25 Dec 2005) | 2 lines Remove --tdr-header option (merged into --tdr-parser) ------------------------------------------------------------------------ r12484 | jelmer | 2005-12-25 18:12:52 +0100 (Sun, 25 Dec 2005) | 2 lines Initial work on supporting non-typedeffed types ------------------------------------------------------------------------ ============================ Samba log end ============== svn path=/trunk/; revision=16896
2005-12-26 00:47:24 +00:00
test_samba4_ndr("string-ascii-pull",
'
[public] void TestString([in,flag(STR_ASCII|LIBNDR_FLAG_STR_SIZE4)] string data);
',
'
uint8_t data[] = { 0x03, 0x00, 0x00, 0x00,
\'f\', \'o\', \'o\', 0 };
DATA_BLOB b = { data, 8 };
struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL);
struct TestString r;
r.in.data = NULL;
if (NT_STATUS_IS_ERR(ndr_pull_TestString(ndr, NDR_IN, &r)))
return 1;
if (r.in.data == NULL)
return 2;
if (strncmp(r.in.data, "foo", 3) != 0)
return 3;
if (r.in.data[4] != 0)
return 4;
');
test_samba4_ndr("string-out",
'
[public] void TestString([out,string] uint8 **data);
',
'
uint8_t data[] = { 0x03, 0x00, 0x00, 0x00,
\'f\', \'o\', \'o\', 0 };
DATA_BLOB b = { data, 8 };
struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL);
struct TestString r;
char *str = NULL;
r.out.data = &str;
if (NT_STATUS_IS_ERR(ndr_pull_TestString(ndr, NDR_IN, &r)))
return 1;
if (r.out.data == NULL)
return 2;
if (*r.out.data == NULL)
return 3;
if (strncmp(r.out.data, "foo", 3) != 0)
return 3;
Update from samba tree revision 19759 to 19883 ============================ Samba log start ============ ------------------------------------------------------------------------ r19790 | vlendec | 2006-11-19 18:56:35 +0100 (Sun, 19 Nov 2006) | 10 lines Changed paths: M /branches/SAMBA_3_0/source/libmsrpc/cac_winreg.c M /branches/SAMBA_3_0/source/librpc/gen_ndr/cli_unixinfo.c M /branches/SAMBA_3_0/source/librpc/gen_ndr/cli_unixinfo.h M /branches/SAMBA_3_0/source/librpc/gen_ndr/cli_winreg.c M /branches/SAMBA_3_0/source/librpc/gen_ndr/cli_winreg.h M /branches/SAMBA_3_0/source/librpc/gen_ndr/ndr_winreg.c M /branches/SAMBA_3_0/source/librpc/gen_ndr/winreg.h M /branches/SAMBA_3_0/source/rpcclient/cmd_unixinfo.c M /branches/SAMBA_3_0/source/utils/net_rpc_registry.c M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4.pm Check in the PIDL change and the converted unixinfo and winbind pipes without waiting for comments. This is what version control is for, and it does fix a segfault I ran into ;-) Nevertheless, Jelmer & Jerry, please take a look! Thanks, Volker ------------------------------------------------------------------------ r19829 | jelmer | 2006-11-22 00:15:57 +0100 (Wed, 22 Nov 2006) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/pidl Update documentation. ------------------------------------------------------------------------ r19830 | jelmer | 2006-11-22 00:21:08 +0100 (Wed, 22 Nov 2006) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/NDR.pm Warn about non-ref top-level pointers. ------------------------------------------------------------------------ r19834 | jelmer | 2006-11-22 14:59:14 +0100 (Wed, 22 Nov 2006) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/NDR.pm Prevent some inaccurate warnings. ------------------------------------------------------------------------ r19842 | jelmer | 2006-11-22 17:53:30 +0100 (Wed, 22 Nov 2006) | 3 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/NDR.pm Complain about unknown pointer types. Fallback to "unique" when "ptr" is specified instead of failing. ------------------------------------------------------------------------ r19845 | jelmer | 2006-11-22 18:13:19 +0100 (Wed, 22 Nov 2006) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/NDR.pm Add warning for pointer_default_top() ------------------------------------------------------------------------ r19854 | metze | 2006-11-23 14:11:08 +0100 (Thu, 23 Nov 2006) | 4 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/NDR.pm readd support for 'sptr' pointers, to work against windows servers until jelmer commits his 'ptr' support metze ------------------------------------------------------------------------ r19856 | jelmer | 2006-11-23 14:48:01 +0100 (Thu, 23 Nov 2006) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/librpc/idl/epmapper.idl M /branches/SAMBA_4_0/source/librpc/ndr/ndr_basic.c M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/NDR.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm Use sptr as basis for full ptr implementation. Will add checks for duplicates later. ------------------------------------------------------------------------ r19859 | jelmer | 2006-11-23 17:02:20 +0100 (Thu, 23 Nov 2006) | 3 lines Changed paths: M /branches/SAMBA_4_0/source/librpc/ndr/libndr.h M /branches/SAMBA_4_0/source/librpc/ndr/ndr_basic.c M /branches/SAMBA_4_0/source/pidl/tests/Util.pm A /branches/SAMBA_4_0/source/pidl/tests/ndr_fullptr.pl Reuse referrent ids when pushing full pointers (still need to avoid pushing the referred object twice) and add test for full pointers. ------------------------------------------------------------------------ r19866 | jelmer | 2006-11-23 19:26:55 +0100 (Thu, 23 Nov 2006) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/tests/ndr_fullptr.pl Fix test compilation. ------------------------------------------------------------------------ r19868 | jelmer | 2006-11-23 21:59:09 +0100 (Thu, 23 Nov 2006) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/tests/Util.pm M /branches/SAMBA_4_0/source/pidl/tests/ndr_align.pl M /branches/SAMBA_4_0/source/pidl/tests/ndr_represent.pl M /branches/SAMBA_4_0/source/pidl/tests/ndr_string.pl Fix more tests. ------------------------------------------------------------------------ ------------------------------------------------------------------------ ============================ Samba log end ============== svn path=/trunk/; revision=19979
2006-11-25 10:35:39 +00:00
if (r.out.data[4] != 0)
return 4;
');