aboutsummaryrefslogtreecommitdiffstats
path: root/test/suite_clopts.py
diff options
context:
space:
mode:
authorDario Lombardo <lomato@gmail.com>2019-04-06 00:29:51 +0200
committerPeter Wu <peter@lekensteyn.nl>2019-04-12 09:23:00 +0000
commitc442ee056bc46bcda59e473c00d5741ea90a1453 (patch)
treec6c9d060e1741142dcee41bef8ade81289c9c66f /test/suite_clopts.py
parentc1dcf8c3faa9c3646a78bb79be7f66ba9f78192b (diff)
extcap_parser: remove G_REGEX_RAW from line parsing.
Check for utf8 valid line instead. Add a testcase that shows how the former code was buggy on special characters extcap sentences. Bug: 15668 Change-Id: Ic045c4791388af98705916e6ea84be8fc9b3c5b8 Reviewed-on: https://code.wireshark.org/review/32754 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'test/suite_clopts.py')
-rw-r--r--test/suite_clopts.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/suite_clopts.py b/test/suite_clopts.py
index a0fe07bbf7..466ab62ea9 100644
--- a/test/suite_clopts.py
+++ b/test/suite_clopts.py
@@ -10,10 +10,12 @@
'''Command line option tests'''
import json
+import sys
import os.path
import subprocess
import subprocesstest
import fixtures
+import shutil
#glossaries = ('fields', 'protocols', 'values', 'decodes', 'defaultprefs', 'currentprefs')
@@ -279,3 +281,27 @@ class case_tshark_z_expert(subprocesstest.SubprocessTestCase):
self.assertFalse(self.grepOutput('Errors'))
self.assertFalse(self.grepOutput('Warns'))
self.assertFalse(self.grepOutput('Chats'))
+
+
+@fixtures.mark_usefixtures('test_env')
+@fixtures.uses_fixtures
+class case_tshark_extcap(subprocesstest.SubprocessTestCase):
+ def test_tshark_extcap_interfaces(self, cmd_tshark, program_path):
+ # Script extcaps don't work with the current code on windows.
+ # https://www.wireshark.org/docs/wsdg_html_chunked/ChCaptureExtcap.html
+ # TODO: skip this test until it will get fixed.
+ if sys.platform == 'win32':
+ self.skipTest('FIXME extcap .py scripts needs special treatment on Windows')
+ extcap_tool = 'sampleif.py'
+ target_dir = os.path.join(program_path, 'extcap')
+ target_file = os.path.join(target_dir, extcap_tool)
+ source_file = os.path.join(os.path.dirname(__file__), extcap_tool)
+ os.makedirs(target_dir, exist_ok=True)
+ shutil.copy2(source_file, target_file)
+ # Ensure the test extcap_tool is properly loaded
+ self.assertRun((cmd_tshark, '-D'))
+ self.assertEqual(1, self.countOutput('sampleif'))
+ # Ensure tshark lists 2 interfaces in the preferences
+ self.assertRun((cmd_tshark, '-G', 'currentprefs'))
+ self.assertEqual(2, self.countOutput('extcap.sampleif.test'))
+ os.remove(target_file)