aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2018-04-13 23:38:15 +0200
committerAnders Broman <a.broman58@gmail.com>2018-04-15 05:34:41 +0000
commit82e8aa33a7812e8917d8e9187e0be4d2333b43b0 (patch)
tree0347b775a3081a8ad3daa0e47bb4b4557d0d85ec
parent0d31ec328f2c523cfc4655f1674a5f0eae80923f (diff)
downloadwireshark-82e8aa33a7812e8917d8e9187e0be4d2333b43b0.tar.gz
wireshark-82e8aa33a7812e8917d8e9187e0be4d2333b43b0.tar.bz2
wireshark-82e8aa33a7812e8917d8e9187e0be4d2333b43b0.zip
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>
-rw-r--r--.gitignore1
-rw-r--r--doc/README.display_filter13
-rw-r--r--tools/dftestlib/dftest.py4
3 files changed, 13 insertions, 5 deletions
diff --git a/.gitignore b/.gitignore
index e3e54275d6..3137e6fe7d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -261,3 +261,4 @@ packaging/portableapps/appinfo.ini
packaging/rpm/SPECS/wireshark.spec
vgcore.*
Wireshark.*
+.pytest_cache/
diff --git a/doc/README.display_filter b/doc/README.display_filter
index 85ce9de6b3..4a1ca1cbf7 100644
--- a/doc/README.display_filter
+++ b/doc/README.display_filter
@@ -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.
diff --git a/tools/dftestlib/dftest.py b/tools/dftestlib/dftest.py
index 4b54df1428..ba7ceabe3b 100644
--- a/tools/dftestlib/dftest.py
+++ b/tools/dftestlib/dftest.py
@@ -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)
@classmethod
def tearDownClass(cls):