From 07ce928bf356e8288a3e1fce32c91632e61adbbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moise=CC=81s=20Guimara=CC=83es?= Date: Mon, 23 May 2016 21:10:44 -0300 Subject: [PATCH] adds installation testing with vagrant --- wrapper/python/.centos-provisioner.sh | 31 +++++++++++++++++++++++++++ wrapper/python/.ubuntu-provisioner.sh | 28 ++++++++++++++++++++++++ wrapper/python/Vagrantfile | 14 ++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 wrapper/python/.centos-provisioner.sh create mode 100644 wrapper/python/.ubuntu-provisioner.sh create mode 100644 wrapper/python/Vagrantfile diff --git a/wrapper/python/.centos-provisioner.sh b/wrapper/python/.centos-provisioner.sh new file mode 100644 index 000000000..8f74110d2 --- /dev/null +++ b/wrapper/python/.centos-provisioner.sh @@ -0,0 +1,31 @@ +[ "$(whoami)" != "root" ] && echo "Sorry, you are not root." && exit 1 + +rpm -ivh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-6.noarch.rpm +yum update +yum install -y git autoconf libtool + +git clone https://github.com/wolfssl/wolfssl.git +[ $? -ne 0 ] && echo "\n\nCouldn't download wolfssl.\n\n" && exit 1 + +pushd wolfssl + +./autogen.sh +./configure +make +make install +echo /usr/local/lib > wolfssl.conf +mv wolfssl.conf /etc/ld.so.conf +ldconfig + +popd +rm -rf wolfssl + +yum install -y libffi-devel python-devel python-pip + +pip install wolfcrypt +[ $? -ne 0 ] && echo "\n\nCouldn't install wolfcrypt.\n\n" && exit 1 + +echo "Test should print:" +echo "da39a3ee5e6b4b0d3255bfef95601890afd80709" +echo "Running test:" +python -c "from wolfcrypt.hashes import Sha; print(Sha().hexdigest())" diff --git a/wrapper/python/.ubuntu-provisioner.sh b/wrapper/python/.ubuntu-provisioner.sh new file mode 100644 index 000000000..ab9e54cb3 --- /dev/null +++ b/wrapper/python/.ubuntu-provisioner.sh @@ -0,0 +1,28 @@ +[ "$(whoami)" != "root" ] && echo "Sorry, you are not root." && exit 1 + +apt-get update +apt-get install -y git autoconf libtool + +git clone https://github.com/wolfssl/wolfssl.git +[ $? -ne 0 ] && echo "\n\nCouldn't download wolfssl.\n\n" && exit 1 + +pushd wolfssl + +./autogen.sh +./configure +make +make install +ldconfig + +popd +rm -rf wolfssl + +apt-get install -y libffi-dev python-dev python-pip + +pip install wolfcrypt +[ $? -ne 0 ] && echo "\n\nCouldn't install wolfcrypt.\n\n" && exit 1 + +echo "Test should print:" +echo "da39a3ee5e6b4b0d3255bfef95601890afd80709" +echo "Running test:" +python -c "from wolfcrypt.hashes import Sha; print(Sha().hexdigest())" diff --git a/wrapper/python/Vagrantfile b/wrapper/python/Vagrantfile new file mode 100644 index 000000000..e164331df --- /dev/null +++ b/wrapper/python/Vagrantfile @@ -0,0 +1,14 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : +BOX = "ubuntu" +VAGRANTFILE_API_VERSION = "2" + +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| + if BOX == "ubuntu" + config.vm.box = "ubuntu/trusty64" + config.vm.provision "shell", path: ".ubuntu-provisioner.sh" + else + config.vm.box = "moisesguimaraes/centos72-64" + config.vm.provision "shell", path: ".centos-provisioner.sh" + end +end