test: lua: add a test for invalid ethernet address
authorMartin Kaiser <wireshark@kaiser.cx>
Sun, 25 Nov 2018 18:00:33 +0000 (19:00 +0100)
committerAnders Broman <a.broman58@gmail.com>
Tue, 27 Nov 2018 04:35:19 +0000 (04:35 +0000)
Wslua converts an invalid ethernet address to all 0's. Add a test for
this case.

Change-Id: I59bd1f9e0b94805c563fe891b22cadd32ae054d8
Reviewed-on: https://code.wireshark.org/review/30791
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
test/lua/tvb.lua

index 36784ef652d6135873d3d12691b2785a98048f7c..9c9b61e56e8b4e5fd32c142e69c333462bf6a8e8 100644 (file)
@@ -54,7 +54,7 @@ end
 --     number of verifyFields() * (1 + number of fields) +
 --     number of verifyResults() * (1 + 2 * number of values)
 --
-local taptests = { [FRAME]=4, [OTHER]=333 }
+local taptests = { [FRAME]=4, [OTHER]=335 }
 
 local function getResults()
     print("\n-----------------------------\n")
@@ -582,12 +582,16 @@ function test_proto.dissector(tvbuf,pktinfo,root)
     testing(OTHER, "tree:add ether")
 
     local tvb = ByteArray.new("010203040506"):tvb("Ether")
+    local tvb0 = ByteArray.new("000000000000"):tvb("Ether0")
     local ether = testfield.basic.ETHER
     local ether_match_fields = {}
 
     execute ("ether", pcall (callTreeAdd, tree, ether, tvb:range(0,6)))
     addMatchFields(ether_match_fields, Address.ether('01:02:03:04:05:06'))
 
+    execute ("ether0", pcall (callTreeAdd, tree, ether, tvb0:range(0,6)))
+    addMatchFields(ether_match_fields, Address.ether('11:22:33'))
+
     verifyFields("basic.ETHER", ether_match_fields)
 
 ----------------------------------------