Following the license change, modify the boilerplates in test/
[openssl.git] / test / recipes / 95-test_external_pyca_data / cryptography.sh
1 #!/bin/sh
2 #
3 # Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.
4 # Copyright (c) 2017, Oracle and/or its affiliates.  All rights reserved.
5 #
6 # Licensed under the Apache License 2.0 (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
16 O_EXE=`pwd`/$BLDTOP/apps
17 O_BINC=`pwd`/$BLDTOP/include
18 O_SINC=`pwd`/$SRCTOP/include
19 O_LIB=`pwd`/$BLDTOP
20
21 export PATH=$O_EXE:$PATH
22 export LD_LIBRARY_PATH=$O_LIB:$LD_LIBRARY_PATH
23
24 # Check/Set openssl version
25 OPENSSL_VERSION=`openssl version | cut -f 2 -d ' '`
26
27 echo "------------------------------------------------------------------"
28 echo "Testing OpenSSL using Python Cryptography:"
29 echo "   CWD:                $PWD"
30 echo "   SRCTOP:             $SRCTOP"
31 echo "   BLDTOP:             $BLDTOP"
32 echo "   OpenSSL version:    $OPENSSL_VERSION"
33 echo "------------------------------------------------------------------"
34
35 cd $SRCTOP
36
37 # Create a python virtual env and activate
38 rm -rf venv-pycrypto
39 virtualenv venv-pycrypto
40 . ./venv-pycrypto/bin/activate
41
42 cd pyca-cryptography
43
44 pip install .[test]
45
46 echo "------------------------------------------------------------------"
47 echo "Building cryptography"
48 echo "------------------------------------------------------------------"
49 python ./setup.py clean
50
51 CFLAGS="-I$O_BINC -I$O_SINC -L$O_LIB" python ./setup.py build
52
53 echo "------------------------------------------------------------------"
54 echo "Running tests"
55 echo "------------------------------------------------------------------"
56
57 CFLAGS="-I$O_BINC -I$O_SINC -L$O_LIB" python ./setup.py test
58
59 cd ../
60 deactivate
61 rm -rf venv-pycrypto
62
63 exit 0
64