diff options
author | Gerald Combs <gerald@wireshark.org> | 2018-04-30 17:12:20 -0700 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2018-05-01 00:37:41 +0000 |
commit | d25e7c8d91b46fc038f5dc9f64faf11927de0b06 (patch) | |
tree | bb6db38ef74584579babcd60708aa6ffdc06bef8 /test | |
parent | ed384882117696d4ff110e46bc60ebe9ac304974 (diff) |
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>
Diffstat (limited to 'test')
-rw-r--r-- | test/config.py | 17 | ||||
-rw-r--r-- | test/suite_clopts.py | 2 | ||||
-rw-r--r-- | test/suite_decryption.py | 13 | ||||
-rw-r--r-- | test/suite_text2pcap.py | 4 |
4 files changed, 20 insertions, 16 deletions
diff --git a/test/config.py b/test/config.py index 51531b8665..b38bf7ceb1 100644 --- a/test/config.py +++ b/test/config.py @@ -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 diff --git a/test/suite_clopts.py b/test/suite_clopts.py index a5312c4ad5..894a3ceef7 100644 --- a/test/suite_clopts.py +++ b/test/suite_clopts.py @@ -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') diff --git a/test/suite_decryption.py b/test/suite_decryption.py index 5813456e5f..a007b6f8e7 100644 --- a/test/suite_decryption.py +++ b/test/suite_decryption.py @@ -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''' diff --git a/test/suite_text2pcap.py b/test/suite_text2pcap.py index baf2ea0c18..3ee84f2b13 100644 --- a/test/suite_text2pcap.py +++ b/test/suite_text2pcap.py @@ -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) |