Test: More fixes and updates.
Move UAT file creation to config.py. Run the text2pcap and some of the clopts tests under our default environment. Use "in" instead of "has_key". Change-Id: Ie5c70fb33c29676672bed7bf8205cff0bba77f8a Reviewed-on: https://code.wireshark.org/review/27234 Petri-Dish: Gerald Combs <gerald@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
This commit is contained in:
parent
ed38488211
commit
d25e7c8d91
|
@ -168,6 +168,8 @@ def setUpTestEnvironment():
|
|||
global conf_path
|
||||
global custom_profile_path
|
||||
global test_env
|
||||
|
||||
# Create our directories
|
||||
test_confdir = tempfile.mkdtemp(prefix='wireshark-tests.')
|
||||
home_path = os.path.join(test_confdir, 'home')
|
||||
if sys.platform.startswith('win32'):
|
||||
|
@ -180,6 +182,21 @@ def setUpTestEnvironment():
|
|||
# Test spaces while we're here.
|
||||
custom_profile_path = os.path.join(conf_path, 'profiles', custom_profile_name)
|
||||
os.makedirs(custom_profile_path)
|
||||
|
||||
# Populate our UAT files
|
||||
uat_files = [
|
||||
'80211_keys',
|
||||
'dtlsdecrypttablefile',
|
||||
'esp_sa',
|
||||
'ssl_keys',
|
||||
'c1222_decryption_table',
|
||||
'ikev1_decryption_table',
|
||||
'ikev2_decryption_table',
|
||||
]
|
||||
for uat in uat_files:
|
||||
setUpUatFile(uat)
|
||||
|
||||
# Set up our environment
|
||||
test_env = os.environ.copy()
|
||||
test_env['WIRESHARK_RUN_FROM_BUILD_DIRECTORY'] = '1'
|
||||
test_env[home_env] = home_path
|
||||
|
|
|
@ -180,7 +180,7 @@ class case_tshark_dump_glossaries(subprocesstest.SubprocessTestCase):
|
|||
self.assertTrue(decoded, '{} is not valid UTF-8'.format(glossary))
|
||||
|
||||
def test_tshark_glossary_plugin_count(self):
|
||||
self.runProcess((config.cmd_tshark, '-G', 'plugins'))
|
||||
self.runProcess((config.cmd_tshark, '-G', 'plugins'), env=os.environ.copy())
|
||||
self.assertGreaterEqual(self.countOutput('dissector'), 10, 'Fewer than 10 dissector plugins found')
|
||||
|
||||
|
||||
|
|
|
@ -14,19 +14,6 @@ import os.path
|
|||
import subprocesstest
|
||||
import unittest
|
||||
|
||||
uat_files = [
|
||||
'80211_keys',
|
||||
'dtlsdecrypttablefile',
|
||||
'esp_sa',
|
||||
'ssl_keys',
|
||||
'c1222_decryption_table',
|
||||
'ikev1_decryption_table',
|
||||
'ikev2_decryption_table',
|
||||
]
|
||||
for uat in uat_files:
|
||||
config.setUpUatFile(uat)
|
||||
|
||||
|
||||
class case_decrypt_80211(subprocesstest.SubprocessTestCase):
|
||||
def test_80211_wpa_psk(self):
|
||||
'''IEEE 802.11 WPA PSK'''
|
||||
|
|
|
@ -115,7 +115,7 @@ def check_text2pcap(self, cap_file, file_type, expected_packets=None, expected_d
|
|||
# in the output file are the same as in the input file
|
||||
|
||||
pre_cap_info = check_capinfos_info(self, cap_file)
|
||||
self.assertTrue(encap_to_link_type.has_key(pre_cap_info['encapsulation']))
|
||||
self.assertTrue(pre_cap_info['encapsulation'] in encap_to_link_type)
|
||||
|
||||
self.assertTrue(file_type in file_type_to_testout, 'Invalid file type')
|
||||
|
||||
|
@ -128,7 +128,7 @@ def check_text2pcap(self, cap_file, file_type, expected_packets=None, expected_d
|
|||
cf = cf_path,
|
||||
of = testin_file,
|
||||
)
|
||||
self.assertRun(tshark_cmd, shell=True)
|
||||
self.assertRun(tshark_cmd, shell=True, env=os.environ.copy())
|
||||
|
||||
testout_fname = file_type_to_testout[file_type]
|
||||
testout_file = self.filename_from_id(testout_fname)
|
||||
|
|
Loading…
Reference in New Issue