aboutsummaryrefslogtreecommitdiffstats
path: root/tools/dftestlib
AgeCommit message (Collapse)AuthorFilesLines
2018-05-04Test: Add dftest to our tests.Gerald Combs19-1192/+0
Move the dfilter tests and captures from tools to test. Change-Id: I2e6a6cc1d383c985ba07c76c93ae1c57d3c8f84c Reviewed-on: https://code.wireshark.org/review/27339 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-04-25dfilter: fix memleaks with functions and slice operatorPeter Wu2-1/+12
Running tools/dfilter-test.py with LSan enabled resulted in 38 test failures due to memory leaks from "fvalue_new". Problematic dfilters: - Return values from functions, e.g. `len(data.data) > 8` (instruction CALL_FUNCTION invoking functions from epan/dfilter/dfunctions.c) - Slice operator: `data.data[1:2] == aa:bb` (function mk_range) These values end up in "registers", but as some values (from READ_TREE) reference the proto tree, a new tracking flag ("owns_memory") is added. Add missing tests for some functions and try to improve documentation. Change-Id: I28e8cf872675d0a81ea7aa5fac7398257de3f47b Reviewed-on: https://code.wireshark.org/review/27132 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-04-18dfilter: make spaces around ".." optional in display filterPeter Wu1-2/+7
For numeric values such as port numbers, "4430..4434" looks more natural than "4430 .. 4434", so support that. To make this possible, the display filter syntax needs to be restricted. Assume that neither field names nor values can contain "..". The display filter `data contains ..` will now be considered a syntax error and must be written as `data contains ".."` instead. More generally, all values that contain ".." must be quoted. Other than the ".." restriction, the scanner deliberately accepts more characters that can potentially form invalid input. This is to prevent accidentally splitting input in multiple tokens. For example, "9.2." in "frame.time_delta in {9.2.}" is currently parsed as one token and then rejected because it cannot be parsed as time. If the scanner was made stricter, it could treat it as two tokens (floats), "9." and "2." which has different meaning for the set membership operator. An unhandled edge case is "1....2" which is parsed as "1 .. .. 2" but could have been parsed as "1. .. .2" instead. A float with trailing dots followed by ".." seems sufficiently weird, so rejection is fine. Ping-Bug: 14180 Change-Id: Ibad8e851b49346c9d470f09d5d6a54defa21bcb9 Reviewed-on: https://code.wireshark.org/review/26960 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-04-18dfilter: add range support to set membership operator ("f in {x .. y}")Peter Wu1-0/+42
Allow "tcp.srcport in {1662 1663 1664}" to be abbreviated to "tcp.srcport in {1662 .. 1664}". The range operator is supported for any field value which supports the "<=" and "=>" operators and thus works for integers, IP addresses, etc. The naive mapping "tcp.srcport >= 1662 and tcp.srcport <= 1664" is not used because it does not have the intended effect with fields that have multiple occurrences (e.g. tcp.port). Each condition could be satisfied by an other value. Therefore a new DVFM instruction (ANY_IN_RANGE) is added to test the range condition against each individual field value. Bug: 14180 Change-Id: I53c2d0f9bc9d4f0ffaabde9a83442122965c95f7 Reviewed-on: https://code.wireshark.org/review/26945 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-04-15dfilter-test.py: document parallelization supportPeter Wu1-2/+2
Tests are independent and can be run in parallel using pytest-xdist (https://github.com/pytest-dev/pytest-xdist), document it. While at it, allow running the tests from other directories. Change-Id: I3e55c549669f7d59d35cd64eca53680cea6dec2d Reviewed-on: https://code.wireshark.org/review/26943 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-04-15dftestlib: remove unnecessary execute bitPeter Wu18-0/+0
tools/dfilter-test.py is the main script, others are imported as needed. Change-Id: I5ce7bd298b90d3e16c83c6b219c2717ccbcf2a10 Reviewed-on: https://code.wireshark.org/review/26944 Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-03-07spdx: more licenses converted.Dario Lombardo16-208/+16
Change-Id: I3861061ec261e63b23621799e020e811ed78a343 Reviewed-on: https://code.wireshark.org/review/26333 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-03-07More licenses converted to SPDX.Dario Lombardo2-26/+2
Change-Id: Id4f987dcdacf06622d70263f4659a4400e30dc39 Reviewed-on: https://code.wireshark.org/review/26332 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-06-20IPv4/IPv6 display filter fixes and testingSilvio Gissi1-2/+90
Removed 'len' from IPv4, not needed Added more test coverage for IPv6 in dftestlib Change-Id: I1ca80e2525f32f6095ad73352baba733f4694ced Reviewed-on: https://code.wireshark.org/review/22260 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-06-19Added IPv4 byte slicingSilvio Gissi1-0/+14
Change-Id: I3bdca418801305d71b33fa07396497d82ad06e33 Reviewed-on: https://code.wireshark.org/review/22212 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-11-10Make the dfilter time tests work regardless of what time zone the tests areJeff Morriss1-18/+23
being run in. Do this by forcing the time zone to be UTC (by modifying the environment). Change-Id: I13c47deada82b55a464006f9c3cc60115b2e4f20 Reviewed-on: https://code.wireshark.org/review/11378 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-10-30Add a few new negative dfilter tests.Jeff Morriss1-2/+17
For example, to ensure that "field = value" is not a valid dfilter (as was recently a problem). As suggested by Alexis. Change-Id: Ibf498c30325579e3d5474bb2d397f1bbb9ffc07f Reviewed-on: https://code.wireshark.org/review/11339 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-03-25dfilter-test.py: add OOT support and Python 3 compatPeter Wu2-10/+12
Support WS_BIN_PATH and SOURCE_DIR (modelled after test/config.sh) to support out-of-tree builds (including cmake). Add Python 3 support and mention this in the documentation. Tested with Python 2.7.9, 3.2.6, 3.4.3: WS_BIN_PATH=/tmp/wsbuild/run SOURCE_DIR=/tmp/wireshark \ tools/dfilter-test.py testBytesIPv6 (2.7.9 and 3.4.3 were also tested fully, but some cases seem to fail even before this patch. 2.5.6 and 2.6.6 do not work because the unittest module is outdated.) Change-Id: I13074579f6f74206edb5cd7be8e7a8406de49c56 Reviewed-on: https://code.wireshark.org/review/7793 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-31Continue to remove $Id$ from top of fileAlexis La Goutte18-36/+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>
2013-10-27Fix up some more svn properties.Jeff Morriss18-18/+18
svn path=/trunk/; revision=52882
2013-10-06Add license text to dftestlib files, and point to theGilbert Ramirez18-15/+320
capture files that someone renamed from *.cap to *.pcap. svn path=/trunk/; revision=52414
2013-09-18Missed one file from dfilter-test.pyGilbert Ramirez1-0/+58
Updated license in ancient tool. svn path=/trunk/; revision=52137
2013-09-18Update dfilter-test.py to use a much more modern test harness,Gilbert Ramirez17-0/+899
the "unittest" module that comes with Python. Specifically, this takes advantage of a couple of features in the "unittest" in Python 2.7. The tests are all the same as before, but much better managed. This is in preparation for some work on the display filter code. svn path=/trunk/; revision=52136