summaryrefslogtreecommitdiff
path: root/test/suite-wslua.sh
AgeCommit message (Collapse)AuthorFilesLines
2017-05-05New Lua function TreeItem:referenced(ProtoField | Dissector).Rado Radoulov1-8/+19
This function returns TRUE/FALSE depending whether the specified ProtoField/Dissector needs to be dissected. By using this function in conjunction with the TreeItem.visible attribute, Lua dissectors can be significantly sped up by making less C interop calls which are relatively slow in terms of dissection especially when using sub-protocols where the dissection of an entire protocol can be skipped. Added tests for TreeItem:referenced to protofield.lua Change-Id: I44feacb91a2a5b0e3c28c0ccd8d6b04cccd67261 Reviewed-on: https://code.wireshark.org/review/21387 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-03-16Lua: Run protofield test with treeStig Bjørlykke1-8/+0
Only perform the protofield with a tree. Change-Id: I93caeb505d1138a57c846ea6c295e5a44d72023c Reviewed-on: https://code.wireshark.org/review/20564 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Tested-by: Peter Wu <peter@lekensteyn.nl>
2017-03-14Lua: Add some ProtoField tests.Stig Bjørlykke1-0/+25
Test usage of base.UNIT_STRING. Change-Id: I9c97b58b3cc6db65713e83609900880e157237f2 Reviewed-on: https://code.wireshark.org/review/19357 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2016-10-10Disable wslua GRegex unit testJoão Valverde1-1/+2
It's broken for recent GLib versions and there is no time frame for a fix. Ping-Bug: 12997 Change-Id: Ia687af9b0df8fc37121179ba20761c878bf57057 Reviewed-on: https://code.wireshark.org/review/18140 Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-02-03Suite test: fix modelines for bash script (emac)Alexis La Goutte1-1/+1
c-basic-offset -> sh-basic-offset Change-Id: I16b19b608fbdb7f0408f7c31871fae746c8c4f50 Reviewed-on: https://code.wireshark.org/review/13683 Reviewed-by: cedric izoard <cedric.izoard@ceva-dsp.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-11-26Change Lua tests to reflect the disappearance of ↵Guy Harris1-13/+1
WTAP_ENCAP_IEEE_802_11_AIROPEEK. The old global tests don't work; get rid of them. Fix the values of the Lua globals in the new test, and get rid of IEEE_802_11_AIROPEEK. (Yes, if you have a Lua script that depends on IEEE_802_11_AIROPEEK being defined, or that depends on the values of the Wiretap encapsulations not changing, it breaks. Fix it.) Change-Id: I245c1c0c3ba1c450f7950c754624c51b5564848a Reviewed-on: https://code.wireshark.org/review/12210 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-08-19Mergecap: add test suite for various merging scenariosHadriel Kaplan1-1/+1
Add a test suite for mergecap (and indirectly capinfos I guess). This is not exhaustive, but it's a start. Change-Id: I9442b4c32e31a74b1673961ad6ab50821441de3e Reviewed-on: https://code.wireshark.org/review/10082 Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-07-24Lua: add the 1.12.x Lua API to the globals verification test suiteHadriel Kaplan1-0/+6
Change-Id: I698fc75dc915ea007b2f7762f0041dbb6dd1d8d3 Reviewed-on: https://code.wireshark.org/review/9764 Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
2015-03-12Fix the Lua FPM dissector test.Gerald Combs1-4/+15
In the FPM dissector test, only check the fields produced by the frame and FPM dissectors. Change-Id: I212afb8a8a4a7a9aa54391b0d5971b982b819395 Reviewed-on: https://code.wireshark.org/review/7643 Reviewed-by: Graham Bloice <graham.bloice@trihedral.com> Tested-by: Graham Bloice <graham.bloice@trihedral.com>
2015-01-27Lua: Expose tcp_dissect_pdus() to LuaHadriel Kaplan1-5/+35
Provide a way for Lua-based dissectors to invoke tcp_dissect_pdus() to make TCP-based dissection easier. Bug: 9851 Change-Id: I91630ebf1f1fc1964118b6750cc34238e18a8ad3 Reviewed-on: https://code.wireshark.org/review/6778 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Tested-by: Hadriel Kaplan <hadrielk@yahoo.com>
2015-01-23Fix test script to test Lua Pinfo, and fix problem it found.Guy Harris1-1/+1
The test script was running lua/nstime.lua rather than lua/pinfo.lua for the Pinfo test, and the Pinfo test was testing the ipproto property for a Pinfo, but that was removed. Change-Id: Iccdccd265dd550e41640af3acd607362f1f2f02e Reviewed-on: https://code.wireshark.org/review/6747 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-31Lua: allow a Dissector object to be passed in for register_heuristicHadriel Kaplan1-1/+39
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>
2014-04-17Add tvb_get and proto_tree_add for string-encoded byte arraysHadriel Kaplan1-0/+8
This commit adds tvb_get_string_bytes and proto_tree_add_bytes_item routines for getting GByteArrays fields from the tvb when they are encoded in ASCII hex string form. The proto_tree_add_bytes_item routine is also usable for normal binary encoded byte arrays, and has the advantage of retrieving the array values 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: I112a038653df6482a5d0ebe7c95708f207319e20 Reviewed-on: https://code.wireshark.org/review/1158 Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-14Add tvb_get and proto_tree_add for string-encoded timestampsHadriel Kaplan1-0/+17
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>
2014-04-07Switch to Lua 5.2.3 built with MSVC2010 instead of the one built with MingW ↵Pascal Quantin1-7/+7
gcc 4.3 Fixes bug 9957 Change-Id: Ibe38ec25be5cfdad98c53c8257b0a858529897f6 Reviewed-on: https://code.wireshark.org/review/991 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-04-06Get it compiling again: WindowsXP build failingHadriel Kaplan1-7/+7
The WindowsXP build is failing due to a wslua testsuite failure, in the file reader/writer tests. I've looked at it a bit and I don't know why it's failing yet - I know why it says it's failing, but it doesn't fail for me. And it was passing on WindowsXP until the change to Lua 5.2.3, but I run 5.2.3 all the time and it passes for me, and there's nothing special about the portion that's failing. The only way to debug it is to run it on WindowsXP myself, but I need a build to do that with, so I've commented out the failing test and hopefull it will build now and I can grab the automated build to debug the issue. Change-Id: Ib75e8f75829e8f506823e648605ba16e21c7973a Reviewed-on: https://code.wireshark.org/review/982 Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-03-31Continue to remove $Id$ from top of fileAlexis La Goutte1-2/+0
(Using sed : sed -i '/^\# \$Id\$/,+1 d') (start with dash) Change-Id: Ia4b5a6c2302f6a531f6a86c1ec3a2f8205c8c2dd Reviewed-on: https://code.wireshark.org/review/881 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-26Add various functions for Lua directory handling and path infoHadriel Kaplan1-0/+17
This adds new functions to get plugins path info, find out if a directory exists, make a new one, remove one, etc. It also creates a file environment for user-supplied Lua scripts, to prevent global variable contamination as well as supply the script-specific file name. Some other minor cleanup was done as I found them. A new testsuite was added to test the existing and new directory functions. Change-Id: I19bd587b5e8a73d89b8521af73670e023314fb33 Reviewed-on: https://code.wireshark.org/review/832 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-22Add way for Lua file reader to save state per file read/write opsHadriel Kaplan1-0/+2
Lua can create a file reader/writer, to open new capture file formats or write to new ones. To save local state, it can save things in Lua itself; but since there can be multiple open files at the same time (for example during a reload), the Lua script won't know for which file and state its read/write functions are being invoked for. To remedy this, and also provide a convenient way to store such state, this commit adds the ability for a Lua script to store a Lua table in the wtap/wtap_dumper's priv data member, just like C-code-based reader/writers do. Change-Id: Ifc9e0d5f0379accee56f2a04b6080238670fec52 Reviewed-on: https://code.wireshark.org/review/766 Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-19Fix lua file testsuite not working and weak heuristic readers not being ↵Hadriel Kaplan1-9/+10
registered The testsuite for Lua file reader/writer uses the acme_file.lua script to generate a pcapng file from an Acme sipmsg.log file. It then compares the tshark verbose output of this new pcapng file to a sip.pcapng file in the test/captures directory that was previously made. Unfortunately, the acme_file.lua script generates a timestamp based on local system timezone, rather than UTC, so the testsuite fails if not run in the EST timezone where the sip.pcapng file was originally made. This has now been fixed. Also, trying to register new weak heuristic readers fails because the GArray is terminated with a NULL-based row without Glib knowing about that. So this commit changes it to let Glib handle the NULL-terminated row, so that appending takes it into account automatically. Change-Id: I037ce1cfbda03585b3a1e159df78ff8ebb41fc32 Reviewed-on: https://code.wireshark.org/review/741 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-03-19Add capture file reader/writer support for Lua so scripts can implement new ↵Michael Mann1-0/+98
capture file formats. This enables a Lua script to implement a brand new capture file format reader/writer, so that for example one could write a script to read from vendor-specific "logs" of packets, and show them as normal packets in wireshark. Change-Id: Id394edfffa94529f39789844c382b7ab6cc2d814 Reviewed-on: https://code.wireshark.org/review/431 Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Reviewed-by: Michael Mann <mmann78@netscape.net> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-14Add Lua heuristic dissector supportHadriel Kaplan1-10/+10
This adds the ability for Lua scripts to register heuristic dissectors for any protocol that has registered a heuristic dissector list, such as UDP, TCP, and ~50 others. The Lua function can also establish a conversation tied to its Proto dissector, to avoid having to check the heuristics for the same flow. The example dissector in the testsuite has also been enhanced to include a heuristic dissector, to verify the functionality and provide an example implementation. Change-Id: Ie232602779f43d3418fe8db09c61d5fc0b59597a Reviewed-on: https://code.wireshark.org/review/576 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-10Add GLib's regex library into LuaHadriel Kaplan1-2/+19
While Lua's built-in pattern support is ok for simple things, many people end up wanting a real regex engine. Since Wireshark already includes the GLib Regex library (a wrapper for PCRE), it makes sense to expose that library to Lua scripts. This has been done using Lrexlib, one of the most popular regex bindings for Lua. Lrexlib didn't support binding GLib's Regex in particular - it does for PCRE but GLib is a different API - so I've done that. A fairly thorough testsuite came along with that, which has been incorporated into the wireshark wslua testuites as well in this commit. Change-Id: I05811d1edf7af8d7c9f4f081de6850f31c0717c7 Reviewed-on: https://code.wireshark.org/review/332 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-02-21Fix bug 9790: Lua: wslua allows duplicate field registrationHadriel Kaplan1-0/+28
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>
2014-02-21Add test suite for verifying Lua global variables/tables of previous ↵Hadriel Kaplan1-0/+23
releases have not disappeared. Several bugs have been introduced due to changing of perl scripts or #define names, such that things exported into Lua have dissapeared or changed unintentionally. This commit adds a test suite which compares the Lua global table with the ones from previous releases (1.8 and 1.10), to verify nothing has gone missing. New items can be added, but old ones cannot go away. The added script to verify these things, called 'verify_globals.lua', also has the ability to display what's new - i.e., what was not in the olrder releases. Lastly, this commit also fixes a bug: MENU_STAT_ENDPOINT became MENU_STAT_ENDPOINT_LIST due to a change in the make-init-lua.pl perl script in this 1.11 release. Change-Id: Iba143d1a436e706970635a5f8cc2b317955392bf Reviewed-on: https://code.wireshark.org/review/284 Reviewed-by: Evan Huus <eapache@gmail.com> Tested-by: Evan Huus <eapache@gmail.com>
2014-02-21Revert "Add test suite for verifying Lua global variables/tables of previous ↵Evan Huus1-23/+0
releases have not disappeared." This reverts commit 5b7f00178f45149ecdce204f1c71c1598ceedac1. Change-Id: Idf09d25270847970713b67d02bcd7cbc411a4e9c Reviewed-on: https://code.wireshark.org/review/280 Reviewed-by: Evan Huus <eapache@gmail.com>
2014-02-21Add test suite for verifying Lua global variables/tables of previous ↵Hadriel Kaplan1-0/+23
releases have not disappeared. Several bugs have been introduced due to changing of perl scripts or #define names, such that things exported into Lua have dissapeared or changed unintentionally. This commit adds a test suite which compares the Lua global table with the ones from previous releases (1.8 and 1.10), to verify nothing has gone missing. New items can be added, but old ones cannot go away. The added script to verify these things, called 'verify_globals.lua', also has the ability to display what's new - i.e., what was not in the olrder releases. Lastly, this commit also fixes a bug: MENU_STAT_ENDPOINT became MENU_STAT_ENDPOINT_LIST due to a change in the make-init-lua.pl perl script in this 1.11 release. Change-Id: Ic46172904256dc535b0fe4543237c07dddb3b9b5 Reviewed-on: https://code.wireshark.org/review/242 Reviewed-by: Evan Huus <eapache@gmail.com>
2014-02-20Fix mode for lua test suiteEvan Huus1-0/+0
Change-Id: If516472ca9c4a0ae84da22a0ecfc9449f0495cbb Reviewed-on: https://code.wireshark.org/review/273 Reviewed-by: Evan Huus <eapache@gmail.com>
2014-02-20Add 4 more test scripts for Lua, and its own testsuite menuHadriel Kaplan1-0/+216
This adds test scripts for verifying Pinfo, Address, Field, FieldInfo, NSTime and Listener classes/functions. It also moves Lua test scripts out of unittests and into its own new testsuite. Change-Id: I65c238fd459efb96db3f8f9145842cd038dea7c7 Reviewed-on: https://code.wireshark.org/review/270 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>