wireshark/tools/pidl/tests/ndr_simple.pl

29 lines
587 B
Perl
Raw Normal View History

#!/usr/bin/perl
# Some simple tests for pidl
# (C) 2005 Jelmer Vernooij <jelmer@samba.org>
# Published under the GNU General Public License
use strict;
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 Test::More tests => 8;
use FindBin qw($RealBin);
use lib "$RealBin";
use Util qw(test_samba4_ndr);
Update from samba tree revision 25306 to 25880 ============================ Samba log start ============ ------------------------------------------------------------------------ r25453 | jelmer | 2007-10-01 23:38:15 +0200 (Mon, 01 Oct 2007) | 1 line Fix include for NTSTATUS. ------------------------------------------------------------------------ r25457 | jelmer | 2007-10-02 06:45:25 +0200 (Tue, 02 Oct 2007) | 1 line use different location for out-of-tree builds ------------------------------------------------------------------------ r25674 | metze | 2007-10-17 10:26:55 +0200 (Wed, 17 Oct 2007) | 13 lines fix crash bug in pidl generated client code, this could have happend with [in,out,unique] pointers when the clients sends a valid pointer, but the server reponse with a NULL pointer (as samba-3.0.26a do for some calls). I've tested with midl to see how windows handles this situation and also the reverse case where the client sends NULL and the server reposnse with non-NULL. It appears that midl generated code just ignores this and only copies the result if both pointers are non-NULL. metze ------------------------------------------------------------------------ r25700 | jra | 2007-10-19 02:40:51 +0200 (Fri, 19 Oct 2007) | 3 lines Now BOOL no longer exists in Samba 3.2, use bool instead. Jeremy. ------------------------------------------------------------------------ r25745 | metze | 2007-10-27 11:57:09 +0200 (Sat, 27 Oct 2007) | 6 lines [pidl] ndr_pull/push_error(ndr, NDR_ERR_INVALID_POINTER,..) instead NT_STATUS_INVALID_PARAMETER_MIX metze ------------------------------------------------------------------------ r25751 | metze | 2007-10-30 07:24:43 +0100 (Tue, 30 Oct 2007) | 4 lines use EJS_CHECK() instead of NDR_CHECK() in ejs code metze ------------------------------------------------------------------------ r25765 | metze | 2007-10-31 17:25:44 +0100 (Wed, 31 Oct 2007) | 3 lines pidl: fix compiler warning in ndr_align test metze ------------------------------------------------------------------------ r25766 | metze | 2007-10-31 17:27:21 +0100 (Wed, 31 Oct 2007) | 3 lines pidl: fix bugs in ndr_tagtype tests found by compiler warnings metze ------------------------------------------------------------------------ r25767 | metze | 2007-10-31 17:29:32 +0100 (Wed, 31 Oct 2007) | 5 lines pidl: make it easier to debug errors in pidl tests we now print the C program that we tried to compile metze ------------------------------------------------------------------------ r25768 | metze | 2007-10-31 17:44:42 +0100 (Wed, 31 Oct 2007) | 5 lines pidl: NT_STATUS_IS_ERR() is NOT the same as !NT_STATUS_IS_OK() Everything but success should be handled as error in the tests. metze ------------------------------------------------------------------------ r25795 | metze | 2007-11-02 11:35:09 +0100 (Fri, 02 Nov 2007) | 3 lines whitespace cleanup... metze ------------------------------------------------------------------------ r25804 | metze | 2007-11-02 14:02:25 +0100 (Fri, 02 Nov 2007) | 4 lines move including ndr_compression.h into HeaderInterface() metze ------------------------------------------------------------------------ r25805 | metze | 2007-11-02 14:05:43 +0100 (Fri, 02 Nov 2007) | 4 lines pidl: include libndr.h as first header in ndr_foo.h metze ------------------------------------------------------------------------ r25806 | metze | 2007-11-02 14:48:11 +0100 (Fri, 02 Nov 2007) | 5 lines let libndr.h include needed stuff and remove pidl magic for choosing common required headers metze ------------------------------------------------------------------------ ------------------------------------------------------------------------ ============================ Samba log end ============== svn path=/trunk/; revision=23378
2007-11-06 18:31:26 +00:00
test_samba4_ndr("simple", "void Test(); ",
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
"
Update from samba tree revision 25306 to 25880 ============================ Samba log start ============ ------------------------------------------------------------------------ r25453 | jelmer | 2007-10-01 23:38:15 +0200 (Mon, 01 Oct 2007) | 1 line Fix include for NTSTATUS. ------------------------------------------------------------------------ r25457 | jelmer | 2007-10-02 06:45:25 +0200 (Tue, 02 Oct 2007) | 1 line use different location for out-of-tree builds ------------------------------------------------------------------------ r25674 | metze | 2007-10-17 10:26:55 +0200 (Wed, 17 Oct 2007) | 13 lines fix crash bug in pidl generated client code, this could have happend with [in,out,unique] pointers when the clients sends a valid pointer, but the server reponse with a NULL pointer (as samba-3.0.26a do for some calls). I've tested with midl to see how windows handles this situation and also the reverse case where the client sends NULL and the server reposnse with non-NULL. It appears that midl generated code just ignores this and only copies the result if both pointers are non-NULL. metze ------------------------------------------------------------------------ r25700 | jra | 2007-10-19 02:40:51 +0200 (Fri, 19 Oct 2007) | 3 lines Now BOOL no longer exists in Samba 3.2, use bool instead. Jeremy. ------------------------------------------------------------------------ r25745 | metze | 2007-10-27 11:57:09 +0200 (Sat, 27 Oct 2007) | 6 lines [pidl] ndr_pull/push_error(ndr, NDR_ERR_INVALID_POINTER,..) instead NT_STATUS_INVALID_PARAMETER_MIX metze ------------------------------------------------------------------------ r25751 | metze | 2007-10-30 07:24:43 +0100 (Tue, 30 Oct 2007) | 4 lines use EJS_CHECK() instead of NDR_CHECK() in ejs code metze ------------------------------------------------------------------------ r25765 | metze | 2007-10-31 17:25:44 +0100 (Wed, 31 Oct 2007) | 3 lines pidl: fix compiler warning in ndr_align test metze ------------------------------------------------------------------------ r25766 | metze | 2007-10-31 17:27:21 +0100 (Wed, 31 Oct 2007) | 3 lines pidl: fix bugs in ndr_tagtype tests found by compiler warnings metze ------------------------------------------------------------------------ r25767 | metze | 2007-10-31 17:29:32 +0100 (Wed, 31 Oct 2007) | 5 lines pidl: make it easier to debug errors in pidl tests we now print the C program that we tried to compile metze ------------------------------------------------------------------------ r25768 | metze | 2007-10-31 17:44:42 +0100 (Wed, 31 Oct 2007) | 5 lines pidl: NT_STATUS_IS_ERR() is NOT the same as !NT_STATUS_IS_OK() Everything but success should be handled as error in the tests. metze ------------------------------------------------------------------------ r25795 | metze | 2007-11-02 11:35:09 +0100 (Fri, 02 Nov 2007) | 3 lines whitespace cleanup... metze ------------------------------------------------------------------------ r25804 | metze | 2007-11-02 14:02:25 +0100 (Fri, 02 Nov 2007) | 4 lines move including ndr_compression.h into HeaderInterface() metze ------------------------------------------------------------------------ r25805 | metze | 2007-11-02 14:05:43 +0100 (Fri, 02 Nov 2007) | 4 lines pidl: include libndr.h as first header in ndr_foo.h metze ------------------------------------------------------------------------ r25806 | metze | 2007-11-02 14:48:11 +0100 (Fri, 02 Nov 2007) | 5 lines let libndr.h include needed stuff and remove pidl magic for choosing common required headers metze ------------------------------------------------------------------------ ------------------------------------------------------------------------ ============================ Samba log end ============== svn path=/trunk/; revision=23378
2007-11-06 18:31:26 +00:00
uint8_t data[] = { 0x02 };
uint8_t result;
DATA_BLOB b;
struct ndr_pull *ndr;
b.data = data;
b.length = 1;
ndr = ndr_pull_init_blob(&b, mem_ctx, NULL);
Update from samba tree revision 25306 to 25880 ============================ Samba log start ============ ------------------------------------------------------------------------ r25453 | jelmer | 2007-10-01 23:38:15 +0200 (Mon, 01 Oct 2007) | 1 line Fix include for NTSTATUS. ------------------------------------------------------------------------ r25457 | jelmer | 2007-10-02 06:45:25 +0200 (Tue, 02 Oct 2007) | 1 line use different location for out-of-tree builds ------------------------------------------------------------------------ r25674 | metze | 2007-10-17 10:26:55 +0200 (Wed, 17 Oct 2007) | 13 lines fix crash bug in pidl generated client code, this could have happend with [in,out,unique] pointers when the clients sends a valid pointer, but the server reponse with a NULL pointer (as samba-3.0.26a do for some calls). I've tested with midl to see how windows handles this situation and also the reverse case where the client sends NULL and the server reposnse with non-NULL. It appears that midl generated code just ignores this and only copies the result if both pointers are non-NULL. metze ------------------------------------------------------------------------ r25700 | jra | 2007-10-19 02:40:51 +0200 (Fri, 19 Oct 2007) | 3 lines Now BOOL no longer exists in Samba 3.2, use bool instead. Jeremy. ------------------------------------------------------------------------ r25745 | metze | 2007-10-27 11:57:09 +0200 (Sat, 27 Oct 2007) | 6 lines [pidl] ndr_pull/push_error(ndr, NDR_ERR_INVALID_POINTER,..) instead NT_STATUS_INVALID_PARAMETER_MIX metze ------------------------------------------------------------------------ r25751 | metze | 2007-10-30 07:24:43 +0100 (Tue, 30 Oct 2007) | 4 lines use EJS_CHECK() instead of NDR_CHECK() in ejs code metze ------------------------------------------------------------------------ r25765 | metze | 2007-10-31 17:25:44 +0100 (Wed, 31 Oct 2007) | 3 lines pidl: fix compiler warning in ndr_align test metze ------------------------------------------------------------------------ r25766 | metze | 2007-10-31 17:27:21 +0100 (Wed, 31 Oct 2007) | 3 lines pidl: fix bugs in ndr_tagtype tests found by compiler warnings metze ------------------------------------------------------------------------ r25767 | metze | 2007-10-31 17:29:32 +0100 (Wed, 31 Oct 2007) | 5 lines pidl: make it easier to debug errors in pidl tests we now print the C program that we tried to compile metze ------------------------------------------------------------------------ r25768 | metze | 2007-10-31 17:44:42 +0100 (Wed, 31 Oct 2007) | 5 lines pidl: NT_STATUS_IS_ERR() is NOT the same as !NT_STATUS_IS_OK() Everything but success should be handled as error in the tests. metze ------------------------------------------------------------------------ r25795 | metze | 2007-11-02 11:35:09 +0100 (Fri, 02 Nov 2007) | 3 lines whitespace cleanup... metze ------------------------------------------------------------------------ r25804 | metze | 2007-11-02 14:02:25 +0100 (Fri, 02 Nov 2007) | 4 lines move including ndr_compression.h into HeaderInterface() metze ------------------------------------------------------------------------ r25805 | metze | 2007-11-02 14:05:43 +0100 (Fri, 02 Nov 2007) | 4 lines pidl: include libndr.h as first header in ndr_foo.h metze ------------------------------------------------------------------------ r25806 | metze | 2007-11-02 14:48:11 +0100 (Fri, 02 Nov 2007) | 5 lines let libndr.h include needed stuff and remove pidl magic for choosing common required headers metze ------------------------------------------------------------------------ ------------------------------------------------------------------------ ============================ Samba log end ============== svn path=/trunk/; revision=23378
2007-11-06 18:31:26 +00:00
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_pull_uint8(ndr, NDR_SCALARS, &result)))
Update from samba tree revision 25306 to 25880 ============================ Samba log start ============ ------------------------------------------------------------------------ r25453 | jelmer | 2007-10-01 23:38:15 +0200 (Mon, 01 Oct 2007) | 1 line Fix include for NTSTATUS. ------------------------------------------------------------------------ r25457 | jelmer | 2007-10-02 06:45:25 +0200 (Tue, 02 Oct 2007) | 1 line use different location for out-of-tree builds ------------------------------------------------------------------------ r25674 | metze | 2007-10-17 10:26:55 +0200 (Wed, 17 Oct 2007) | 13 lines fix crash bug in pidl generated client code, this could have happend with [in,out,unique] pointers when the clients sends a valid pointer, but the server reponse with a NULL pointer (as samba-3.0.26a do for some calls). I've tested with midl to see how windows handles this situation and also the reverse case where the client sends NULL and the server reposnse with non-NULL. It appears that midl generated code just ignores this and only copies the result if both pointers are non-NULL. metze ------------------------------------------------------------------------ r25700 | jra | 2007-10-19 02:40:51 +0200 (Fri, 19 Oct 2007) | 3 lines Now BOOL no longer exists in Samba 3.2, use bool instead. Jeremy. ------------------------------------------------------------------------ r25745 | metze | 2007-10-27 11:57:09 +0200 (Sat, 27 Oct 2007) | 6 lines [pidl] ndr_pull/push_error(ndr, NDR_ERR_INVALID_POINTER,..) instead NT_STATUS_INVALID_PARAMETER_MIX metze ------------------------------------------------------------------------ r25751 | metze | 2007-10-30 07:24:43 +0100 (Tue, 30 Oct 2007) | 4 lines use EJS_CHECK() instead of NDR_CHECK() in ejs code metze ------------------------------------------------------------------------ r25765 | metze | 2007-10-31 17:25:44 +0100 (Wed, 31 Oct 2007) | 3 lines pidl: fix compiler warning in ndr_align test metze ------------------------------------------------------------------------ r25766 | metze | 2007-10-31 17:27:21 +0100 (Wed, 31 Oct 2007) | 3 lines pidl: fix bugs in ndr_tagtype tests found by compiler warnings metze ------------------------------------------------------------------------ r25767 | metze | 2007-10-31 17:29:32 +0100 (Wed, 31 Oct 2007) | 5 lines pidl: make it easier to debug errors in pidl tests we now print the C program that we tried to compile metze ------------------------------------------------------------------------ r25768 | metze | 2007-10-31 17:44:42 +0100 (Wed, 31 Oct 2007) | 5 lines pidl: NT_STATUS_IS_ERR() is NOT the same as !NT_STATUS_IS_OK() Everything but success should be handled as error in the tests. metze ------------------------------------------------------------------------ r25795 | metze | 2007-11-02 11:35:09 +0100 (Fri, 02 Nov 2007) | 3 lines whitespace cleanup... metze ------------------------------------------------------------------------ r25804 | metze | 2007-11-02 14:02:25 +0100 (Fri, 02 Nov 2007) | 4 lines move including ndr_compression.h into HeaderInterface() metze ------------------------------------------------------------------------ r25805 | metze | 2007-11-02 14:05:43 +0100 (Fri, 02 Nov 2007) | 4 lines pidl: include libndr.h as first header in ndr_foo.h metze ------------------------------------------------------------------------ r25806 | metze | 2007-11-02 14:48:11 +0100 (Fri, 02 Nov 2007) | 5 lines let libndr.h include needed stuff and remove pidl magic for choosing common required headers metze ------------------------------------------------------------------------ ------------------------------------------------------------------------ ============================ Samba log end ============== svn path=/trunk/; revision=23378
2007-11-06 18:31:26 +00:00
return 1;
if (result != 0x02)
return 2;
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
");