aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJörg Mayer <jmayer@loplof.de>2007-02-27 20:32:15 +0000
committerJörg Mayer <jmayer@loplof.de>2007-02-27 20:32:15 +0000
commita93329979119e4b97e70e7b28859c63482c4f9c8 (patch)
treeb019057c5a0517fda8654bc453432841aa354f21 /tools
parentbef1c99febbd283608312ba499ee5624aed44d11 (diff)
Update from samba tree revision 21535 to 21565
============================ Samba log start ============ ------------------------------------------------------------------------ r21545 | jelmer | 2007-02-26 18:43:01 +0100 (Mon, 26 Feb 2007) | 1 line Changed paths: M /branches/SAMBA_4_0 M /branches/SAMBA_4_0/source/pidl/tests/wireshark-ndr.pl Fix pidl test. ------------------------------------------------------------------------ r21555 | jelmer | 2007-02-27 13:46:19 +0100 (Tue, 27 Feb 2007) | 1 line Changed paths: M /branches/SAMBA_4_0 M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Wireshark/Conformance.pm M /branches/SAMBA_4_0/source/pidl/tests/wireshark-conf.pl Some tests for TYPE in wireshark conformance files. ------------------------------------------------------------------------ r21559 | jelmer | 2007-02-27 14:41:56 +0100 (Tue, 27 Feb 2007) | 1 line Changed paths: M /branches/SAMBA_4_0 M /branches/SAMBA_4_0/source/pidl/tests/wireshark-conf.pl More tests. ------------------------------------------------------------------------ ------------------------------------------------------------------------ ============================ Samba log end ============== svn path=/trunk/; revision=20945
Diffstat (limited to 'tools')
-rw-r--r--tools/pidl/lib/Parse/Pidl/Wireshark/Conformance.pm2
-rwxr-xr-xtools/pidl/tests/wireshark-conf.pl107
-rwxr-xr-xtools/pidl/tests/wireshark-ndr.pl8
3 files changed, 110 insertions, 7 deletions
diff --git a/tools/pidl/lib/Parse/Pidl/Wireshark/Conformance.pm b/tools/pidl/lib/Parse/Pidl/Wireshark/Conformance.pm
index 9798c7c552..44eb77f836 100644
--- a/tools/pidl/lib/Parse/Pidl/Wireshark/Conformance.pm
+++ b/tools/pidl/lib/Parse/Pidl/Wireshark/Conformance.pm
@@ -96,7 +96,7 @@ use vars qw($VERSION);
$VERSION = '0.01';
@ISA = qw(Exporter);
-@EXPORT_OK = qw(ReadConformance ReadConformanceFH);
+@EXPORT_OK = qw(ReadConformance ReadConformanceFH valid_ft_type valid_base_type);
use strict;
diff --git a/tools/pidl/tests/wireshark-conf.pl b/tools/pidl/tests/wireshark-conf.pl
index 8601a91ed9..617a63029a 100755
--- a/tools/pidl/tests/wireshark-conf.pl
+++ b/tools/pidl/tests/wireshark-conf.pl
@@ -5,12 +5,12 @@
use strict;
use warnings;
-use Test::More tests => 20;
+use Test::More tests => 45;
use FindBin qw($RealBin);
use lib "$RealBin";
use Util;
use Parse::Pidl::Util qw(MyDumper);
-use Parse::Pidl::Wireshark::Conformance qw(ReadConformanceFH);
+use Parse::Pidl::Wireshark::Conformance qw(ReadConformanceFH valid_ft_type valid_base_type);
sub parse_conf($)
{
@@ -60,3 +60,106 @@ is_deeply(parse_conf("CODE START\ndata\nCODE END\n"), { override => "data\n" });
is_deeply(parse_conf("CODE START\ndata\nmore data\nCODE END\n"), { override => "data\nmore data\n" });
test_warnings("nofile:1: Unknown command `CODE'\n",
sub { parse_conf("CODE END\n"); } );
+
+is_deeply(parse_conf("TYPE winreg_String dissect_myminregstring FT_STRING BASE_DEC 0 0 2\n"), { types => { winreg_String => {
+ NAME => "winreg_String",
+ POS => { FILE => "nofile", LINE => 1 },
+ USED => 0,
+ DISSECTOR_NAME => "dissect_myminregstring",
+ FT_TYPE => "FT_STRING",
+ BASE_TYPE => "BASE_DEC",
+ MASK => 0,
+ VALSSTRING => 0,
+ ALIGNMENT => 2}}});
+
+ok(valid_ft_type("FT_UINT32"));
+ok(not valid_ft_type("BLA"));
+ok(not valid_ft_type("ft_uint32"));
+ok(valid_ft_type("FT_BLA"));
+
+ok(valid_base_type("BASE_DEC"));
+ok(valid_base_type("BASE_HEX"));
+ok(not valid_base_type("base_dec"));
+ok(not valid_base_type("BLA"));
+ok(not valid_base_type("BASEDEC"));
+
+test_errors("nofile:1: incomplete TYPE command\n",
+ sub { parse_conf("TYPE mytype dissector\n"); });
+
+test_warnings("nofile:1: dissector name does not contain `dissect'\n",
+ sub { parse_conf("TYPE winreg_String myminregstring FT_STRING BASE_DEC 0 0 2\n"); });
+
+test_warnings("nofile:1: invalid FT_TYPE `BLA'\n",
+ sub { parse_conf("TYPE winreg_String dissect_myminregstring BLA BASE_DEC 0 0 2\n"); });
+
+test_warnings("nofile:1: invalid BASE_TYPE `BLOE'\n",
+ sub { parse_conf("TYPE winreg_String dissect_myminregstring FT_UINT32 BLOE 0 0 2\n"); });
+
+is_deeply(parse_conf("TFS hf_bla \"True string\" \"False String\"\n"),
+ { tfs => { hf_bla => {
+ TRUE_STRING => "\"True string\"",
+ FALSE_STRING => "\"False String\"" } } });
+
+test_errors("nofile:1: incomplete TFS command\n",
+ sub { parse_conf("TFS hf_bla \"Trues\""); } );
+
+test_errors("nofile:1: incomplete PARAM_VALUE command\n",
+ sub { parse_conf("PARAM_VALUE\n"); });
+
+is_deeply(parse_conf("PARAM_VALUE Life 42\n"),
+ { dissectorparams => {
+ Life => {
+ DISSECTOR => "Life",
+ POS => { FILE => "nofile", LINE => 1 },
+ PARAM => 42,
+ USED => 0
+ }
+ }
+ });
+
+is_deeply(parse_conf("STRIP_PREFIX bla_\n"),
+ { strip_prefixes => [ "bla_" ] });
+
+is_deeply(parse_conf("STRIP_PREFIX bla_\nSTRIP_PREFIX bloe\n"),
+ { strip_prefixes => [ "bla_", "bloe" ] });
+
+is_deeply(parse_conf("PROTOCOL atsvc \"Scheduling jobs on remote machines\" \"at\" \"atsvc\"\n"),
+ { protocols => {
+ atsvc => {
+ LONGNAME => "\"Scheduling jobs on remote machines\"",
+ SHORTNAME => "\"at\"",
+ FILTERNAME => "\"atsvc\""
+ }
+ }
+ }
+);
+
+is_deeply(parse_conf("IMPORT bla\n"), {
+ imports => {
+ bla => {
+ NAME => "bla",
+ DATA => "",
+ USED => 0,
+ POS => { FILE => "nofile", LINE => 1 }
+ }
+ }
+ }
+);
+
+is_deeply(parse_conf("IMPORT bla fn1 fn2 fn3\n"), {
+ imports => {
+ bla => {
+ NAME => "bla",
+ DATA => "fn1 fn2 fn3",
+ USED => 0,
+ POS => { FILE => "nofile", LINE => 1 }
+ }
+ }
+ }
+);
+
+test_errors("nofile:1: no dissectorname specified\n",
+ sub { parse_conf("IMPORT\n"); } );
+
+test_errors("nofile:1: incomplete HF_FIELD command\n",
+ sub { parse_conf("HF_FIELD hf_idx\n"); });
diff --git a/tools/pidl/tests/wireshark-ndr.pl b/tools/pidl/tests/wireshark-ndr.pl
index 02eabb8942..a216f59d97 100755
--- a/tools/pidl/tests/wireshark-ndr.pl
+++ b/tools/pidl/tests/wireshark-ndr.pl
@@ -5,7 +5,7 @@
use strict;
use warnings;
-use Test::More tests => 11;
+use Test::More tests => 13;
use FindBin qw($RealBin);
use lib "$RealBin";
use Util;
@@ -65,8 +65,8 @@ is_deeply($conformance, {
%hf_used = ( hf_bla => 1 );
test_warnings("", sub {
- CheckUsed({ header_fields => { INDEX => "hf_bla" }})});
+ CheckUsed({ header_fields => { foo => { INDEX => "hf_bla" }}})});
%hf_used = ( );
-test_warnings("nofile:0: hf field `hf_bla' not used\n", sub {
- CheckUsed({ header_fields => { INDEX => "hf_bla" }})});
+test_warnings("hf field `hf_bla' not used\n", sub {
+ CheckUsed({ header_fields => { foo => { INDEX => "hf_bla" }}})});