diff options
author | Gerald Combs <gerald@wireshark.org> | 2018-05-01 09:09:27 -0700 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2018-05-01 18:46:13 +0000 |
commit | 74fd56901883d29a68cc2bcb65f2ba44007d4107 (patch) | |
tree | b83b2795148c034ad810dbf56b3b219635832901 /test/suite_text2pcap.py | |
parent | 48ab9adbd5bd1b111acf4e36825a99e280b5411c (diff) |
Test: Fix capinfos output and command paths.
Convert capinfos output to UTF-8 in getCaptureInfo.
Normalize our command paths, otherwise "./run/RelWithDebInfo/..." might
be interpreted as the command "." with flags "/run", "/RelWithDebInfo",
etc. on Windows.
Change-Id: Ib7336a016db3ee0805739fc44913cb9c6895aaad
Reviewed-on: https://code.wireshark.org/review/27239
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'test/suite_text2pcap.py')
-rw-r--r-- | test/suite_text2pcap.py | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/test/suite_text2pcap.py b/test/suite_text2pcap.py index 3ee84f2b13..1a1534515f 100644 --- a/test/suite_text2pcap.py +++ b/test/suite_text2pcap.py @@ -78,17 +78,18 @@ def check_capinfos_info(self, cap_file): } capinfos_out = self.getCaptureInfo(capinfos_args=('-t', '-E', '-c', '-d', '-M'), cap_file=cap_file) - for sp_key in str_pats: - str_pat = '{}:\s+([\S ]+)'.format(str_pats[sp_key]) - str_res = re.search(str_pat, capinfos_out) - self.assertTrue(str_res is not None, 'Failed to generate {}'.format(sp_key)) - cap_info[sp_key] = str_res.group(1) - - for ip_key in int_pats: - int_pat = '{}:\s+(\d+)'.format(int_pats[ip_key]) - int_res = re.search(int_pat, capinfos_out) - self.assertTrue(int_res is not None, 'Failed to generate {}'.format(ip_key)) - cap_info[ip_key] = int(int_res.group(1)) + for ci_line in capinfos_out.splitlines(): + for sp_key in str_pats: + str_pat = '{}:\s+([\S ]+)'.format(str_pats[sp_key]) + str_res = re.search(str_pat, ci_line) + if str_res is not None: + cap_info[sp_key] = str_res.group(1) + + for ip_key in int_pats: + int_pat = '{}:\s+(\d+)'.format(int_pats[ip_key]) + int_res = re.search(int_pat, ci_line) + if int_res is not None: + cap_info[ip_key] = int(int_res.group(1)) return cap_info |