aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2018-11-30 01:41:21 +0100
committerAnders Broman <a.broman58@gmail.com>2018-11-30 06:11:23 +0000
commit97112cd4f765a20e080d24c73ef02c7039876d1b (patch)
treec60d23f4d28b0f5e94a539e2150f761bd2f9ec8e
parentee61bc739e133ca2b07bc51d1baa3249265193dd (diff)
test: skip tests when GnuTLS is unavailable
GnuTLS is an optional dependency, allow tests to run without it. Change-Id: Ib1bd7beaf1d885a157a0e1a630ccc4fbc8786af1 Reviewed-on: https://code.wireshark.org/review/30839 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r--test/fixtures_ws.py1
-rw-r--r--test/suite_decryption.py26
2 files changed, 20 insertions, 7 deletions
diff --git a/test/fixtures_ws.py b/test/fixtures_ws.py
index df9b9149ac..b2e3fc8ff5 100644
--- a/test/fixtures_ws.py
+++ b/test/fixtures_ws.py
@@ -150,6 +150,7 @@ def features(cmd_tshark, make_env):
have_kerberos='with MIT Kerberos' in tshark_v or 'with Heimdal Kerberos' in tshark_v,
have_libgcrypt16=gcry_m and float(gcry_m.group(1)) >= 1.6,
have_libgcrypt17=gcry_m and float(gcry_m.group(1)) >= 1.7,
+ have_gnutls='with GnuTLS' in tshark_v,
)
diff --git a/test/suite_decryption.py b/test/suite_decryption.py
index 161789a7bb..8b95903d64 100644
--- a/test/suite_decryption.py
+++ b/test/suite_decryption.py
@@ -78,8 +78,10 @@ class case_decrypt_80211(subprocesstest.SubprocessTestCase):
@fixtures.mark_usefixtures('test_env')
@fixtures.uses_fixtures
class case_decrypt_dtls(subprocesstest.SubprocessTestCase):
- def test_dtls(self, cmd_tshark, capture_file):
+ def test_dtls_rsa(self, cmd_tshark, capture_file, features):
'''DTLS'''
+ if not features.have_gnutls:
+ self.skipTest('Requires GnuTLS.')
# https://wiki.wireshark.org/SampleCaptures?action=AttachFile&do=view&target=snakeoil.tgz
self.assertRun((cmd_tshark,
'-r', capture_file('snakeoil-dtls.pcap'),
@@ -100,8 +102,10 @@ class case_decrypt_dtls(subprocesstest.SubprocessTestCase):
wfm_count = self.countOutput('Works for me!.')
self.assertTrue(dt_count == 7 and wfm_count == 2)
- def test_dtls_udt(self, cmd_tshark, dirs, capture_file):
+ def test_dtls_udt(self, cmd_tshark, dirs, capture_file, features):
'''UDT over DTLS 1.2 with RSA key'''
+ if not features.have_gnutls:
+ self.skipTest('Requires GnuTLS.')
key_file = os.path.join(dirs.key_dir, 'udt-dtls.key')
self.assertRun((cmd_tshark,
'-r', capture_file('udt-dtls.pcapng.gz'),
@@ -114,8 +118,10 @@ class case_decrypt_dtls(subprocesstest.SubprocessTestCase):
@fixtures.mark_usefixtures('test_env')
@fixtures.uses_fixtures
class case_decrypt_tls(subprocesstest.SubprocessTestCase):
- def test_tls(self, cmd_tshark, capture_file):
- '''TLS using the server's private key'''
+ def test_tls_rsa(self, cmd_tshark, capture_file, features):
+ '''TLS using the server's private RSA key.'''
+ if not features.have_gnutls:
+ self.skipTest('Requires GnuTLS.')
# https://wiki.wireshark.org/SampleCaptures?action=AttachFile&do=view&target=snakeoil2_070531.tgz
self.assertRun((cmd_tshark,
'-r', capture_file('rsasnakeoil2.pcap'),
@@ -125,9 +131,11 @@ class case_decrypt_tls(subprocesstest.SubprocessTestCase):
))
self.assertTrue(self.grepOutput('favicon.ico'))
- def test_tls_rsa_pq(self, cmd_tshark, dirs, capture_file):
+ def test_tls_rsa_pq(self, cmd_tshark, dirs, capture_file, features):
'''TLS using the server's private key with p < q
(test whether libgcrypt is correctly called)'''
+ if not features.have_gnutls:
+ self.skipTest('Requires GnuTLS.')
key_file = os.path.join(dirs.key_dir, 'rsa-p-lt-q.key')
self.assertRun((cmd_tshark,
'-r', capture_file('rsa-p-lt-q.pcap'),
@@ -138,8 +146,10 @@ class case_decrypt_tls(subprocesstest.SubprocessTestCase):
))
self.assertTrue(self.grepOutput('/'))
- def test_tls_with_password(self, cmd_tshark, capture_file):
+ def test_tls_rsa_with_password(self, cmd_tshark, capture_file, features):
'''TLS using the server's private key with password'''
+ if not features.have_gnutls:
+ self.skipTest('Requires GnuTLS.')
self.assertRun((cmd_tshark,
'-r', capture_file('dmgr.pcapng'),
'-Tfields',
@@ -164,8 +174,10 @@ class case_decrypt_tls(subprocesstest.SubprocessTestCase):
))
self.assertTrue(self.grepOutput(r'GET\s+/test\s+HTTP/1.0'))
- def test_tls12_renegotiation(self, cmd_tshark, dirs, capture_file):
+ def test_tls12_renegotiation(self, cmd_tshark, dirs, capture_file, features):
'''TLS 1.2 with renegotiation'''
+ if not features.have_gnutls:
+ self.skipTest('Requires GnuTLS.')
key_file = os.path.join(dirs.key_dir, 'rsasnakeoil2.key')
self.assertRun((cmd_tshark,
'-r', capture_file('tls-renegotiation.pcap'),