diff options
author | Hadriel Kaplan <hadriel@128technology.com> | 2014-12-29 20:49:05 -0500 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2014-12-31 16:01:51 +0000 |
commit | f7b6dcc58ca52af222cd14404c56b741abe64738 (patch) | |
tree | 3bdb56d7abea70a3e1d14b45a5a79555ff8d448d /test/lua | |
parent | 11212887a1d6b0ed21ed50b4c9b233aed4ab40c3 (diff) |
Lua: allow a Dissector object to be passed in for register_heuristic
Bug: 10695
Change-Id: I81181b2d00fcb5f0c25ab89bbe4968897f47a3a6
Reviewed-on: https://code.wireshark.org/review/6131
Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'test/lua')
-rw-r--r-- | test/lua/dissector.lua | 12 | ||||
-rw-r--r-- | test/lua/verify_dissector.lua | 13 |
2 files changed, 24 insertions, 1 deletions
diff --git a/test/lua/dissector.lua b/test/lua/dissector.lua index 4685006aed..8d7b4a84e4 100644 --- a/test/lua/dissector.lua +++ b/test/lua/dissector.lua @@ -66,6 +66,7 @@ local default_settings = debug_level = DEBUG, port = 65333, heur_enabled = true, + heur_regmode = 1, } -- for testing purposes, we want to be able to pass in changes to the defaults @@ -584,7 +585,16 @@ local function heur_dissect_dns(tvbuf,pktinfo,root) end -- now register that heuristic dissector into the udp heuristic list -dns:register_heuristic("udp",heur_dissect_dns) +if default_settings.heur_regmode == 1 then + -- this is the "normal" way to register a heuristic: using a lua function + dns:register_heuristic("udp",heur_dissect_dns) +elseif default_settings.heur_regmode == 2 then + -- this is to test the fix for bug 10695: + dns:register_heuristic("udp",dns.dissector) +elseif default_settings.heur_regmode == 3 then + -- and this too is to test the fix for bug 10695: + dns:register_heuristic("udp", function (...) return dns.dissector(...); end ) +end -- We're done! -- our protocol (Proto) gets automatically registered after this script finishes loading diff --git a/test/lua/verify_dissector.lua b/test/lua/verify_dissector.lua index 46ec704e40..99003a0ee7 100644 --- a/test/lua/verify_dissector.lua +++ b/test/lua/verify_dissector.lua @@ -135,6 +135,19 @@ local lines = { -- dissector, then the first one by the heuristic, then the second one by -- a conversation match local numtests = 1 + #lines[1] + #lines[2] + #lines[3] + #lines[4] + +local hasHeuristic = true + +-- grab passed-in arguments +local args = { ... } +if #args > 0 then + for _, arg in ipairs(args) do + if arg == "no_heur" then + numtests = numtests - 1 + end + end +end + print("going to run "..numtests.." tests") -- for an example of what we're reading through to verify, look at end of this file |