aboutsummaryrefslogtreecommitdiffstats
path: root/test
AgeCommit message (Collapse)AuthorFilesLines
2018-11-15test: convert suite_dfilter to use fixturesPeter Wu18-516/+586
Stop using subprocesstest, drop the (now redundant) DFTestCase base class and use pytest-style fixtures to inject the dependency on tshark. This approach makes it easier to switch to pytest in the future. Most substitutions were automated, so no typos should be present. Change-Id: I3516029162f87423816937410ff63507ff82e96f Reviewed-on: https://code.wireshark.org/review/30649 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-11-15test: convert suite_nameres to use fixturesPeter Wu2-39/+57
Create a special custom profile just for the nameres tests, instead of doing this for all tests. Other tests do not need it. Change-Id: I41de0ece9dcf1ee310957beab2bbee0a99784753 Reviewed-on: https://code.wireshark.org/review/30633 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-11-15test: convert suite_text2pcap to use fixturesPeter Wu2-208/+221
Inline all capture file names and use fixtures instead of the global config object. This makes dependencies more explicit. Change-Id: I37a6eda73822735b5a6957b44bce53bb5ecd1aa0 Reviewed-on: https://code.wireshark.org/review/30631 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-11-14test: convert some more tests to use fixturesPeter Wu11-674/+641
Continue the conversion from use of globals (the config module) to fixtures. If a program (like wmem_test or tshark) is unavailable, it will be skipped now rather than failing the test. The general conversion pattern is: - Decorate each class with `@fixtures.uses_fixtures` and (for tests that run tshark) `@fixtures.mark_usefixtures('test_env')`. - Convert all `config.cmd_*` to `cmd_*` and add an argument. - Convert all `config.*_dir` to `dirs.*_dir` and add an argument. - Convert users of `os.path.join(dirs.capture_file, ...)` to use a new 'capture_file' fixture to reduce boilerplate code. Inline variables if possible (this conversion was done in an automated way using regexes). Some other changes: tests that do not require a test environment (like wmem_test) will use 'base_env' which avoids copying config files, `env=config.test_env` got removed since this is the default. Some test classes in suite_clopts were combined. Removed unused imports. Change-Id: Id5480ffaee7d8d56cf2cb3189a38ae9afa7605a1 Reviewed-on: https://code.wireshark.org/review/30591 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-13tshark: Print the packets' comments in the expert infoVasil Velichkov1-0/+69
Previously 'tshark -z expert' was failing with abort when a packet contains a comment - Add a new comment parameter and update the tshark's manual page - Add a new comment_level severity and change the default lavel to it. - Add various 'tshark -z expert' tests Change-Id: I188317da5e00019b8f2b725f0fe84942f774520f Reviewed-on: https://code.wireshark.org/review/30610 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-11-10wiretap: fix truncated reads while reading compressed file formatsPeter Wu1-0/+14
A lot of file dissectors (pcapng, json, etc.) assumed that the packet size is equal to the file size. This is not true if the file was compressed and could result in silently truncating reads or failing to open a file (if the compressed file is larger than the actual data). Observe that a lot of file dissectors are simply copies of each other. Move the fixed implementation to wtap.c and reuse the methods everywhere else. While at it, avoid an unnecessary large allocation/read in ruby_marshal. Change-Id: I8e9cd0af9c4d1bd37789a3b509146ae2182a5379 Reviewed-on: https://code.wireshark.org/review/30570 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Dario Lombardo <lomato@gmail.com> Tested-by: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann <mmann78@netscape.net>
2018-11-09Dumpcap+Qt: Add support for `-a packets:NUM` and `-b packets:NUM`.Gerald Combs2-8/+111
Add the ability to rotate files after a specified number of packets (`-b packets:NUM`). Move some condition checks to capture_loop_write_packet_cb. Add `-a packets:NUM` in order to be consistent. It is functionally equivalent to the `-c` flag. Add a corresponding "packets" option to the Capture Interfaces dialog Output tab. Add initial tests for autostop and ringbuffer conditions. Change-Id: I66eb968927ed287deb8edb96db96d7c73526c257 Reviewed-on: https://code.wireshark.org/review/30534 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-09test: make it possible to use pytest-style test fixturesPeter Wu7-35/+562
Currently all binaries must be available or no tests will be executed. This is inconvenient if you just want to test a single binary (e.g. text2pcap) without having to build epan. The problem is essentially that tests lack dependency annotations. To solve this problem, add the required dependencies as parameters to each test (so-called 'fixtures' in pytest). Skip a test if a binary (such as tshark) is unavailable. As a demonstration, suite_dissection.py is converted. Over time, tests should no longer depend on config.py due to explicit dependencies fixtures (listed in fixtures_ws.py). Since the unittest module does not support such dependency injections, create a small glue for use with pytest and an (incomplete) emulation layer for use with test.py. Tested with pytest 3.8.2 + Python 3.7.0 and pytest 3.0.3 + Python 3.4.3. Python 2.7 is not supported and will fail. Test commands: ~/wireshark/test/test.py -p ~/build/run WS_BIN_PATH=~/build/run pytest ~/wireshark/test -ra Change-Id: I6dc8c28f5c8b7bbc8f4c04838e9bf085cd22eb0b Ping-Bug: 14949 Reviewed-on: https://code.wireshark.org/review/30220 Tested-by: Petri Dish Buildbot Petri-Dish: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-08test: drop Python 2 compatibility, use more Python 3 featuresPeter Wu6-65/+38
Reduces maintenance costs and makes it possible to simplify code. pytest supports Python 2.7 and Python 3.4 (or newer), so that is more or less the minimum target for now. Change-Id: I0347b6c334bf2fc6c9480ff56e9ccfcd48886dde Reviewed-on: https://code.wireshark.org/review/30193 Tested-by: Petri Dish Buildbot Petri-Dish: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-11-01print.c: use SEP_XXX to print byte stringsPascal Quantin1-16/+16
Bug: 15253 Change-Id: I3b294fa65c1bd4ef4184bcf2e1b56ef4f55cbb82 Reviewed-on: https://code.wireshark.org/review/30461 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-10-31text2pcap: Fix IPv6 checksumVasil Velichkov1-0/+3
Add the length field in the IPv6 pseudo header struct and refactor the pseudo headers initialization Change-Id: Ie0490dfba051a1112e465aaa6d03909417b2977e Reviewed-on: https://code.wireshark.org/review/30407 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann <mmann78@netscape.net>
2018-10-31text2pcap: Fix -i <proto> when IPv6 (-6) is specifiedVasil Velichkov1-0/+45
When the -i <proto> option is specified the hdr_ip was always set to TRUE which resulted in a wrong header length when the IPv6 (-6) option is specified as well. To resolve this set hdr_ip only when -i is specified without -4 or -6 options. Change-Id: I21898f27ceaad603b9275ab6878ff4bd8f9586cd Reviewed-on: https://code.wireshark.org/review/30411 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann <mmann78@netscape.net>
2018-10-30text2pcap: Fix IPv6 payload lengthVasil Velichkov1-61/+75
According to RFC 8200 the payload length must contain the length of the payload without the IPv6 header's length Change-Id: Ibeb18c243edc396eaac6d2ffde73d6c4a6fe75a0 Reviewed-on: https://code.wireshark.org/review/30406 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>
2018-10-25test: make 'double' tests rely on icmp instead of ntp.Dario Lombardo2-19/+18
'double' tests have been disabled in aa03833 due to format change in ntp fields. Change-Id: Id3ab0a736c164bb7fdfed7b5da8856b512308978 Reviewed-on: https://code.wireshark.org/review/30366 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-10-21ntp: change root delay and dispersion to integer for fixed precision.Dario Lombardo1-0/+3
dfilter/group_double tests have been removed and need to be replaced by leveraging another protocol. Bug: 15049 Change-Id: I354a27a5217336ee5c9b1d021a2d3226e3532eec Reviewed-on: https://code.wireshark.org/review/29035 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann <mmann78@netscape.net>
2018-10-18lua: add support for ethernet addresses to the Address classMartin Kaiser1-1/+15
The code for the Address class already contains commented-out code for a number of additional address types. Activate the draft constructor for ethernet addresses and complete it. Use the newly-added function to parse a string that contains an ethernet address. Add a basic test tvb.lua. Read an ethernet address from a tvb and compare it to a constant Address.ether object. Change-Id: I9771dd6e7ade4b572a8b864b8986d641b4eba3e5 Reviewed-on: https://code.wireshark.org/review/30163 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Petri-Dish: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-10-17wslua: Add support for base.RANGE_STRING handling.Richard Sharpe1-0/+9
A range string is passed as a table of tables, eg: range_string = { { 0, 24, "Some string for values 0 to 24" }, { 25, 25, "The string for value 25" }, { 26, 255, "The string for the remainder" } } Included is a minimal Lua test for range strings and value strings (which did not have one previously.) It will take more time than I currently have to figure out how to do a more exhaustive test. Also fixed some grammar issues in error messages along the way. Change-Id: Ia9d1efc8adabb6528c4bdcf1624c9ede49e2fdc6 Reviewed-on: https://code.wireshark.org/review/30211 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
2018-10-16KNX-IP: new KNXnet/IP dissectorRalf Nasilowski5-0/+173
The new KNXnet/IP dissector replaces the old KNXnet/IP dissector. The new KNXnet/IP dissector supports the new KNX features - A_MemoryExtended services - A_PropertyExt services - KNX Data Security - KNXnet/IP Core V2 - KNXnet/IP Device Management V2 - KNXnet/IP Tunneling V2 - KNXnet/IP Routing V2 - KNXnet/IP Security Change-Id: I3d1d716ef03d16d2720e6a1fcb23c2243d1cd956 Reviewed-on: https://code.wireshark.org/review/29155 Petri-Dish: Roland Knall <rknall@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Roland Knall <rknall@gmail.com>
2018-10-13text2pcap: gracefully handle hexdump without trailing LFPeter Wu1-0/+7
When copying hexdumps, the newline might be missing which would result in a capture file missing one byte in its packet. Adjust the grammar to recognize the two trailing hexadecimal characters as a "byte". This is safe because Flex picks the rule that matches the longest input string. So given "01 ", it will always match all three characters. If something like "01x" is given, then the "text" rule will be matched (as before). Only if no more characters are available (such as at the end of a file), then the rule will match two hexdigits. Remove the unnecessary hexdigit rule while at it. Change-Id: I21dc37d684d1c410ce720cb27706a6e54f87f94d Reviewed-on: https://code.wireshark.org/review/30190 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-10-13test: increase coverage for text2pcap supported formatsPeter Wu1-29/+61
The manual documents several cases, be sure to check for them to avoid further grammar changes from breaking expectations. Change-Id: Ie38ecf624120a3a9297d02b4fd9b05511acf5ac9 Reviewed-on: https://code.wireshark.org/review/30189 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-10-13test: fix text2pcap tests not to overwrite case_text2pcap_pcapPeter Wu1-7/+12
Fix an unfortunate typo that disabled all of the pcap tests. Patch the correct capinfos output with the expected packets/datasize values and fix the dns+icmp datasize case to match the original test.sh value. Change-Id: I25aac4c8040c2000602753269f69f4bdc4a8a59b Reviewed-on: https://code.wireshark.org/review/30167 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-10-12test: reduce further influence from the environmentPeter Wu3-11/+17
Some tests used the default home directory which can have side-effects (such as loading plugins, loading deprecated preferences). These could cause tests to fail. Always use a sane environment to fix this. Change getTsharkInfo to use this clean environment as well (WIRESHARK_CONFIG_DIR does not exist with master-2.6 and would also not propagate things like ASAN_OPTIONS=detect_leaks=0). Change-Id: I1674f71972d35de91d191e0c29fdb59b8a0a56ce Reviewed-on: https://code.wireshark.org/review/30165 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-10-12test: fix DeprecationWarning: invalid escape sequencePeter Wu4-10/+10
Change-Id: I4e0365c1f9d30a033b26f68f815c8209b96d73f5 Reviewed-on: https://code.wireshark.org/review/30164 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-10-11text2pcap: Fix TCP, UDP or SCTP headers over IPv6Vasil Velichkov1-1/+130
When the IPv6 (-6) option was specified together with either TCP (-T), UDP (-u) or SCTP (-s/-S) option the generated packet was invalid because an IPv4 option was implied an a wrong header was added. Bug: 15194 Change-Id: I5a7b83d8aa3f3ad56f0c8110e598090945e60225 Reviewed-on: https://code.wireshark.org/review/30107 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-10-05*shark: Update help and manpage for name resolvingUli Heilmeier1-2/+2
Add 'v' option for VLAN ID resolving and get rid of deprecated 'C' option. Bug: 14826 Change-Id: I63104f4a465d251048693ad02882ea7eb2c4d926 Reviewed-on: https://code.wireshark.org/review/30029 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-09-14Test: Fix a copy+paste error.Gerald Combs1-1/+1
Change-Id: Id040b05af022752672f2d56d4796f0c71352e7b1 Reviewed-on: https://code.wireshark.org/review/29658 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-09-13Start renaming SSL to TLS.Gerald Combs2-25/+27
Rename the "ssl" protocol to "tls" and add an "ssl" alias. Prefer "TLS" over "SSL" in user interface text and in the documentation. Fix the test_tls_master_secret test while we're here. Bug: 14922 Change-Id: Iab6ba2c7c4c0f8f6dd0f6d5d90fac5e9486612f8 Reviewed-on: https://code.wireshark.org/review/29649 Petri-Dish: Gerald Combs <gerald@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-09-07Lua: remove various logging functions (debug, warn, etc.)Peter Wu1-5/+0
The "debug" logging function overwrites the "debug" package which breaks luacov: https://github.com/keplerproject/luacov/issues/55 Change-Id: I9b6025c060733198bfff8ea959444c09d6e08709 Reviewed-on: https://code.wireshark.org/review/29449 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-09-04ntp: make ntp.precision an uint8.Dario Lombardo1-12/+12
Change-Id: I7ee0c7fbe5bab90bd1109b2f39feaec033b95621 Reviewed-on: https://code.wireshark.org/review/29178 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-08-31Add support for protocol aliases. Switch BOOTP to DHCP.Gerald Combs5-30/+30
Add support for aliasing one protocol name to another and for filtering using aliased fields. Mark aliased fields as deprecated. Rename the BOOTP dissector to DHCP and alias "bootp" to "dhcp". This lets you use both "dhcp.type" and "bootp.type" as display filter fields without having to duplicate all 500+ DHCP/BOOTP fields. To do: - Add checks to proto.c:check_valid_filter_name_or_fail? - Transition SSL to TLS. - Rename packet-bootp.c to packet-dhcp.c? Change-Id: I29977859995e8347d80b8e83f1618db441b10279 Ping-Bug: 14922 Reviewed-on: https://code.wireshark.org/review/29327 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-08-30tcp: fix OoO reassembly when the first data packet is OoOPeter Wu2-0/+11
OoO reassembly assumed that the stream starts with the first data segment, but this can already be OoO. Use the hint from SYN instead. The test capture is based on a local capture, post-processed with scapy to introduce an OoO condition and fixup the frame time. Bug: 15078 Change-Id: Id0e312bb3d0e7c7f8f1b243a2be9f15c9851c501 Fixes: v2.9.0rc0-1097-gca42331437 ("tcp: add support for reassembling out-of-order segments") Reviewed-on: https://code.wireshark.org/review/29305 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-08-17TLS13: add final tests for RFC 8446Peter Wu4-0/+69
Add TLS 1.3 tests that verify decryption of handshake, application and early data. Add another test that shows that early data is properly skipped. This completes TLS 1.3 (RFC 8446) decryption support. The trace was created using boringssl c4131a4a23a1. Bug: 12779 Change-Id: Iddd266ecd3f428c95aa3f69616ce55e75d4ccca0 Reviewed-on: https://code.wireshark.org/review/29170 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2018-08-08WireGuard: implement decryption with PSKsPeter Wu2-0/+68
This imposes an additional requirement on the key log file, PSKs are only linked to the most recently seen ephemeral key. This means that the key log might contain duplicate PSK lines, but at least the dissector won't have to try all keys and thereby save CPU time. Bug: 15011 Change-Id: I368fa16269c96c4a1ff3bcb4e376c21f38fa2689 Reviewed-on: https://code.wireshark.org/review/28993 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-08-08WireGuard: decrypt transport dataPeter Wu1-8/+20
Invoke IP or data dissector for decrypted transport data. Bug: 15011 Change-Id: I8fa149c429ae774c16fe7e712d4bfb6b3478ed11 Reviewed-on: https://code.wireshark.org/review/28992 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-08-08WireGuard: implement responder handshake decryptionPeter Wu1-4/+27
Transport data decryption will follow later. Bug: 15011 Change-Id: Ib755e43ff54601405b21aeb0045b15d158bc283b Reviewed-on: https://code.wireshark.org/review/28991 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-08-08WireGuard: add keylog for initiation decryption with ephemeral keysPeter Wu1-1/+50
As UATs are currently unable to receive keys dynamically without manual user interaction followed by rescanning of the pcap, add a mechanism like ssl.keylog_file. Such keys can be extracted using the tools from contrib/examples/extract-handshakes/ in the WireGuard source tree. Now decryption of Initiation messages is also possible when keys (Epriv_i) are captured from the initiator side. Bug: 15011 Change-Id: If998bf26e818487187cc618d2eb6d4d8f5b2cc0a Reviewed-on: https://code.wireshark.org/review/28990 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-08-08WireGuard: implement initiation message decryption with static keysPeter Wu1-0/+16
Enable decryption of the static and timestamp fields when the private static key of the responder is known. Decryption of the initiation and response messages using private ephemeral keys will be done later. Bug: 15011 Change-Id: Ifc9729059694700333b6677374ab467c8cb64263 Reviewed-on: https://code.wireshark.org/review/28989 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-08-08WireGuard: implement peer identification based on MAC1Peter Wu2-0/+53
Using long-term static public keys, it is possible to identify the recipient of a handshake message. Add a new UAT where such keys can be configured. Allow private keys to be configured as well since this enables decryption of the Initiation handshake message. Bug: 15011 Change-Id: I0d4df046824eac6c333e0df75f69f73d10ed8e5e Reviewed-on: https://code.wireshark.org/review/28988 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-07-26test: do not silently ignore feature detection failuresPeter Wu1-19/+19
When ASAN memleak detection is enabled, any memory leak would result in an exception and subsequently all features are marked as missing. With the default profile, any Lua plugin or certain configurations could cause a memory leak. To avoid such interference, set the configuration path to a dummy location and warn whenever an error happens nonetheless. Do not call setProgramPath() immediately, there is no "tshark" binary in the current working directory anymore. Rely on test.py to set the path. Change-Id: Idccc3d68eb6f6bb64d3a0b32897acecc65e0dfb6 Reviewed-on: https://code.wireshark.org/review/28867 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-07-23Remove executable file permission from lua test filesJaap Keuter5-0/+0
Change-Id: I18b3f145bb48a78edabed3cca03691d15cd06842 Reviewed-on: https://code.wireshark.org/review/28809 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-07-20Lua: Switch from disable_lua to enable_lua.Gerald Combs1-1/+1
Deprecate "disable_lua" in favor of "enable_lua". Configuration options typically use "true" or a similar value to enable features. Using "disable_lua = false" to enable Lua seems odd. Change-Id: I224acad0559d409ea0a28b5555d1eb898564328c Reviewed-on: https://code.wireshark.org/review/28773 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-07-17Tests: add minimal pytest supportPeter Wu3-4/+49
pytest is a powerful test framework. The initial motivation is to have much better detailed reporting when a test fails, see for example https://docs.pytest.org/en/latest/ Additionally, it has full parallelization support at the test level (via the pytest-xdist plugin) instead of being limited to the suite level (which currently has to be hard-coded via CMakeLists.txt). Usage with the build dir in /tmp/wsbuild and src dir in /tmp/wireshark: export WS_BIN_PATH=/tmp/wsbuild/run pytest /tmp/wireshark/tests For parallelization support and verbose printing: pip install pytest-xdist pytest -nauto -v /tmp/wireshark/tests To limit yourself to a case based on a pattern: pytest -nauto -v /tmp/wireshark/tests -k test_unit_ctest_coverage Tested on Arch Linux with Python 3.6.5, pytest-3.6.2, xdist-1.22.2. pytest -n8 finished in 82 seconds while ctest -j8 required 87 seconds. Change-Id: I832f4dd9f988d6656df795327e81610accf54b9f Reviewed-on: https://code.wireshark.org/review/28651 Reviewed-by: Gerald Combs <gerald@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-07-06tests: add regression tests for Follow TCP StreamPeter Wu2-0/+75
Verified that the tests failed without the fixes for the linked bugs. The tests have full statement coverage(*1) for check_follow_fragments and follow_tcp_tap_listener. For details and Scapy script, see: https://git.lekensteyn.nl/peter/wireshark-notes/commit/crafted-pkt/badsegments.py?id=4ecf9d858b49e76d8a9c29df01ce1bd523ae6704 (*1) except for `if (data_length <= data_offset) { data_length = 0; }` Change-Id: I625536df375272cf6c9116231194c39df1217fae Ping-Bug: 13700 Ping-Bug: 14944 Reviewed-on: https://code.wireshark.org/review/28618 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-06-28tcp: add support for reassembling out-of-order segmentsPeter Wu2-0/+50
Currently out-of-order segments will result in cutting a stream into two pieces while the out-of-order segment itself is ignored. For example, a stream of segments "ABDCE" is interpreted as "AB", "DE" with "C" ignored. This behavior breaks TLS decryption or prevent application layer PDUs (such as HTTP requests/responses) from being reconstructed. To fix this, buffer segments when a gap is detected. The proposed approach extends the "multi-segment PDU" (MSP) mechanism which is normally used for linking multiple, sequential TCP segments into a single PDU. When a gap is detected between segments, it is assumed that the segments within this gap are out-of-order and will be received (or retransmitted) later. The current implementation has a limitation though, if multiple gaps exist, then the subdissector will only be called when all gaps are filled (the subdissector will receive segments later than necessary). For example with "ACEBD", "ABC" can already be processed after "B" is received (with "E" still buffered), but due to how MSP are extended, it must receive "D" too before it reassembles "ABCDE". In practice this could mean that the request/response times between HTTP requests and responses are slightly off, but at least the stream is correct now. (These limitations are documented in the User's Guide.) As the feature fails at least the 802.11 decryption test where packets are missing (instead of OoO), hide this feature behind a preference. Tested with captures containing out-of-order TCP segments from the linked bug reports, comparing the effect of toggling the preference on the summary output of tshark, the verbose output (-V) and the two-pass output (-2 or -2V). Captures marked with "ok" just needed "simple" out-of-order handling. Captures marked with "ok2" additionally required the reassembly API change to set the correct reassembled length. This change does "regress" on bug 10289 though when the preference is enabled as retransmitted single-segment PDUs are now passed to subdissectors. I added a TODO comment for this unrelated cosmetic issue. Bug: 3389 # capture 2907 (HTTP) ok Bug: 4727 # capture 4590 (HTTP) ok Bug: 9461 # capture 12130 (TLS/HTTP/RPC-over-HTTP +key 12131) ok Bug: 12006 # capture 14236 (HTTP) ok2; capture 15261 (HTTP) ok Bug: 13517 # capture 15370 (HTTP) ok; capture 16059 (MQ) ok Bug: 13754 # capture 15593 (MySQL) ok2 Bug: 14649 # capture 16305 (WebSocket) ok Change-Id: If3938c5c1c96db8f7f50e39ea779f623ce657d56 Reviewed-on: https://code.wireshark.org/review/27943 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-06-21Test: Add sharkd tests.Gerald Combs3-2/+75
Change-Id: I0e5049700ab9285196ce6b4567bd2d034529e763 Reviewed-on: https://code.wireshark.org/review/28327 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-06-18Test+CMake: Make our test grouping more fine-grained.Gerald Combs3-10/+25
Split our tests by suite_*.group_* instead of suite_*. There are quite a few dfilter tests and this should make them more parallelizable. Change-Id: I52371409618cda70dc99811e8de1fb1ad9d9a3b6 Reviewed-on: https://code.wireshark.org/review/28329 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-05-30Test: Add UTF-8 filter tests.Gerald Combs2-0/+17
Change-Id: Ic1e961802e716b5c446428efa068a6205faab954 Reviewed-on: https://code.wireshark.org/review/27912 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-05-25wslua: fix NSTime:__tostring for negative valuesPeter Wu1-1/+8
"nstime_t{A, B}" is defined as "A + B * 10^9" rather than an integer part A and fractional part B. Bug: 14720 Change-Id: I5321db7d5ecea8f976291d2a22667b02162194e2 Reviewed-on: https://code.wireshark.org/review/27775 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-22Test: Consolidate our environments.Gerald Combs2-17/+7
Move WIRESHARK_QUIT_AFTER_CAPTURE to the default environment instead of running the capture tests in a separate environment. Change-Id: I5198df35f512ffe8c0d7f091a7b50d5fdb9c4ff6 Reviewed-on: https://code.wireshark.org/review/27711 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-05-21Test: Be more paranoid about our log output.Gerald Combs2-1/+13
Run our CTest tests with PYTHONIOENCODING=UTF-8. If someone runs our tests manually and their output encoding isn't UTF-8, print replacement characters instead of failing with an error. Open our log files with "errors='backslashreplace'" in case their contents aren't UTF-8. Change-Id: Ifa4d12c2b5e272cf3903f3e0c6102e4d961562f1 Reviewed-on: https://code.wireshark.org/review/27686 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>