aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xdebian/rules4
-rw-r--r--docbook/wsdg_src/WSDG_chapter_tests.asciidoc3
-rw-r--r--test/config.py2
-rw-r--r--test/suite_unittests.py59
4 files changed, 68 insertions, 0 deletions
diff --git a/debian/rules b/debian/rules
index ced9cb339d..9add94da3d 100755
--- a/debian/rules
+++ b/debian/rules
@@ -35,6 +35,10 @@ override_dh_auto_build:
$(MAKE) -C $(CURDIR)/obj-* user_guide_html developer_guide_html
# fix links in documentation
sed -i "s|$(CURDIR)/docbook|..|" obj-*/docbook/ws*g_html_chunked/*.html
+ifneq ($(filter $(DEB_BUILD_OPTIONS),nocheck),)
+ # Required for the "unittests" suite.
+ $(MAKE) -C $(CURDIR)/obj-* test-programs
+endif
override_dh_strip:
dh_strip --dbg-package=wireshark-dbg
diff --git a/docbook/wsdg_src/WSDG_chapter_tests.asciidoc b/docbook/wsdg_src/WSDG_chapter_tests.asciidoc
index 092ebe88cc..4e90809736 100644
--- a/docbook/wsdg_src/WSDG_chapter_tests.asciidoc
+++ b/docbook/wsdg_src/WSDG_chapter_tests.asciidoc
@@ -13,6 +13,9 @@ bugs as Wireshark grows and evolves.
=== Quick Start
+Before running any tests you should build the “test-programs” target. It
+is required for the “utittests” suite.
+
The main testing script is `test.py`. It will attempt to test as much as
possible by default, including packet capture. This means that you will
probably either have to supply a capture interface (`--capture-interface
diff --git a/test/config.py b/test/config.py
index 1dc38277ee..51531b8665 100644
--- a/test/config.py
+++ b/test/config.py
@@ -31,6 +31,7 @@ can_capture = False
capture_interface = None
# Our executables
+program_path = None
# Strings
cmd_capinfos = None
cmd_dumpcap = None
@@ -60,6 +61,7 @@ capture_dir = os.path.join(this_dir, 'captures')
config_dir = os.path.join(this_dir, 'config')
key_dir = os.path.join(this_dir, 'keys')
lua_dir = os.path.join(this_dir, 'lua')
+tools_dir = os.path.join(this_dir, '..', 'tools')
def canCapture():
# XXX This appears to be evaluated at the wrong time when called
diff --git a/test/suite_unittests.py b/test/suite_unittests.py
new file mode 100644
index 0000000000..0c4c3fcc43
--- /dev/null
+++ b/test/suite_unittests.py
@@ -0,0 +1,59 @@
+#
+# -*- coding: utf-8 -*-
+# Wireshark tests
+# By Gerald Combs <gerald@wireshark.org>
+#
+# Ported from a set of Bash scripts which were copyright 2005 Ulf Lamping
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+'''EPAN unit tests'''
+
+import config
+import os.path
+import subprocesstest
+import sys
+import unittest
+
+class case_unittests(subprocesstest.SubprocessTestCase):
+ def test_unit_exntest(self):
+ '''exntest'''
+ self.assertRun(os.path.join(config.program_path, 'exntest'))
+
+ def test_unit_oids_test(self):
+ '''oids_test'''
+ self.assertRun(os.path.join(config.program_path, 'oids_test'))
+
+ def test_unit_reassemble_test(self):
+ '''reassemble_test'''
+ self.assertRun(os.path.join(config.program_path, 'reassemble_test'))
+
+ def test_unit_tvbtest(self):
+ '''tvbtest'''
+ self.assertRun(os.path.join(config.program_path, 'tvbtest'))
+
+ def test_unit_wmem_test(self):
+ '''wmem_test'''
+ self.assertRun((os.path.join(config.program_path, 'wmem_test'),
+ '--verbose'
+ ))
+
+ def test_unit_wmem_test(self):
+ '''wmem_test'''
+ self.assertRun((os.path.join(config.program_path, 'wmem_test'),
+ '--verbose'
+ ))
+
+ def test_unit_ftsanity(self):
+ '''ftsanity.py'''
+ fts_cmd = [
+ os.path.join(config.tools_dir, 'ftsanity.py'),
+ config.cmd_tshark
+ ]
+ if sys.executable:
+ fts_cmd.insert(0, sys.executable)
+ self.assertRun(fts_cmd)
+
+ def test_unit_fieldcount(self):
+ '''fieldcount'''
+ self.assertRun((config.cmd_tshark, '-G', 'fieldcount'))