dfilter-test.py: document parallelization support

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>
Peter Wu 2018-04-13 23:38:15 +02:00 committed by Anders Broman
parent 0d31ec328f
commit 82e8aa33a7
3 changed files with 13 additions and 5 deletions

.gitignore vendored
View File

@ -261,3 +261,4 @@ packaging/portableapps/appinfo.ini

View File

@ -599,7 +599,14 @@ $ ./tools/dfilter-test.py testTVB
# Run the the "test_contains_1" test from testTVB
$ ./tools/dfilter-test.py testTVB.test_contains_1
Note that dfilter-test.py should be run from the top of the
Wireshark distribution, so it knows where to find the default
tshark executable.
# For faster, parallel tests, install the "pytest-xdist" first
# (for example, using "pip install pytest-xdist"), then:
$ pytest -nauto tools/dfilter-test.py
# Run all tests in "testTVB", in parallel:
$ pytest -nauto tools/dfilter-test.py -k testTVB
By default dfilter-test.py assumes that the "tshark" binary is located in the
current working directory. If that is not the case, set the environment variable
WS_BIN_PATH to correct directory.

View File

@ -28,8 +28,8 @@ class DFTest(unittest.TestCase):
# names the trace file to use for the tests. It *should*
# reside in dftestfiles
assert not os.path.isabs(cls.trace_file)
cls.trace_file = os.path.join(os.getenv("SOURCE_DIR", "."), "tools",
"dftestfiles", cls.trace_file)
toolsdir = os.path.dirname(os.path.dirname(__file__))
cls.trace_file = os.path.join(toolsdir, "dftestfiles", cls.trace_file)
def tearDownClass(cls):