aboutsummaryrefslogtreecommitdiffstats
path: root/test/suite_clopts.py
diff options
context:
space:
mode:
authorVasil Velichkov <vasko@vvelichkov2.dev.opencode.com>2018-11-07 21:33:41 +0200
committerGuy Harris <guy@alum.mit.edu>2018-11-13 21:18:30 +0000
commitec95ae98ed29190f3df044e8676d6aed101405c0 (patch)
tree04fed2309d3154705abfc34d861062c803361d19 /test/suite_clopts.py
parent2ed4743915a7768959aff59631357a7b13a16dbb (diff)
tshark: Print the packets' comments in the expert info
Previously 'tshark -z expert' was failing with abort when a packet contains a comment - Add a new comment parameter and update the tshark's manual page - Add a new comment_level severity and change the default lavel to it. - Add various 'tshark -z expert' tests Change-Id: I188317da5e00019b8f2b725f0fe84942f774520f Reviewed-on: https://code.wireshark.org/review/30610 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'test/suite_clopts.py')
-rw-r--r--test/suite_clopts.py69
1 files changed, 69 insertions, 0 deletions
diff --git a/test/suite_clopts.py b/test/suite_clopts.py
index aa6ec95ccc..98981ad8ca 100644
--- a/test/suite_clopts.py
+++ b/test/suite_clopts.py
@@ -192,6 +192,75 @@ class case_tshark_dump_glossaries(subprocesstest.SubprocessTestCase):
self.runProcess((config.cmd_tshark, '-G', 'plugins'), env=config.baseEnv())
self.assertGreaterEqual(self.countOutput('dissector'), 10, 'Fewer than 10 dissector plugins found')
+class case_tshark_z_expert(subprocesstest.SubprocessTestCase):
+ def test_tshark_z_expert_all(self):
+ self.assertRun((config.cmd_tshark, '-q', '-z', 'expert',
+ '-r', os.path.join(config.capture_dir, 'http-ooo.pcap')))
+ self.assertTrue(self.grepOutput('Errors'))
+ self.assertTrue(self.grepOutput('Warns'))
+ self.assertTrue(self.grepOutput('Chats'))
+
+ def test_tshark_z_expert_error(self):
+ self.assertRun((config.cmd_tshark, '-q', '-z', 'expert,error',
+ '-r', os.path.join(config.capture_dir, 'http-ooo.pcap')))
+ self.assertTrue(self.grepOutput('Errors'))
+ self.assertFalse(self.grepOutput('Warns'))
+ self.assertFalse(self.grepOutput('Chats'))
+
+ def test_tshark_z_expert_warn(self):
+ self.assertRun((config.cmd_tshark, '-q', '-z', 'expert,warn',
+ '-r', os.path.join(config.capture_dir, 'http-ooo.pcap')))
+ self.assertTrue(self.grepOutput('Errors'))
+ self.assertTrue(self.grepOutput('Warns'))
+ self.assertFalse(self.grepOutput('Chats'))
+
+ def test_tshark_z_expert_note(self):
+ self.assertRun((config.cmd_tshark, '-q', '-z', 'expert,note',
+ '-r', os.path.join(config.capture_dir, 'http2-data-reassembly.pcap')))
+ self.assertTrue(self.grepOutput('Warns'))
+ self.assertTrue(self.grepOutput('Notes'))
+ self.assertFalse(self.grepOutput('Chats'))
+
+ def test_tshark_z_expert_chat(self):
+ self.assertRun((config.cmd_tshark, '-q', '-z', 'expert,chat',
+ '-r', os.path.join(config.capture_dir, 'http-ooo.pcap')))
+ self.assertTrue(self.grepOutput('Errors'))
+ self.assertTrue(self.grepOutput('Warns'))
+ self.assertTrue(self.grepOutput('Chats'))
+
+ def test_tshark_z_expert_comment(self):
+ self.assertRun((config.cmd_tshark, '-q', '-z', 'expert,comment',
+ '-r', os.path.join(config.capture_dir, 'sip.pcapng')))
+ self.assertTrue(self.grepOutput('Notes'))
+ self.assertTrue(self.grepOutput('Comments'))
+
+ def test_tshark_z_expert_invalid_filter(self):
+ invalid_filter = '__invalid_protocol'
+ self.assertRun((config.cmd_tshark, '-q', '-z', 'expert,' + invalid_filter,
+ '-r', os.path.join(config.capture_dir, 'http-ooo.pcap')),
+ expected_return=self.exit_command_line)
+ self.assertTrue(self.grepOutput('Filter "' + invalid_filter + '" is invalid'))
+
+ def test_tshark_z_expert_error_invalid_filter(self):
+ invalid_filter = '__invalid_protocol'
+ self.assertRun((config.cmd_tshark, '-q', '-z', 'expert,error,' + invalid_filter,
+ '-r', os.path.join(config.capture_dir, 'http-ooo.pcap')),
+ expected_return=self.exit_command_line)
+ self.assertTrue(self.grepOutput('Filter "' + invalid_filter + '" is invalid'))
+
+ def test_tshark_z_expert_filter(self):
+ self.assertRun((config.cmd_tshark, '-q', '-z', 'expert,udp', #udp is a filter
+ '-r', os.path.join(config.capture_dir, 'http-ooo.pcap')))
+ self.assertFalse(self.grepOutput('Errors'))
+ self.assertFalse(self.grepOutput('Warns'))
+ self.assertFalse(self.grepOutput('Chats'))
+
+ def test_tshark_z_expert_error_filter(self):
+ self.assertRun((config.cmd_tshark, '-q', '-z', 'expert,error,udp', #udp is a filter
+ '-r', os.path.join(config.capture_dir, 'http-ooo.pcap')))
+ self.assertFalse(self.grepOutput('Errors'))
+ self.assertFalse(self.grepOutput('Warns'))
+ self.assertFalse(self.grepOutput('Chats'))
# Purposefully fail a test. Used for testing the test framework.
# class case_fail_on_purpose(subprocesstest.SubprocessTestCase):