Home | History | Annotate | Line # | Download | only in 95-test_external_pyca_data
      1 #!/bin/sh
      2 #
      3 # Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.
      4 # Copyright (c) 2017, Oracle and/or its affiliates.  All rights reserved.
      5 #
      6 # Licensed under the OpenSSL license (the "License").  You may not use
      7 # this file except in compliance with the License.  You can obtain a copy
      8 # in the file LICENSE in the source distribution or at
      9 # https://www.openssl.org/source/license.html
     10 
     11 #
     12 # OpenSSL external testing using the Python Cryptography module
     13 #
     14 set -e
     15 set -x
     16 
     17 O_EXE=`pwd`/$BLDTOP/apps
     18 O_BINC=`pwd`/$BLDTOP/include
     19 O_SINC=`pwd`/$SRCTOP/include
     20 O_LIB=`pwd`/$BLDTOP
     21 
     22 export PATH=$O_EXE:$PATH
     23 export LD_LIBRARY_PATH=$O_LIB:$LD_LIBRARY_PATH
     24 
     25 # Check/Set openssl version
     26 OPENSSL_VERSION=`openssl version | cut -f 2 -d ' '`
     27 
     28 echo "------------------------------------------------------------------"
     29 echo "Testing OpenSSL using Python Cryptography:"
     30 echo "   CWD:                $PWD"
     31 echo "   SRCTOP:             $SRCTOP"
     32 echo "   BLDTOP:             $BLDTOP"
     33 echo "   OpenSSL version:    $OPENSSL_VERSION"
     34 echo "------------------------------------------------------------------"
     35 
     36 cd $SRCTOP
     37 
     38 # Create a python virtual env and activate
     39 rm -rf venv-cryptography
     40 python -m venv venv-cryptography
     41 . ./venv-cryptography/bin/activate
     42 
     43 cd pyca-cryptography
     44 
     45 echo "------------------------------------------------------------------"
     46 echo "Building cryptography"
     47 echo "------------------------------------------------------------------"
     48 LDFLAGS="-L$O_LIB" CFLAGS="-I$O_BINC -I$O_SINC" pip install .[test]
     49 pip install -e vectors
     50 
     51 echo "------------------------------------------------------------------"
     52 echo "Running tests"
     53 echo "------------------------------------------------------------------"
     54 
     55 pytest -n auto tests --wycheproof-root=../wycheproof
     56 
     57 cd ../
     58 deactivate
     59 rm -rf venv-cryptography
     60 
     61 exit 0
     62 
     63