diff options
author | Gerald Combs <gerald@wireshark.org> | 2018-04-27 10:35:17 -0700 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2018-04-27 19:52:04 +0000 |
commit | e6d129bf2382b9f0261c813c5b501db8911b254b (patch) | |
tree | 46d23bb44ca6621efbabb2ada0c65854b2d68b6a /test/suite_clopts.py | |
parent | 9b3be1711f2a92ed4c59e32961d4d19b8f593d94 (diff) |
Test: Add fileformats and I/O.
Add the fileformats and I/O suites. Move some more common code to
subprocesstest.py and add a diffOutput method.
Change-Id: I2ec34e46539022bdce78520645fdca6dfc1a8c1a
Reviewed-on: https://code.wireshark.org/review/27183
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'test/suite_clopts.py')
-rw-r--r-- | test/suite_clopts.py | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/test/suite_clopts.py b/test/suite_clopts.py index 3516d5fa36..a5312c4ad5 100644 --- a/test/suite_clopts.py +++ b/test/suite_clopts.py @@ -1,4 +1,5 @@ # +# -*- coding: utf-8 -*- # Wireshark tests # By Gerald Combs <gerald@wireshark.org> # @@ -17,6 +18,7 @@ import unittest #glossaries = ('fields', 'protocols', 'values', 'decodes', 'defaultprefs', 'currentprefs') glossaries = ('decodes', 'values') +testout_pcap = 'testout.pcap' class case_dumpcap_invalid_chars(subprocesstest.SubprocessTestCase): # XXX Should we generate individual test functions instead of looping? @@ -51,7 +53,8 @@ class case_dumpcap_capture_clopts(subprocesstest.SubprocessTestCase): self.skipTest('Test requires capture privileges and an interface.') invalid_filter = '__invalid_protocol' # $DUMPCAP -f 'jkghg' -w './testout.pcap' > ./testout.txt 2>&1 - self.runProcess((config.cmd_dumpcap, '-f', invalid_filter, '-w', 'testout.pcap' )) + testout_file = self.filename_from_id(testout_pcap) + self.runProcess((config.cmd_dumpcap, '-f', invalid_filter, '-w', testout_file )) self.assertTrue(self.grepOutput('Invalid capture filter "' + invalid_filter + '" for interface')) def test_dumpcap_invalid_interface_name(self): @@ -60,7 +63,8 @@ class case_dumpcap_capture_clopts(subprocesstest.SubprocessTestCase): self.skipTest('Test requires capture privileges and an interface.') invalid_interface = '__invalid_interface' # $DUMPCAP -i invalid_interface -w './testout.pcap' > ./testout.txt 2>&1 - self.runProcess((config.cmd_dumpcap, '-i', invalid_interface, '-w', 'testout.pcap')) + testout_file = self.filename_from_id(testout_pcap) + self.runProcess((config.cmd_dumpcap, '-i', invalid_interface, '-w', testout_file)) self.assertTrue(self.grepOutput('The capture session could not be initiated')) def test_dumpcap_invalid_interface_index(self): @@ -69,7 +73,8 @@ class case_dumpcap_capture_clopts(subprocesstest.SubprocessTestCase): self.skipTest('Test requires capture privileges and an interface.') invalid_index = '0' # $DUMPCAP -i 0 -w './testout.pcap' > ./testout.txt 2>&1 - self.runProcess((config.cmd_dumpcap, '-i', invalid_index, '-w', 'testout.pcap')) + testout_file = self.filename_from_id(testout_pcap) + self.runProcess((config.cmd_dumpcap, '-i', invalid_index, '-w', testout_file)) self.assertTrue(self.grepOutput('There is no interface with that adapter index')) @@ -119,7 +124,8 @@ class case_tshark_capture_clopts(subprocesstest.SubprocessTestCase): self.skipTest('Test requires capture privileges and an interface.') invalid_filter = '__invalid_protocol' # $TSHARK -f 'jkghg' -w './testout.pcap' > ./testout.txt 2>&1 - self.runProcess((config.cmd_tshark, '-f', invalid_filter, '-w', 'testout.pcap' )) + testout_file = self.filename_from_id(testout_pcap) + self.runProcess((config.cmd_tshark, '-f', invalid_filter, '-w', testout_file )) self.assertTrue(self.grepOutput('Invalid capture filter "' + invalid_filter + '" for interface')) def test_tshark_invalid_interface_name(self): @@ -128,7 +134,8 @@ class case_tshark_capture_clopts(subprocesstest.SubprocessTestCase): self.skipTest('Test requires capture privileges and an interface.') invalid_interface = '__invalid_interface' # $TSHARK -i invalid_interface -w './testout.pcap' > ./testout.txt 2>&1 - self.runProcess((config.cmd_tshark, '-i', invalid_interface, '-w', 'testout.pcap')) + testout_file = self.filename_from_id(testout_pcap) + self.runProcess((config.cmd_tshark, '-i', invalid_interface, '-w', testout_file)) self.assertTrue(self.grepOutput('The capture session could not be initiated')) def test_tshark_invalid_interface_index(self): @@ -137,7 +144,8 @@ class case_tshark_capture_clopts(subprocesstest.SubprocessTestCase): self.skipTest('Test requires capture privileges and an interface.') invalid_index = '0' # $TSHARK -i 0 -w './testout.pcap' > ./testout.txt 2>&1 - self.runProcess((config.cmd_tshark, '-i', invalid_index, '-w', 'testout.pcap')) + testout_file = self.filename_from_id(testout_pcap) + self.runProcess((config.cmd_tshark, '-i', invalid_index, '-w', testout_file)) self.assertTrue(self.grepOutput('There is no interface with that adapter index')) |