From b1b741c5f1abe29442be96d994286d49c03cb6a4 Mon Sep 17 00:00:00 2001 From: Pierre LALET <pierre.lalet@cea.fr> Date: Wed, 4 Jan 2017 13:51:53 +0100 Subject: [PATCH] Tests: introduce "crypto" keyword Pypy won't run crypto tests on Travis CI because the cryptography module cannot be installed with the Pypy version used. --- .travis/install.sh | 20 +------------------- .travis/test.sh | 9 ++------- test/cert.uts | 1 + test/ipsec.uts | 6 ++++++ test/regression.uts | 2 +- 5 files changed, 11 insertions(+), 27 deletions(-) diff --git a/.travis/install.sh b/.travis/install.sh index 4767316d..20bc9b41 100644 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -9,25 +9,7 @@ then fi if python --version 2>&1 | grep -q PyPy; then - wget https://pypi.python.org/packages/82/f7/d6dfd7595910a20a563a83a762bf79a253c4df71759c3b228accb3d7e5e4/cryptography-1.7.1.tar.gz - tar zxf cryptography-1.7.1.tar.gz - cd cryptography-1.7.1 - patch << EOF ---- setup.py -+++ setup.py -@@ -47,7 +47,7 @@ if sys.version_info < (3, 4): - if sys.version_info < (3, 3): - requirements.append("ipaddress") - --if platform.python_implementation() == "PyPy": -+if False: - if sys.pypy_version_info < (2, 6): - raise RuntimeError( - "cryptography 1.0 is not compatible with PyPy < 2.6. Please " -EOF - $SCAPY_SUDO pip install $PIP_INSTALL_FLAGS . - cd ../ - rm -rf cryptography-* + # cryptography requires PyPy >= 2.6, Travis CI uses 2.5.0 $SCAPY_SUDO pip install $PIP_INSTALL_FLAGS ecdsa mock else $SCAPY_SUDO pip install $PIP_INSTALL_FLAGS cryptography ecdsa mock diff --git a/.travis/test.sh b/.travis/test.sh index 419310d2..f3a78a46 100644 --- a/.travis/test.sh +++ b/.travis/test.sh @@ -26,8 +26,8 @@ fi if python --version 2>&1 | grep -q PyPy then - TRAVIS_PYPY="yes" - UT_FLAGS+=" -K wep " + # cryptography requires PyPy >= 2.6, Travis CI uses 2.5.0 + UT_FLAGS+=" -K crypto " fi # Set PATH @@ -75,11 +75,6 @@ do then continue fi - if [ "$f" = "cert.uts" -o "$f" = "ipsec.uts" ] && [ "$TRAVIS_PYPY" = "yes" ] - then - # currently disabled - continue - fi $SCAPY_SUDO ./run_tests -q -F -t $f $UT_FLAGS || exit $? done diff --git a/test/cert.uts b/test/cert.uts index 2b01c8b1..876286d2 100644 --- a/test/cert.uts +++ b/test/cert.uts @@ -3,6 +3,7 @@ # Try me with: # bash test/run_tests -t test/cert.uts -F +~ crypto ########### PKCS helpers ############################################### diff --git a/test/ipsec.uts b/test/ipsec.uts index 4ec59d64..7a49e285 100644 --- a/test/ipsec.uts +++ b/test/ipsec.uts @@ -2,11 +2,14 @@ % IPSec layer regression tests ############################## +~ crypto + ############################################################################### + IPv4 / ESP - Transport - Encryption Algorithms ####################################### = IPv4 / ESP - Transport - NULL - NULL +~ -crypto import socket @@ -237,6 +240,7 @@ assert(d[TCP] == p[TCP]) ####################################### = IPv4 / ESP - Tunnel - NULL - NULL +~ -crypto p = IP(src='1.1.1.1', dst='2.2.2.2') p /= TCP(sport=45012, dport=80) @@ -2425,6 +2429,7 @@ except IPSecIntegrityError, err: ####################################### = IPv6 / ESP - Transport - NULL - NULL +~ -crypto p = IPv6(src='11::22', dst='22::11') p /= TCP(sport=45012, dport=80) @@ -2752,6 +2757,7 @@ except IPSecIntegrityError, err: ####################################### = IPv6 / ESP - Tunnel - NULL - NULL +~ -crypto p = IPv6(src='11::22', dst='22::11') p /= TCP(sport=45012, dport=80) diff --git a/test/regression.uts b/test/regression.uts index 27255a74..41c640a0 100644 --- a/test/regression.uts +++ b/test/regression.uts @@ -580,7 +580,7 @@ assert(len(y[TFTP_Options].options) == 2 and y[TFTP_Option].oname == "blksize") = WEP tests -~ wifi wep Dot11 LLC SNAP IP TCP +~ wifi crypto Dot11 LLC SNAP IP TCP conf.wepkey = "Fobar" str(Dot11WEP()/LLC()/SNAP()/IP()/TCP(seq=12345678)) assert(_ == '\x00\x00\x00\x00\xe3OjYLw\xc3x_%\xd0\xcf\xdeu-\xc3pH#\x1eK\xae\xf5\xde\xe7\xb8\x1d,\xa1\xfe\xe83\xca\xe1\xfe\xbd\xfe\xec\x00)T`\xde.\x93Td\x95C\x0f\x07\xdd') -- GitLab