aboutsummaryrefslogtreecommitdiffstats
path: root/test/suite-wslua.sh
diff options
context:
space:
mode:
authorHadriel Kaplan <hadrielk@yahoo.com>2014-02-20 21:12:25 -0500
committerEvan Huus <eapache@gmail.com>2014-02-21 20:57:43 +0000
commit7f074364b62b0e7a6a8660e48c9803ebcaa1c8fc (patch)
tree99f2f7375ef0583fa3cf77084df4284e2a32e230 /test/suite-wslua.sh
parent1b210e967c9c68072486352d55c23e092083bcc2 (diff)
Fix bug 9790: Lua: wslua allows duplicate field registration
As discussed in bug 3513 and 9709, one can register more than one new ProtoFields for the same field name. Of course C-code can do that too, and does a LOT apparently, but if they're not similar ftypes then things can get scrweed up in display filters. So this change prevents duplicate field registration of dissimilar ftypes. The similarity is based on the discussion on the mailing list, and the listing in README.developer has been updated to refelect that as well. Also, this change adds a testscript for Proto/ProtoFields. Change-Id: I43bd323f785245941a21289647332a19adec2a9d Reviewed-on: https://code.wireshark.org/review/285 Reviewed-by: Evan Huus <eapache@gmail.com>
Diffstat (limited to 'test/suite-wslua.sh')
-rwxr-xr-xtest/suite-wslua.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/suite-wslua.sh b/test/suite-wslua.sh
index a6f274cba0..20b97f96ab 100755
--- a/test/suite-wslua.sh
+++ b/test/suite-wslua.sh
@@ -114,6 +114,33 @@ wslua_step_pinfo_test() {
fi
}
+
+wslua_step_proto_test() {
+ if [ $HAVE_LUA -ne 0 ]; then
+ test_step_skipped
+ return
+ fi
+
+ # First run tshark with the dissector script.
+ $TSHARK -r $CAPTURE_DIR/dns_port.pcap -V -X lua_script:$TESTS_DIR/lua/proto.lua > testin.txt 2>&1
+ grep -q "All tests passed!" testin.txt
+ if [ $? -ne 0 ]; then
+ cat ./testin.txt
+ test_step_failed "didn't find pass marker"
+ fi
+
+ # then run tshark again with the verification script. (it internally reads in testin.txt)
+ $TSHARK -r $CAPTURE_DIR/dns_port.pcap -X lua_script:$TESTS_DIR/lua/verify_dissector.lua > testout.txt 2>&1
+ if grep -q "All tests passed!" testout.txt; then
+ test_step_ok
+ else
+ echo
+ cat ./testin.txt
+ cat ./testout.txt
+ test_step_failed "didn't find pass marker"
+ fi
+}
+
wslua_step_int64_test() {
if [ $HAVE_LUA -ne 0 ]; then
test_step_skipped
@@ -222,6 +249,7 @@ wslua_suite() {
test_step_add "wslua listener" wslua_step_listener_test
test_step_add "wslua nstime" wslua_step_nstime_test
test_step_add "wslua pinfo" wslua_step_pinfo_test
+ test_step_add "wslua proto/protofield" wslua_step_proto_test
test_step_add "wslua script arguments" wslua_step_args_test
test_step_add "wslua struct" wslua_step_struct_test
}