aboutsummaryrefslogtreecommitdiffstats
path: root/test
AgeCommit message (Collapse)AuthorFilesLines
2014-03-22Fix spelling mistakes in Lua test scriptsHadriel Kaplan4-28/+28
Change-Id: I8671eb3d3b46ec5c723a6545451ecbb33a10c807 Reviewed-on: https://code.wireshark.org/review/788 Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-03-22Add way for Lua file reader to save state per file read/write opsHadriel Kaplan3-261/+528
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 Kaplan4-11/+31
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 Mann5-0/+2147
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 Kaplan5-17/+215
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-13add a test for SSL/TLS decryption using the master secretMartin Kaiser3-3/+22
rename the existing SSL test to clarify that it uses the server's private key for decryption Change-Id: I13598fc4cf724b144a8f27bfa7a3316acfc78728 Reviewed-on: https://code.wireshark.org/review/640 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2014-03-11Fix Bug 9870 'Lua: trying to call/get an invalid name results in a get-loop ↵Hadriel Kaplan2-4/+16
error' Due to the change I made previously for how methods are accessed, if you try to access one that doesn't exist (for example mistype it or whatever), you get an internal Lua error about a loop in table get, as opposed to the right error message about the field not existing. That's because I had set the class' metatable __index metamethod to point to the class table, which of course has the metatable with the __index metamethod, causing a lookup loop. Blech. Change-Id: I20d3717feadd45f652c2640e1671846184e7082d Reviewed-on: https://code.wireshark.org/review/593 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-10Add GLib's regex library into LuaHadriel Kaplan8-2/+1465
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-03-05Add test to dump glossaries.Evan Huus1-1/+20
All it checks is that they don't crash, but this is enough to catch malformed extended value strings and other oddities. Change-Id: If853e8e2b19517a784daa4bbb8e41eddc7c7ddd9 Reviewed-on: https://code.wireshark.org/review/520 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Evan Huus <eapache@gmail.com>
2014-02-25Fix bug 6357: Lua all_field_infos() broken within tap/listenerHadriel Kaplan1-3/+70
The current API for Lua provides a global function "all_field_infos()" which returns all the populated field_info nodes in the current proto_tree. By default all_field_infos() "works", in the literal sense: it returns exactly the fields the previous dissectors of the packet have populated at that instant of time. But of course dissectors don't populate all the applicable fields most of the time, because of the TRY_TO_FAKE_THIS_ITEM optimization where they don't fill in things that aren't needed at the time by a display, color, or tap's dfilter. So this commit offers a way to force the dissectors to populate all the applicable field_infos in the tree, by setting the proto_tree to be visible. Obviously that is going to impact performance, since it basically bypasses the TRY_TO_FAKE_THIS_ITEM optimization; so the patch only does this if the Lua script author told it to explicitly, by adding an argument to Listener.new() and register_postdissector(). Change-Id: I11d3559fbe8c14fbadf1b51415a3701dc1200b7b Reviewed-on: https://code.wireshark.org/review/286 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-02-25Adds some Lua helper functions: some commonly used functions, and to help ↵Hadriel Kaplan2-19/+23
troubleshooting Lua scripts There are some common things people need to do, such as convert to/from hex or get the raw binary string in a ByteArray/Tvb/TvbRange. These have been added, as well as some tests for them in the testsuites. Also, functions have been added to allow a script to get all the available tap types and filter fields, since they are not exactly what one can see in the Wireshark gui. Change-Id: I92e5e4eae713bb90d79b0c024eaa4e55b99cc96b Reviewed-on: https://code.wireshark.org/review/249 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-02-24Remove executable bit from a few filesPascal Quantin2-0/+0
Change-Id: Ib9be221e3d325379c8b665ab73d976254bb23bb6 Reviewed-on: https://code.wireshark.org/review/342 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-02-21Fix bug 9790: Lua: wslua allows duplicate field registrationHadriel Kaplan2-0/+594
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 Kaplan6-0/+2313
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 Huus6-2302/+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 Kaplan6-0/+2302
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 Kaplan7-104/+1086
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>
2014-02-14Adds support for Lua struct library so one can pack/unpack binary structuresHadriel Kaplan2-0/+356
This is based on Roberto Ierusalimschy's struct library, along with additional options based on Flemming Madsen's patch to the lua-users mailing list, and some changes I made to support 64-bit integer packing/unpacking. Details are in the top comments for wslua_struct.c. This also includes a test script. Change-Id: Ifcd0116ba013d5c760927721c8d6e9f28965534b Reviewed-on: https://code.wireshark.org/review/98 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-02-13Lua: add ability for scripts loaded from command-line to be passed argumentsHadriel Kaplan2-0/+75
This change adds the ability to pass on to lua scripts loaded from the command-line (tshark or wireshark) additional arguments supplied by the command-line. This will help us in our testsuites, but also might be useful for user-created scripts. The additional arguments are passed in using the '-X' eXtension switch. Change-Id: Ib94cdf1ffd194ca84692fee7816665e4ff95efbd Reviewed-on: https://code.wireshark.org/review/156 Reviewed-by: Evan Huus <eapache@gmail.com> Tested-by: Evan Huus <eapache@gmail.com>
2014-02-09Add test suite for Lua dissector-related functionsHadriel Kaplan4-1/+698
This isn't super-fancy, but it runs a simple protocol dissector and verifies the tshark output matches what it expects. Things like Proto, ProtoField, Field, Tvb, TvbRange, etc., are used in an example dissector script - it dissects DNS... partially. Enough to make sure things aren't fundamentally broken. This provides something to add on top of later as well. Change-Id: Icf3c8e9534944bcf4c4f6150f02a9a43f999cd75 Reviewed-on: https://code.wireshark.org/review/126 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-02-09Fix bug 9736 'Lua: new Int64/UInt64 functions don't prevent division by zero'Hadriel Kaplan1-15/+51
OK, in all fairness this does a bit more than just fix that bug. It also adds a 'Int64()' and 'UInt64()' __call metamethods. I generally dislike using __call metamethods, because they're often unintuitive (for example the wireshark Field and FielInfo use this in a bizarre fashion). But this happens to be a perfect use for it, and very natural, imho. Another change is to make the metatables of classes visible to scripts. There was never really a good reason not to make them visible, and they have to be visible to do things like use __call on a plain table... not to mention I need them to be visible to run test scripts verifying evrything is kosher. I also updated the test suite to test for the div/mod by zero. Change-Id: Ia4c594c8f59d4e799090716bd032ba2815df032f Reviewed-on: https://code.wireshark.org/review/149 Reviewed-by: Evan Huus <eapache@gmail.com>
2014-02-04Various fixes to the Lua int64 codeEvan Huus2-1/+11
- add casts to pacify certain buildbots - skip test if lua isn't available Change-Id: I614c05dca40cb848c87b361e4b3d3c4e94aafb9e Reviewed-on: https://code.wireshark.org/review/97 Reviewed-by: Evan Huus <eapache@gmail.com> Tested-by: Evan Huus <eapache@gmail.com>
2014-02-04Adds support for Lua Int64 and UInt64 operators, functions, and generalHadriel Kaplan2-0/+353
usefulness, working around bug #9162 until Lua 5.3 is released. The existing Int64 and UInt64 classes provide virtually no usefullness, other than for creating a string of their value. While one could then write Lua code to convert the string to Lua numbers and such, ultimately Lua has no native 64-bit integer support, making such a task difficult to handle in Lua. This change adds a host of functions and operators to the existing Int64 (gint64) and UInt64 (guint64) classes, to enable true 64-bit integer support on par with native Lua numbers. A test script is also provided, which tests the functions/operators. Change-Id: I4c5f8f5219b9a88198902283bd32ddf24c346bbe Reviewed-on: https://code.wireshark.org/review/83 Tested-by: Evan Huus <eapache@gmail.com> Reviewed-by: Evan Huus <eapache@gmail.com>
2014-01-07Remove svn:executable attribute.Jakub Zawadzki2-0/+0
svn path=/trunk/; revision=54637
2013-12-11Revert part of r53874Jakub Zawadzki1-1/+2
svn path=/trunk/; revision=53944
2013-12-08It's DTLS failing not DVB_CI.Jakub Zawadzki1-3/+3
svn path=/trunk/; revision=53874
2013-12-08Try to check why test.sh fails.Jakub Zawadzki1-2/+1
svn path=/trunk/; revision=53871
2013-12-07add a decryption test for DVB-CI to the testsuiteMartin Kaiser2-1/+20
svn path=/trunk/; revision=53830
2013-11-30README update. Bug 9174 ↵Michael Mann1-3/+26
(https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9174) From Peter Wu svn path=/trunk/; revision=53671
2013-10-19Add OID unit tests. Bug 9294 ↵Michael Mann1-0/+7
(https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9294) From Ed Beroset svn path=/trunk/; revision=52692
2013-10-09Slight simplification, inline a function only ever called once.Evan Huus2-18/+13
svn path=/trunk/; revision=52470
2013-10-09From Ed Beroset via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9238Evan Huus3-1/+21
Add test for ANSI C12.22 decryption. svn path=/trunk/; revision=52469
2013-10-08From Ed Beroset via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9245Evan Huus1-0/+5
Fix test suite so that it doesn't attempt to use color if ncurses is not installed. This came up when I attempted to use the test suite under Windows with cygwin installed but not ncurses. The result is not entirely broken but the error messages saying that "tput is not a valid command" make the menus and results difficult to read. svn path=/trunk/; revision=52449
2013-10-06Another path and ordering tweak.Evan Huus1-7/+8
svn path=/trunk/; revision=52430
2013-10-06More tweaking of test suite path variables, trying to make everything playEvan Huus4-18/+21
nicely on Windows and Linux both. svn path=/trunk/; revision=52428
2013-10-06Fix nameres test suite cleanup after recent changes.Evan Huus1-2/+1
svn path=/trunk/; revision=52417
2013-10-06From Peter Wu via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9174Evan Huus4-34/+22
Reorg more of the test variables, still separating source and test directories. More minor fixes from me. svn path=/trunk/; revision=52412
2013-10-06Try to fix unittest path magic on windows.Evan Huus1-1/+1
svn path=/trunk/; revision=52400
2013-10-06From Peter Wu via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9174Evan Huus6-21/+48
Support running most tests out-of-tree. Use case is to have a source tree and use a semi-unprivileged user to perform tests (to rule out interference). From me: - fix unit-test suite, it has to build the binaries it runs so it must more-or-less ignore the out-of-tree stuff - fix name-res suite, just missing a path qualifier svn path=/trunk/; revision=52397
2013-09-22From Peter Wu: on systems other than Windows, skip the GUI tests if theGuy Harris2-1/+20
DISPLAY environment variable isn't set. From me: note that this won't be the right thing to do on OS X if we switch to a toolkit that doesn't use X11, and that this may or may not be the right thing to do with toolkits using Wayland or Mir directly. svn path=/trunk/; revision=52182
2013-08-28Update the test suite for r51556. Use -Y in one place instead of -R where onlyEvan Huus1-2/+2
filtering is important. Use -2 and -R together in one place where the counting functionality is important. svn path=/trunk/; revision=51558
2013-08-23Assume we always have GNU diff and that we can use --strip-trailing-cr.Gerald Combs1-1/+1
svn path=/trunk/; revision=51496
2013-08-23Add a test for rawshark.Gerald Combs3-1/+40
svn path=/trunk/; revision=51494
2013-05-31Fix the name resolution tests so that they run on Windows. Enable themGerald Combs2-10/+2
by default. Remove some unused code. svn path=/trunk/; revision=49661
2013-05-31nameres.hosts_file_handling shouldn't affect loading the profile "hosts"Gerald Combs6-0/+224
file. That should be loaded no matter what if we have name resolution enabled. Add a name resolution test suite. Currently disabled until I can test it on Windows. svn path=/trunk/; revision=49657
2013-04-10Use -Y instead of -R to filter tshark in decryption tests. We're not doingEvan Huus1-4/+4
2-pass analysis so -Y makes more sense and doesn't print deprecation warnings. svn path=/trunk/; revision=48808
2013-03-27Run the wmem unit tests with --verbose (provided by glib) so that ifEvan Huus1-1/+5
one of the random bits fails we get the seed to reproduce with. svn path=/trunk/; revision=48576
2013-03-23Add wmem unit test binary (still empty) to nmake build and toEvan Huus1-0/+6
the unit test part of the test suite. Once I know it's building and running properly on the buildbots then I'll actually start writing tests. svn path=/trunk/; revision=48517
2013-03-18Disable software updates in a blind attempt to fix the recent testGerald Combs1-2/+1
failures. svn path=/trunk/; revision=48391