aboutsummaryrefslogtreecommitdiffstats
path: root/tools/pidl/tests/Util.pm
diff options
context:
space:
mode:
authorJörg Mayer <jmayer@loplof.de>2007-02-08 13:54:27 +0000
committerJörg Mayer <jmayer@loplof.de>2007-02-08 13:54:27 +0000
commit5862f39a81facdfe27b1025ef17e268573a90336 (patch)
tree4f4695906f7ef9bb060db3023a570926f2c49df5 /tools/pidl/tests/Util.pm
parent49808356a37160ddbcde65f91fc30dca0be666a5 (diff)
Update from samba tree revision 20292 to 21237
============================ Samba log start ============ ------------------------------------------------------------------------ r20298 | jelmer | 2006-12-21 02:51:35 +0100 (Thu, 21 Dec 2006) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/build/smb_build/makefile.pm M /branches/SAMBA_4_0/source/build/smb_build/output.pm M /branches/SAMBA_4_0/source/include/includes.h M /branches/SAMBA_4_0/source/pidl/tests/Util.pm Fix pidl tests (missing symlink..). ------------------------------------------------------------------------ r20299 | jelmer | 2006-12-21 03:48:46 +0100 (Thu, 21 Dec 2006) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/tests/Util.pm M /branches/SAMBA_4_0/source/pidl/tests/ndr_fullptr.pl M /branches/SAMBA_4_0/source/pidl/tests/ndr_string.pl Disable two new tests that are apparently broken. ------------------------------------------------------------------------ r20358 | metze | 2006-12-27 16:36:50 +0100 (Wed, 27 Dec 2006) | 6 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/EJS.pm M /branches/SAMBA_4_0/source/scripting/ejs/ejsrpc.c M /branches/SAMBA_4_0/source/scripting/ejs/ejsrpc.h - fix ejs generated code for ipv4address - (not Parse::Pidl::Typelist::scalar_is_reference($e->{TYPE})) is much more generic than ($e->{TYPE} ne "string") and handles ipv4address and other special types... metze ------------------------------------------------------------------------ r20511 | jelmer | 2007-01-03 16:34:01 +0100 (Wed, 03 Jan 2007) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Compat.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/NDR.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/TDR.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Wireshark/Conformance.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Wireshark/NDR.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl.pm Combine warnings/errors/fatal functions and move them to Parse::Pidl. ------------------------------------------------------------------------ r20543 | jelmer | 2007-01-05 13:56:15 +0100 (Fri, 05 Jan 2007) | 5 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Util.pm A /branches/SAMBA_4_0/source/pidl/tests/util.pl Merge some pidl bug fixes: * C expressions that just started with a constant were erroneously flagged as being a constant. * 1-length variable names in expressions were broken. ------------------------------------------------------------------------ r20545 | jelmer | 2007-01-05 15:25:21 +0100 (Fri, 05 Jan 2007) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Util.pm M /branches/SAMBA_4_0/source/pidl/tests/util.pl Fix is_constant(). ------------------------------------------------------------------------ r20547 | jelmer | 2007-01-05 15:55:26 +0100 (Fri, 05 Jan 2007) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl.pm M /branches/SAMBA_4_0/source/pidl/tests/Util.pm A /branches/SAMBA_4_0/source/pidl/tests/ndr_compat.pl A /branches/SAMBA_4_0/source/pidl/tests/test_util.pl Add tests for expected errors/warnings. ------------------------------------------------------------------------ r20548 | jelmer | 2007-01-05 16:03:21 +0100 (Fri, 05 Jan 2007) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl.pm 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_alloc.pl M /branches/SAMBA_4_0/source/pidl/tests/ndr_array.pl M /branches/SAMBA_4_0/source/pidl/tests/ndr_fullptr.pl M /branches/SAMBA_4_0/source/pidl/tests/ndr_refptr.pl M /branches/SAMBA_4_0/source/pidl/tests/ndr_represent.pl M /branches/SAMBA_4_0/source/pidl/tests/ndr_simple.pl M /branches/SAMBA_4_0/source/pidl/tests/ndr_string.pl M /branches/SAMBA_4_0/source/pidl/tests/ndr_tagtype.pl M /branches/SAMBA_4_0/source/pidl/tests/test_util.pl Remove unnecessary "use lib", fix warnings. ------------------------------------------------------------------------ r20550 | jelmer | 2007-01-05 16:20:23 +0100 (Fri, 05 Jan 2007) | 3 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/idl.yp M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/IDL.pm M /branches/SAMBA_4_0/source/pidl/tests/parse_idl.pl Use standard error mechanism in parser. Make sure errors are reported correctly. ------------------------------------------------------------------------ r20556 | jelmer | 2007-01-05 18:18:22 +0100 (Fri, 05 Jan 2007) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/tests/util.pl Add more tests to make sure nothing breaks when I replace the ParseExpr code. ------------------------------------------------------------------------ r20561 | jelmer | 2007-01-05 21:12:21 +0100 (Fri, 05 Jan 2007) | 2 lines Changed paths: A /branches/SAMBA_4_0/source/pidl/expr.yp A /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Expr.pm Add parser for subexpressions used in IDL attributes. ------------------------------------------------------------------------ r20562 | jelmer | 2007-01-05 21:13:48 +0100 (Fri, 05 Jan 2007) | 3 lines Changed paths: M /branches/SAMBA_4_0/source/main.mk M /branches/SAMBA_4_0/source/pidl/Makefile.PL A /branches/SAMBA_4_0/source/pidl/lib/Parse/Yapp A /branches/SAMBA_4_0/source/pidl/lib/Parse/Yapp/Driver.pm Start building expr parser. Add separate copy of Yapp::Driver rather than including it in each individual parser. ------------------------------------------------------------------------ r20563 | jelmer | 2007-01-05 21:18:33 +0100 (Fri, 05 Jan 2007) | 5 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/IDL.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Util.pm M /branches/SAMBA_4_0/source/pidl/tests/util.pl Start using the new parser in ParseExpr(). It's now trivial to use this to check for NULL pointers when pointers are being dereferenced (#4218). There are exactly 500 tests for pidl now :-) ------------------------------------------------------------------------ r20564 | jelmer | 2007-01-05 21:23:48 +0100 (Fri, 05 Jan 2007) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Expr.pm Regenerate. ------------------------------------------------------------------------ r20567 | jelmer | 2007-01-05 21:52:12 +0100 (Fri, 05 Jan 2007) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/expr.yp M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Expr.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/EJS.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/TDR.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Util.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Wireshark/NDR.pm M /branches/SAMBA_4_0/source/pidl/tests/util.pl Print proper errors with filename and line numbers in ParseExpr() ------------------------------------------------------------------------ r20571 | jelmer | 2007-01-05 22:26:28 +0100 (Fri, 05 Jan 2007) | 1 line Changed paths: M /branches/SAMBA_4_0/source/pidl/tests/util.pl fix '' case ------------------------------------------------------------------------ r20573 | metze | 2007-01-05 22:36:57 +0100 (Fri, 05 Jan 2007) | 3 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/EJS.pm fix handling of pointers handling to elements with the charset property metze ------------------------------------------------------------------------ r20625 | jelmer | 2007-01-09 07:02:41 +0100 (Tue, 09 Jan 2007) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/expr.yp M /branches/SAMBA_4_0/source/pidl/idl.yp M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Expr.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/IDL.pm M /branches/SAMBA_4_0/source/pidl/tests/Util.pm M /branches/SAMBA_4_0/source/pidl/tests/util.pl Fix couple of warnings. ------------------------------------------------------------------------ r20631 | jelmer | 2007-01-09 16:50:36 +0100 (Tue, 09 Jan 2007) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/NDR.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Util.pm A /branches/SAMBA_4_0/source/pidl/tests/ndr.pl Add some tests for the ndr parser. ------------------------------------------------------------------------ r20633 | jelmer | 2007-01-09 16:54:36 +0100 (Tue, 09 Jan 2007) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/tests/ndr.pl Add another test, fix warnings. ------------------------------------------------------------------------ r20637 | jelmer | 2007-01-10 00:41:25 +0100 (Wed, 10 Jan 2007) | 3 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Util.pm A /branches/SAMBA_4_0/source/pidl/tests/samba-ndr.pl Don't check for NULL pointers when the pointer is guaranteed to not be NULL (if it is a ref pointer). ------------------------------------------------------------------------ r20638 | jelmer | 2007-01-10 01:37:30 +0100 (Wed, 10 Jan 2007) | 3 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm M /branches/SAMBA_4_0/source/pidl/tests/samba-ndr.pl Check for NULL pointers (where possible) in print functions. Fixes #4218, but without reintroducing coverity warnings. ------------------------------------------------------------------------ r20675 | jelmer | 2007-01-11 03:10:01 +0100 (Thu, 11 Jan 2007) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/MANIFEST M /branches/SAMBA_4_0/source/pidl/Makefile.PL Fix installation. ------------------------------------------------------------------------ r20688 | jelmer | 2007-01-11 23:47:29 +0100 (Thu, 11 Jan 2007) | 1 line Changed paths: M /branches/SAMBA_4_0/source/pidl/pidl Use argv[0] equivalent of perl. ------------------------------------------------------------------------ r20746 | jelmer | 2007-01-14 02:33:16 +0100 (Sun, 14 Jan 2007) | 3 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Expr.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/IDL.pm D /branches/SAMBA_4_0/source/script/tests/test_smbclient.sh M /branches/SAMBA_4_0/source/script/tests/tests_all.sh A /branches/SAMBA_4_0/testprogs/blackbox A /branches/SAMBA_4_0/testprogs/blackbox/test_smbclient.sh (from /branches/SAMBA_4_0/source/script/tests/test_smbclient.sh:20745) Don't report each individual test in test_smbclient as a single testsuite. Create separate directory for blackbox tests. ------------------------------------------------------------------------ r20830 | jelmer | 2007-01-16 15:44:23 +0100 (Tue, 16 Jan 2007) | 1 line Changed paths: M /branches/SAMBA_4_0 M /branches/SAMBA_4_0/source/librpc/idl/mgmt.idl M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm M /branches/SAMBA_4_0/source/rpc_server/config.mk M /branches/SAMBA_4_0/source/rpc_server/dcerpc_server.c A /branches/SAMBA_4_0/source/rpc_server/dcesrv_mgmt.c (from /branches/SAMBA_4_0/source/rpc_server/mgmt/dcesrv_mgmt.c:20829) D /branches/SAMBA_4_0/source/rpc_server/mgmt M /branches/SAMBA_4_0/source/script/tests/test_rpc.sh M /branches/SAMBA_4_0/source/torture/rpc/mgmt.c merge mgmt work ------------------------------------------------------------------------ r20834 | jelmer | 2007-01-16 16:51:37 +0100 (Tue, 16 Jan 2007) | 1 line Changed paths: M /branches/SAMBA_4_0 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 No longer generate extra pointers for top-level [out] unique pointers. ------------------------------------------------------------------------ r20836 | jelmer | 2007-01-16 18:45:33 +0100 (Tue, 16 Jan 2007) | 1 line Changed paths: M /branches/SAMBA_4_0 M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm Use real type name, to fix compilation with -WC++-compat ------------------------------------------------------------------------ r20850 | jelmer | 2007-01-17 15:49:36 +0100 (Wed, 17 Jan 2007) | 1 line Changed paths: M /branches/SAMBA_4_0 M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/Template.pm M /branches/SAMBA_4_0/source/rpc_server/dcesrv_mgmt.c M /branches/SAMBA_4_0/source/rpc_server/drsuapi/dcesrv_drsuapi.c M /branches/SAMBA_4_0/source/rpc_server/echo/rpc_echo.c M /branches/SAMBA_4_0/source/rpc_server/epmapper/rpc_epmapper.c M /branches/SAMBA_4_0/source/rpc_server/lsa/dcesrv_lsa.c M /branches/SAMBA_4_0/source/rpc_server/netlogon/dcerpc_netlogon.c M /branches/SAMBA_4_0/source/rpc_server/samr/dcesrv_samr.c M /branches/SAMBA_4_0/source/rpc_server/samr/samr_password.c M /branches/SAMBA_4_0/source/rpc_server/spoolss/dcesrv_spoolss.c M /branches/SAMBA_4_0/source/rpc_server/srvsvc/dcesrv_srvsvc.c M /branches/SAMBA_4_0/source/rpc_server/unixinfo/dcesrv_unixinfo.c M /branches/SAMBA_4_0/source/rpc_server/winreg/rpc_winreg.c M /branches/SAMBA_4_0/source/rpc_server/wkssvc/dcesrv_wkssvc.c Prefix all server calls with dcesrv_ ------------------------------------------------------------------------ r20942 | jelmer | 2007-01-22 01:04:59 +0100 (Mon, 22 Jan 2007) | 1 line Changed paths: M /branches/SAMBA_4_0 M /branches/SAMBA_4_0/source/build/m4/check_cc.m4 M /branches/SAMBA_4_0/source/build/m4/check_perl.m4 M /branches/SAMBA_4_0/source/build/smb_build/makefile.pm M /branches/SAMBA_4_0/source/main.mk M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/Header.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Util.pm M /branches/SAMBA_4_0/source/pidl/pidl Simplify handling of systems that don't support negative enum values by using an ifdef rather than a pidl argument. ------------------------------------------------------------------------ r20967 | jelmer | 2007-01-23 11:08:08 +0100 (Tue, 23 Jan 2007) | 1 line Changed paths: M /branches/SAMBA_4_0 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_refptr.pl M /branches/SAMBA_4_0/source/pidl/tests/ndr_tagtype.pl M /branches/SAMBA_4_0/source/script/tests/tests_all.sh M /branches/SAMBA_4_0/source/torture/config.mk Allow pidl tests to work with gcov ------------------------------------------------------------------------ r21075 | jelmer | 2007-01-31 12:54:01 +0100 (Wed, 31 Jan 2007) | 1 line Changed paths: M /branches/SAMBA_4_0 M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm Generate parameters in structs for the server side Samba 3 code. The current code in Samba 3 is already generated using this pidl patch. ------------------------------------------------------------------------ r21222 | jelmer | 2007-02-07 20:03:19 +0100 (Wed, 07 Feb 2007) | 8 lines Changed paths: M /branches/SAMBA_4_0 M /branches/SAMBA_4_0/source/pidl/TODO M /branches/SAMBA_4_0/source/pidl/expr.yp M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Expr.pm 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 M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Util.pm M /branches/SAMBA_4_0/source/pidl/pidl D /branches/SAMBA_4_0/source/pidl/ref_notes.txt A /branches/SAMBA_4_0/source/pidl/tests/ndr_deprecations.pl M /branches/SAMBA_4_0/source/pidl/tests/ndr_represent.pl M /branches/SAMBA_4_0/source/pidl/tests/util.pl M /branches/SAMBA_4_0/source/torture/smbtorture.c M /branches/SAMBA_4_0/source/torture/torture.c Merge a couple of pidl fixes: * Pidl will now warn when trying to use pointers as integers in expressions. * "subcontext()" is now marked as deprecated. The alternatives, transmit_as() / represent_as() should be available soon. * More tests. * Remove some unused code in smbtorture. ------------------------------------------------------------------------ ------------------------------------------------------------------------ ============================ Samba log end ============== svn path=/trunk/; revision=20744
Diffstat (limited to 'tools/pidl/tests/Util.pm')
-rw-r--r--tools/pidl/tests/Util.pm74
1 files changed, 69 insertions, 5 deletions
diff --git a/tools/pidl/tests/Util.pm b/tools/pidl/tests/Util.pm
index 83651e6073..a406b868e1 100644
--- a/tools/pidl/tests/Util.pm
+++ b/tools/pidl/tests/Util.pm
@@ -6,10 +6,36 @@ package Util;
require Exporter;
@ISA = qw(Exporter);
-@EXPORT_OK = qw(test_samba4_ndr);
+@EXPORT = qw(test_samba4_ndr test_warnings test_errors);
use strict;
+use FindBin qw($RealBin);
+use lib "$RealBin/../lib";
+
+use Parse::Pidl;
+my $warnings = "";
+undef &Parse::Pidl::warning;
+*Parse::Pidl::warning = sub {
+ my ($e, $l) = @_;
+ if (defined($e)) {
+ $warnings .= "$e->{FILE}:$e->{LINE}: $l\n";
+ } else {
+ $warnings .= "$l\n";
+ }
+};
+
+my $errors = "";
+undef &Parse::Pidl::error;
+*Parse::Pidl::error = sub {
+ my ($e, $l) = @_;
+ if (defined($e)) {
+ $errors .= "$e->{FILE}:$e->{LINE}: $l\n";
+ } else {
+ $errors .= "$l\n";
+ }
+};
+
use Test::More;
use Parse::Pidl::IDL;
use Parse::Pidl::NDR;
@@ -43,12 +69,30 @@ SKIP: {
if (defined($test_data_prefix)) {
$outfile = "$test_data_prefix/test-$name";
} else {
- $outfile = "test-$name";
+ $outfile = "./test-$name";
+ }
+
+ my $cflags = $ENV{CFLAGS};
+ unless (defined($cflags)) {
+ $cflags = "";
+ }
+
+ my $ldflags = $ENV{LDFLAGS};
+ unless (defined($ldflags)) {
+ $ldflags = "";
+ }
+
+ my $cc = $ENV{CC};
+ unless (defined($cc)) {
+ $cc = "cc";
}
- my $cflags = `pkg-config --libs --cflags ndr`;
+ my $flags = `pkg-config --libs --cflags ndr samba-config`;
- open CC, "|cc -x c - -o $outfile $cflags";
+ my $cmd = "$cc $cflags -x c - -o $outfile $flags $ldflags";
+ $cmd =~ s/\n//g;
+ print "$cmd\n";
+ open CC, "|$cmd";
print CC "#define uint_t unsigned int\n";
print CC "#define _GNU_SOURCE\n";
print CC "#include <stdint.h>\n";
@@ -74,7 +118,7 @@ SKIP: {
ok(-f $outfile, "($name) compile");
- my $ret = system("./$outfile", ()) >> 8;
+ my $ret = system($outfile, ()) >> 8;
print "# return code: $ret\n" if ($ret != 0);
ok($ret == 0, "($name) run");
@@ -84,4 +128,24 @@ SKIP: {
}
}
+sub test_warnings($$)
+{
+ my ($exp, $code) = @_;
+
+ $warnings = "";
+
+ $code->();
+
+ is($warnings, $exp);
+}
+
+sub test_errors($$)
+{
+ my ($exp, $code) = @_;
+ $errors = "";
+ $code->();
+
+ is($errors, $exp);
+}
+
1;