diff options
author | Peter Wu <peter@lekensteyn.nl> | 2018-11-30 01:31:32 +0100 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2018-11-30 06:11:06 +0000 |
commit | ee61bc739e133ca2b07bc51d1baa3249265193dd (patch) | |
tree | 21b40ad794b1217b35d11750ec2058c7acff0067 /test/suite_io.py | |
parent | 9c0beafe44480b352bb4af56754143c9108a54fa (diff) |
test: use assertRun instead of runProcess where possible
The case_decrypt_tls.test_tls_rsa_pq test is unexpectedly passing when
GnuTLS is disabled. It checks for '/' in the output, but that also
matches an error message. Use assertRun here and pretty much everywhere
else to catch such issues. Remove a few redundant returncode checks.
Change-Id: I0f9d1dadc0ca73eef9cffb3e2f452aa7c8395c95
Reviewed-on: https://code.wireshark.org/review/30838
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'test/suite_io.py')
-rw-r--r-- | test/suite_io.py | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/test/suite_io.py b/test/suite_io.py index 9b0fa9cf42..be8fed715a 100644 --- a/test/suite_io.py +++ b/test/suite_io.py @@ -40,22 +40,19 @@ def check_io_4_packets(self, capture_file, cmd=None, from_stdin=False, to_stdout # cat -B "${CAPTURE_DIR}dhcp.pcap" | $DUT -r - -w ./testout.pcap 2>./testout.txt cat_dhcp_cmd = subprocesstest.cat_dhcp_command('cat') stdin_cmd = '{0} | "{1}" -r - -w "{2}"'.format(cat_dhcp_cmd, cmd, testout_file) - io_proc = self.runProcess(stdin_cmd, shell=True) + io_proc = self.assertRun(stdin_cmd, shell=True) elif to_stdout: # $DUT -r "${CAPTURE_DIR}dhcp.pcap" -w - > ./testout.pcap 2>./testout.txt stdout_cmd = '"{0}" -r "{1}" -w - > "{2}"'.format(cmd, capture_file('dhcp.pcap'), testout_file) - io_proc = self.runProcess(stdout_cmd, shell=True) + io_proc = self.assertRun(stdout_cmd, shell=True) else: # direct->direct # $DUT -r "${CAPTURE_DIR}dhcp.pcap" -w ./testout.pcap > ./testout.txt 2>&1 - io_proc = self.runProcess((cmd, + io_proc = self.assertRun((cmd, '-r', capture_file('dhcp.pcap'), '-w', testout_file, )) - io_returncode = io_proc.returncode - self.assertEqual(io_returncode, 0) self.assertTrue(os.path.isfile(testout_file)) - if (io_returncode == 0): - self.checkPacketCount(4) + self.checkPacketCount(4) @fixtures.mark_usefixtures('test_env') @@ -86,8 +83,5 @@ class case_rawshark_io(subprocesstest.SubprocessTestCase): testout_file = self.filename_from_id(testout_pcap) raw_dhcp_cmd = subprocesstest.cat_dhcp_command('raw') rawshark_cmd = '{0} | "{1}" -r - -n -dencap:1 -R "udp.port==68"'.format(raw_dhcp_cmd, cmd_rawshark) - rawshark_proc = self.runProcess(rawshark_cmd, shell=True) - rawshark_returncode = rawshark_proc.returncode - self.assertEqual(rawshark_returncode, 0) - if (rawshark_returncode == 0): - self.assertTrue(self.diffOutput(rawshark_proc.stdout_str, io_baseline_str, 'rawshark', baseline_file)) + rawshark_proc = self.assertRun(rawshark_cmd, shell=True) + self.assertTrue(self.diffOutput(rawshark_proc.stdout_str, io_baseline_str, 'rawshark', baseline_file)) |