Rev 11590: Add some more tests for wireshark. in
file:///home/jelmer/bzr.samba/SAMBA_4_0/
Jelmer Vernooij
jelmer at samba.org
Sun Feb 25 15:37:25 GMT 2007
At file:///home/jelmer/bzr.samba/SAMBA_4_0/
------------------------------------------------------------
revno: 11590
revision-id: jelmer at samba.org-20070225153715-wp1yaibe8ubn6m8a
parent: svn-v2:21532 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: SAMBA_4_0
timestamp: Sun 2007-02-25 16:37:15 +0100
message:
Add some more tests for wireshark.
modified:
source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm svn-v2:12463 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2fpidl%2flib%2fParse%2fPidl%2fSamba4%2fNDR%2fParser.pm
source/pidl/lib/Parse/Pidl/Wireshark/NDR.pm svn-v2:16824 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2fpidl%2flib%2fParse%2fPidl%2fWireshark%2fNDR.pm
source/pidl/tests/wireshark-ndr.pl svn-v2:21411 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2fpidl%2ftests%2fwireshark%2dndr.pl
=== modified file 'source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm'
--- a/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm 2007-02-21 11:32:48 +0000
+++ b/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm 2007-02-25 15:37:15 +0000
@@ -2479,7 +2479,6 @@
pidl "ndr_pull_restore_relative_base_offset(ndr, _save_relative_base_offset);" if defined(has_property($e, "relative_base"));
}
-
sub ParseTypePullFunction($$)
{
my ($e, $varname) = @_;
=== modified file 'source/pidl/lib/Parse/Pidl/Wireshark/NDR.pm'
--- a/source/pidl/lib/Parse/Pidl/Wireshark/NDR.pm 2007-02-25 09:55:57 +0000
+++ b/source/pidl/lib/Parse/Pidl/Wireshark/NDR.pm 2007-02-25 15:37:15 +0000
@@ -18,7 +18,7 @@
use Exporter;
@ISA = qw(Exporter);
- at EXPORT_OK = qw(field2name @ett %res PrintIdl StripPrefixes);
+ at EXPORT_OK = qw(field2name @ett %res PrintIdl StripPrefixes %hf_used RegisterInterfaceHandoff $conformance register_hf_field CheckUsed);
use strict;
use Parse::Pidl qw(error warning);
@@ -34,11 +34,11 @@
our @ett;
-my %hf_used = ();
+our %hf_used = ();
my %return_types = ();
my %dissector_used = ();
-my $conformance = undef;
+our $conformance = undef;
my %ptrtype_mappings = (
"unique" => "NDR_POINTER_UNIQUE",
=== modified file 'source/pidl/tests/wireshark-ndr.pl'
--- a/source/pidl/tests/wireshark-ndr.pl 2007-02-25 09:55:57 +0000
+++ b/source/pidl/tests/wireshark-ndr.pl 2007-02-25 15:37:15 +0000
@@ -5,12 +5,12 @@
use strict;
use warnings;
-use Test::More tests => 6;
+use Test::More tests => 11;
use FindBin qw($RealBin);
use lib "$RealBin";
use Util;
use Parse::Pidl::Util qw(MyDumper);
-use Parse::Pidl::Wireshark::NDR qw(field2name %res PrintIdl StripPrefixes);
+use Parse::Pidl::Wireshark::NDR qw(field2name %res PrintIdl StripPrefixes %hf_used RegisterInterfaceHandoff $conformance register_hf_field CheckUsed);
is("Access Mask", field2name("access_mask"));
is("Accessmask", field2name("AccessMask"));
@@ -25,3 +25,48 @@
is("bla_foo", StripPrefixes("bla_foo", []));
is("foo", StripPrefixes("bla_foo", ["bla"]));
is("foo_bla", StripPrefixes("foo_bla", ["bla"]));
+
+%hf_used = ();
+$res{code} = "";
+RegisterInterfaceHandoff({});
+is($res{code}, "");
+ok(not defined($hf_used{hf_bla_opnum}));
+
+%hf_used = ();
+$res{code} = "";
+RegisterInterfaceHandoff({UUID => "uuid", NAME => "bla"});
+is($res{code}, 'void proto_reg_handoff_dcerpc_bla(void)
+{
+ dcerpc_init_uuid(proto_dcerpc_bla, ett_dcerpc_bla,
+ &uuid_dcerpc_bla, ver_dcerpc_bla,
+ bla_dissectors, hf_bla_opnum);
+}
+');
+is($hf_used{hf_bla_opnum}, 1);
+
+$conformance = {};
+register_hf_field("hf_bla_idx", "bla", "my.filter", "FT_UINT32", "BASE_HEX", "NULL", 0xF, undef);
+is_deeply($conformance, {
+ header_fields => {
+ "hf_bla_idx" => {
+ INDEX => "hf_bla_idx",
+ NAME => "bla",
+ FILTER => "my.filter",
+ BASE_TYPE => "BASE_HEX",
+ FT_TYPE => "FT_UINT32",
+ VALSSTRING => "NULL",
+ BLURB => undef,
+ MASK => 0xF
+ }
+ },
+ hf_renames => {},
+ fielddescription => {}
+});
+
+%hf_used = ( hf_bla => 1 );
+test_warnings("", sub {
+ CheckUsed({ header_fields => { INDEX => "hf_bla" }})});
+
+%hf_used = ( );
+test_warnings("nofile:0: hf field `hf_bla' not used\n", sub {
+ CheckUsed({ header_fields => { INDEX => "hf_bla" }})});
More information about the samba-cvs
mailing list