aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2018-07-26 23:47:20 +0200
committerPeter Wu <peter@lekensteyn.nl>2018-07-26 23:16:04 +0000
commit9ca8a9f87c4e340f7e4d44c4c32dfc74afec29fa (patch)
treefb4c59c3a0d254ac15311c8a34a64f68182fe914
parent99242affde4b51cd62f4b6a822fa7f5941e1c3f7 (diff)
test: do not silently ignore feature detection failures
When ASAN memleak detection is enabled, any memory leak would result in an exception and subsequently all features are marked as missing. With the default profile, any Lua plugin or certain configurations could cause a memory leak. To avoid such interference, set the configuration path to a dummy location and warn whenever an error happens nonetheless. Do not call setProgramPath() immediately, there is no "tshark" binary in the current working directory anymore. Rely on test.py to set the path. Change-Id: Idccc3d68eb6f6bb64d3a0b32897acecc65e0dfb6 Reviewed-on: https://code.wireshark.org/review/28867 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
-rw-r--r--test/config.py38
1 files changed, 19 insertions, 19 deletions
diff --git a/test/config.py b/test/config.py
index 21cc90fd11..240875140c 100644
--- a/test/config.py
+++ b/test/config.py
@@ -9,6 +9,7 @@
#
'''Configuration'''
+import logging
import os
import os.path
import re
@@ -95,25 +96,25 @@ def getTsharkInfo():
global have_kerberos
global have_libgcrypt16
global have_libgcrypt17
- have_lua = False
- have_nghttp2 = False
- have_kerberos = False
- have_libgcrypt16 = False
- have_libgcrypt17 = False
+ if not cmd_tshark:
+ logging.warning("tshark binary is not yet set")
+ return
try:
- tshark_v_blob = str(subprocess.check_output((cmd_tshark, '--version'), stderr=subprocess.PIPE))
- tshark_v = ' '.join(tshark_v_blob.splitlines())
- if re.search('with +Lua', tshark_v):
- have_lua = True
- if re.search('with +nghttp2', tshark_v):
- have_nghttp2 = True
- if re.search('(with +MIT +Kerberos|with +Heimdal +Kerberos)', tshark_v):
- have_kerberos = True
- gcry_m = re.search('with +Gcrypt +([0-9]+\.[0-9]+)', tshark_v)
- have_libgcrypt16 = gcry_m and float(gcry_m.group(1)) >= 1.6
- have_libgcrypt17 = gcry_m and float(gcry_m.group(1)) >= 1.7
- except:
- pass
+ tshark_v = subprocess.check_output(
+ (cmd_tshark, '--version'),
+ stderr=subprocess.PIPE,
+ universal_newlines=True,
+ env={'WIRESHARK_CONFIG_DIR': '/dummy/non/existing'}
+ ).replace('\n', ' ')
+ except subprocess.CalledProcessError as e:
+ logging.warning("Failed to detect tshark features: %s", e)
+ tshark_v = ''
+ have_lua = bool(re.search('with +Lua', tshark_v))
+ have_nghttp2 = bool(re.search('with +nghttp2', tshark_v))
+ have_kerberos = bool(re.search('(with +MIT +Kerberos|with +Heimdal +Kerberos)', tshark_v))
+ gcry_m = re.search('with +Gcrypt +([0-9]+\.[0-9]+)', tshark_v)
+ have_libgcrypt16 = gcry_m and float(gcry_m.group(1)) >= 1.6
+ have_libgcrypt17 = gcry_m and float(gcry_m.group(1)) >= 1.7
def getDefaultCaptureInterface():
'''Choose a default capture interface for our platform. Currently Windows only.'''
@@ -255,4 +256,3 @@ if sys.platform.startswith('win32') or sys.platform.startswith('darwin'):
# Initialize ourself.
getPingCommand()
-setProgramPath(os.path.curdir)