summaryrefslogtreecommitdiff
path: root/test/suite-wslua.sh
diff options
context:
space:
mode:
authorHadriel Kaplan <hadrielk@yahoo.com>2014-04-12 00:32:20 -0400
committerAnders Broman <a.broman58@gmail.com>2014-04-14 11:47:39 +0000
commitdd002649c32a0f16720236b34fe5a7aefe04c457 (patch)
treed03bdc6f0f5ac36bb2d43a68f0cc8bcb72c27c3a /test/suite-wslua.sh
parent92b501303bdeb163cec55825da8b683138517e4d (diff)
downloadwireshark-dd002649c32a0f16720236b34fe5a7aefe04c457.tar.gz
Add tvb_get and proto_tree_add for string-encoded timestamps
This commit adds tvb_get_string_time and proto_tree_add_time_item routines for getting nstime fields from the tvb when they are encoded in ASCII string form. The proto_tree_add_time_item routine is also usable for normal big/little-endian encoded time_t, and has the advantage of retrieving the value even if there's no proto tree. It also exposes the routines to Lua, both so that a Lua script can take advantage of this, but also so I can write a testsuite to test the functions. Change-Id: I955da10f68f2680e3da3a5be5ad8fdce7ed6808c Reviewed-on: https://code.wireshark.org/review/1084 Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'test/suite-wslua.sh')
-rwxr-xr-xtest/suite-wslua.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/suite-wslua.sh b/test/suite-wslua.sh
index 5afdc9a516..fdeb5f0f2f 100755
--- a/test/suite-wslua.sh
+++ b/test/suite-wslua.sh
@@ -364,6 +364,22 @@ wslua_step_struct_test() {
fi
}
+wslua_step_tvb_test() {
+ if [ $HAVE_LUA -ne 0 ]; then
+ test_step_skipped
+ return
+ fi
+
+ # Tshark catches lua script failures, so we have to parse the output.
+ $TSHARK -r $CAPTURE_DIR/dns_port.pcap -X lua_script:$TESTS_DIR/lua/tvb.lua > testout.txt 2>&1
+ if grep -q "All tests passed!" testout.txt; then
+ test_step_ok
+ else
+ cat testout.txt
+ test_step_failed "didn't find pass marker"
+ fi
+}
+
wslua_cleanup_step() {
rm -f ./testout.txt
rm -f ./testin.txt
@@ -385,6 +401,7 @@ wslua_suite() {
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
+ test_step_add "wslua tvb" wslua_step_tvb_test
}
#
# Editor modelines - http://www.wireshark.org/tools/modelines.html