aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2019-04-19 01:51:03 +0100
committerPeter Wu <peter@lekensteyn.nl>2019-04-19 17:29:03 +0000
commit3f9579e3f5f84262d0f8c849a0f98220fee8d722 (patch)
treea931a947d235ed912671aac3fad71aed7e92d75f /test
parent727aaad3ae99132470ea0a9eba912aea8ef83ef3 (diff)
wsutil: use environment variable WIRESHARK_EXTCAP_DIR when possible
The WIRESHARK_EXTCAP_DIR environment variable is currently only used on Windows, and on UN*X when not running from the build directory. In order to avoid copying the sampleif.py test utility to the program directory, let's prioritize the environment variable over the build directory. Update the outdated comments while at it, the version directory has been removed long time ago. (The comments are based on the one for plugins.) This also fixes the test suite on macOS where the extcap subdirectory is located in the appbundle directory and not the build directory. Change-Id: I329bb233b1dd0b9c1422c2ebd60a6455347e1d62 Reviewed-on: https://code.wireshark.org/review/32890 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Dario Lombardo <lomato@gmail.com> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'test')
-rw-r--r--test/suite_clopts.py18
1 files changed, 8 insertions, 10 deletions
diff --git a/test/suite_clopts.py b/test/suite_clopts.py
index d33143b04e..ed8b5f54e9 100644
--- a/test/suite_clopts.py
+++ b/test/suite_clopts.py
@@ -287,22 +287,20 @@ class case_tshark_z_expert(subprocesstest.SubprocessTestCase):
@fixtures.uses_fixtures
class case_tshark_extcap(subprocesstest.SubprocessTestCase):
# dumpcap dependency has been added to run this test only with capture support
- def test_tshark_extcap_interfaces(self, cmd_tshark, cmd_dumpcap, program_path):
+ def test_tshark_extcap_interfaces(self, cmd_tshark, cmd_dumpcap, test_env, home_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)
+ extcap_dir_path = os.path.join(home_path, 'extcap')
+ os.makedirs(extcap_dir_path)
+ test_env['WIRESHARK_EXTCAP_DIR'] = extcap_dir_path
+ source_file = os.path.join(os.path.dirname(__file__), 'sampleif.py')
+ shutil.copy2(source_file, extcap_dir_path)
# Ensure the test extcap_tool is properly loaded
- self.assertRun((cmd_tshark, '-D'))
+ self.assertRun((cmd_tshark, '-D'), env=test_env)
self.assertEqual(1, self.countOutput('sampleif'))
# Ensure tshark lists 2 interfaces in the preferences
- self.assertRun((cmd_tshark, '-G', 'currentprefs'))
+ self.assertRun((cmd_tshark, '-G', 'currentprefs'), env=test_env)
self.assertEqual(2, self.countOutput('extcap.sampleif.test'))
- os.remove(target_file)