aboutsummaryrefslogtreecommitdiffstats
path: root/test/fixtures_ws.py
AgeCommit message (Collapse)AuthorFilesLines
2022-06-05Version info: Do not show plugin countJoão Valverde1-1/+1
Plugin count is dependant on initialization order and showing zero plugins loaded can be misleading.
2022-04-21test: Remove libgcrypt checks for 1.8 and belowJohn Thacker1-3/+0
libgcrypt 1.8.0 or higher is required now, so remove the checks to skip tests without it
2022-03-28tests: Fix Kerberos detectionJoão Valverde1-1/+1
2022-03-17test: Use integer tuple to check Gcrypt versionStig Bjørlykke1-4/+5
Converting Gcrypt version to float before checking against 1.6 does not work when Gcrypt version is 1.10 and above.
2022-02-24Reword plugin info in About Wireshark dialogJoão Valverde1-1/+1
2021-11-18Test: Make sure XDG_CONFIG_HOME isn't set.Gerald Combs1-0/+5
Make sure the environment factory in fixtures_ws.py unsets XDG_CONFIG_HOME, otherwise tests can fail. Ping #17730.
2021-09-27MSYS2: Fix detection of test suite binariesJoão Valverde1-1/+3
Fix hack to find test binaries. We must only search in run/<config> if using Visual Studio.
2021-02-26tests: skip plugin count test if feature is disabledJoão Valverde1-0/+1
2020-12-01Protobuf/gRPC: add test cases for Protobuf and gRPCHuang Qiangxiong1-0/+1
Add case_dissect_protobuf and case_dissect_grpc in test/suite_dissection.py. Add *.proto into the sub directories of test/protobuf_lang_files/. Run command like 'pytest --program-path .\run\Debug\ -k "grpc or protobuf"' in build directory (in windows) to test these cases only.
2020-11-05Tools+test: Call python3 explicitly.Gerald Combs1-1/+0
PEP 394[1] says, "In cases where the script is expected to be executed outside virtual environments, developers will need to be aware of the following discrepancies across platforms and installation methods: * Older Linux distributions will provide a python command that refers to Python 2, and will likely not provide a python2 command. * Some newer Linux distributions will provide a python command that refers to Python 3. * Some Linux distributions will not provide a python command at all by default, but will provide a python3 command by default." Debian has forced the issue by choosing the third option[2]: "NOTE: Debian testing (bullseye) has removed the "python" package and the '/usr/bin/python' symlink due to the deprecation of Python 2." Switch our shebang from "#!/usr/bin/env python" to "#!/usr/bin/env python3" in some places. Remove some 2/3 version checks if we know we're running under Python 3. Remove the "coding: utf-8" in a bunch of places since that's the default in Python 3. [1]https://www.python.org/dev/peps/pep-0394/#for-python-script-publishers [2]https://wiki.debian.org/Python
2020-06-01dot11decrypt: Support decryption using TK user inputMikael Kanstrup1-0/+38
Add support for TK user input keys. With this Wireshark can decrypt packet captures where 4WHS frames are missing and packet captures with non-supported AKMS, for example 802.11r / Fast BSS Transitioning. Decryption using user TK works as a backup if the normal decryption flow does not succeed. Having TK decryption keys added will affect general IEEE 802.11 dissector performance as each encrypted packet will be tested with every TK. Worst case scenario is plenty of TKs where none of them matches encrypted frames. On successful user TK decryption an SA is formed based on parameters used to decrypt the frame. This SA is similar to what is formed when Wireshark detects and derive keys from 4WHS messages. With the SA entry in place the decryption performance (success case) should be on par with "normal" decryption flow. Bug: 16579 Change-Id: I72c2c1e2c6693131d3ba07f8ddb8ff772c1b54a9 Reviewed-on: https://code.wireshark.org/review/37217 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-02-26Test: Make sure we can run Wireshark on macOS.Gerald Combs1-3/+5
Run Wireshark tests on macOS only if SECURITYSESSIONID. If this isn't reliable enough we might be able to get away with running a small UI utility, e.g. `pbpaste > /dev/null`. Change-Id: Ieccb87bcc1312f02c22ec2905a80437bf136d964 Reviewed-on: https://code.wireshark.org/review/36195 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2020-02-18Test: Bump the WireGuard Gcrypt version requirement.Gerald Combs1-0/+1
WireGuard decryption requires Gcrypt 1.8 or later. Change-Id: I4a9e910df61a2d8f375e3f90b22511fe59be922c Reviewed-on: https://code.wireshark.org/review/36128 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>
2019-12-20test: fix extcap_name fixture and skip test.Dario Lombardo1-1/+4
dpauxmon relies on libnl that is linux specific. Skip the test for other platforms. Fix skip message while here. Change-Id: I744d83d0a56e41e1c32e45ade8ca0d9dd29876e1 Reviewed-on: https://code.wireshark.org/review/35525 Reviewed-by: Dario Lombardo <lomato@gmail.com> Tested-by: Dario Lombardo <lomato@gmail.com> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-12-17test: add suite_extcaps.Dario Lombardo1-0/+7
All the shipped extcaps will be tested against: --help --extcap-interfaces --extcap-interface <IFACE> --extcap-dtls --extcap-interface <IFACE> --extcap-config Bug: 16268 Change-Id: I7949103940c95c9c23fc5dd3743c15995d3a152d Reviewed-on: https://code.wireshark.org/review/35409 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-04-22Add brotli decompression support for HTTP and HTTP2 dissectors.Dániel Bakai1-0/+1
Change-Id: I9c09f55673187f6fee723fcd72798fb6b9958b03 Reviewed-on: https://code.wireshark.org/review/32745 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-01-24test,travis: dump a screenshot for hanging GUI testsPeter Wu1-0/+32
For some reason the wireshark GUI tests hang on the Travis OS X builds, but I could not reproduce it locally. It turns out than an error dialog was present, but I could not know that without the screenshot. Change-Id: Idf897d33b4fddf3c19c69ebcea60b629f1ca9368 Reviewed-on: https://code.wireshark.org/review/31682 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-01-24Test: enable capture tests by default using the Loopback interfacePeter Wu1-22/+26
Avoid pinging www.wireshark.org, this removes an external dependency. Instead send small UDP datagrams to UDP port 9 (discard) every 50ms. Enable this for all platforms (including macOS and Linux) by default. On Windows the tests requires Npcap and will be skipped with WinPcap. Remove the --capture-interface option since it is no longer needed. Copy WSDG Wireshark Tests Quick Start to README.test and add a link. Change-Id: Id4105a6b1e95407ebf69b871c785c68f9ae26368 Reviewed-on: https://code.wireshark.org/review/31677 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-01-22test: enable GUI tests on Linux, headlessPeter Wu1-3/+15
This will enable four tests in case_wireshark_capture on Linux, two of them require --capture-interface to be specified. To enable headless mode, QT_QPA_PLATFORM=minimal is set. Unfortunately this option causes a null pointer dereference crash on macOS and it also fails on Windows (cause not investigated). So limit it to Linux for now. Change-Id: Id05364571b2c9da38434e611d92642a1177700df Reviewed-on: https://code.wireshark.org/review/31664 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-01-21test: fail tests when programs are missingPeter Wu1-5/+11
Building only a subset of programs is not a very common situation, it is more likely that some feature was accidentally disabled. For that reason, fail tests by default unless a program is explicitly permitted to be missing. The '-v' test is now dropped from the Travis tests, the sole reason of adding it was to see which tests got (accidentally) skipped. Change-Id: I725f4508541d8ed980e17d69fb7aee1ad2875d73 Reviewed-on: https://code.wireshark.org/review/31660 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-01-04test: assume binaries in $PWD\run\RelWithDebInfo by defaultPeter Wu1-1/+4
Avoid the need to set `pytest --program-path` in the common case. Change-Id: I3b237e47eee741decb62a74b733110040aa26673 Reviewed-on: https://code.wireshark.org/review/31348 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-12-29Add support for RSA decryption using PKCS #11 tokensPeter Wu1-0/+2
Add support for loading RSA private key files from PKCS #11 tokens, identified by PKCS #11 URIs. Add a new 'pkcs11_libs' UAT which can dynamically load PKCS #11 provider libraries that are not found by p11-kit. The configuration GUI will need additional code to discover available PKCS #11 tokens and will be added later. This feature requires GnuTLS 3.4 with PKCS #11 support, so Windows, macOS via Homebrew, Ubuntu 16.04, Debian Stretch. Not supported: RHEL7. Currently macOS via official packages disables PKCS #11 support, so that will also not work. Change-Id: I20646bfd69c6bd13c8c2d27cb65c164a4b0b7a66 Reviewed-on: https://code.wireshark.org/review/30855 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-12-29test: add tests for Unicode paths in Lua and tshark -G foldersPeter Wu1-1/+19
Check for potential Unicode-related problems on Windows. Change-Id: I147c07749c5073a9ae00f07914dd80347d17c40f Ping-Bug: 15118 Reviewed-on: https://code.wireshark.org/review/31154 Tested-by: Petri Dish Buildbot Petri-Dish: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-30test: skip tests when GnuTLS is unavailablePeter Wu1-0/+1
GnuTLS is an optional dependency, allow tests to run without it. Change-Id: Ib1bd7beaf1d885a157a0e1a630ccc4fbc8786af1 Reviewed-on: https://code.wireshark.org/review/30839 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-20editcap: add --inject-secrets optionPeter Wu1-0/+5
Add a new option to insert decryption secrets into a pcapng file. Change-Id: I0e024585cac9a8a328e88d32f9eb03d37d350e2a Ping-Bug: 15252 Reviewed-on: https://code.wireshark.org/review/30693 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-16test: finalize suite_capture conversion to fixtures, drop config.pyPeter Wu1-12/+31
Convert the old start_pinging routine to use pytest fixtures, rewriting it to enable a different generator that uses (for example) UDP. Remove the config module since it is no longer neded. Change-Id: Ic4727157faab084b41144e8f16ea44f59c9037d8 Reviewed-on: https://code.wireshark.org/review/30659 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-11-16test: convert capture tests to use fixtures, fix tests without dumpcapPeter Wu1-5/+53
Add a new --capture-interface option to pytest, similar to test.py. It will grab some Ethernet interface on Windows. An empty value overrides this and disables capture tests. Remove the test.py --enable-capture option since that is implied by the --capture-interface option. Port the `test.py --program-path` option to pytest and additionally make the pytest look in the current working directory if neither WS_BIN_PATH nor --program-path are specified. Drop config.setProgramPath, this allows tests to be run even if not all binaries are available. With all capture tests converted to fixtures, it is now possible to run tests when Wireshark is not built with libpcap as tests that depend on cmd_dumpcap (or capture_interface) will be skipped. Bug: 14949 Change-Id: Ie802c07904936de4cd30a4c68b6a5139e6680fbd Reviewed-on: https://code.wireshark.org/review/30656 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-11-15test: convert suite_dfilter to use fixturesPeter Wu1-6/+6
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 Wu1-1/+0
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 Wu1-1/+6
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 Wu1-0/+8
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-09test: make it possible to use pytest-style test fixturesPeter Wu1-0/+174
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>