From 9326d0a6dd902435ad13fe23c21d7b8f30fb35ce Mon Sep 17 00:00:00 2001 From: sveneh Date: Wed, 14 Jan 2015 17:03:37 +0100 Subject: [PATCH] Dockers for go, cpp --- ansible/README.md | 2 +- ansible/Vagrantfile | 8 ++-- ansible/host-config.yml | 4 +- ansible/roles/common/tasks/main.yml | 1 + ansible/test-files/docker-cpp/Dockerfile | 32 ++++++++++++++ ansible/test-files/docker-go/Dockerfile | 2 +- ansible/test-files/testrunner.sh | 55 ++++++++++++++++++++++++ ansible/testrunner-config.yml | 8 ++-- 8 files changed, 101 insertions(+), 11 deletions(-) create mode 100644 ansible/test-files/docker-cpp/Dockerfile create mode 100644 ansible/test-files/testrunner.sh diff --git a/ansible/README.md b/ansible/README.md index 558b2e845f..cef4079865 100644 --- a/ansible/README.md +++ b/ansible/README.md @@ -2,4 +2,4 @@ Testing is done in a Vagrant virtual machine -install vagrant, virtualbox, ansible, then do `vagrant up`. It should provison a basic machine. `vagrant ssh` to verify the machine is working as expected. +install vagrant, virtualbox, ansible, then do `vagrant up`. It should provison a basic machine. `vagrant ssh` to verify the machine is working as expected. `vagrant terminate` to reset machine to clean state. diff --git a/ansible/Vagrantfile b/ansible/Vagrantfile index ca2a7b288c..748085a232 100644 --- a/ansible/Vagrantfile +++ b/ansible/Vagrantfile @@ -55,10 +55,12 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # end - # Ubuntu / Virtualbox workaround. - # see http://askubuntu.com/questions/238040/how-do-i-fix-name-service-for-vagrant-client config.vm.provider "virtualbox" do |vb| + # Ubuntu / Virtualbox workaround. + # see http://askubuntu.com/questions/238040/how-do-i-fix-name-service-for-vagrant-client vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] + + vb.customize ["modifyvm", :id, "--memory", "1024"] end # @@ -68,7 +70,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # Ansible config.vm.provision "ansible" do |ansible| - ansible.playbook = "host-config.yml" + ansible.playbook = "site.yml" end end diff --git a/ansible/host-config.yml b/ansible/host-config.yml index edb4cd8209..571cc141eb 100644 --- a/ansible/host-config.yml +++ b/ansible/host-config.yml @@ -1,8 +1,8 @@ --- -- name: Provision the operation system for buildslave +- name: Provision the operation system for tests # testing hosts: all # live - # hosts: poc-8.ethdev.com + # hosts: TDB roles: - common diff --git a/ansible/roles/common/tasks/main.yml b/ansible/roles/common/tasks/main.yml index dcffc7b8be..3c483ce13c 100644 --- a/ansible/roles/common/tasks/main.yml +++ b/ansible/roles/common/tasks/main.yml @@ -9,6 +9,7 @@ apt: name={{ item }} with_items: - python-pip + - htop - name: install python dependencies sudo: true diff --git a/ansible/test-files/docker-cpp/Dockerfile b/ansible/test-files/docker-cpp/Dockerfile new file mode 100644 index 0000000000..a3b0e4ca6d --- /dev/null +++ b/ansible/test-files/docker-cpp/Dockerfile @@ -0,0 +1,32 @@ +# adjusted from https://github.com/ethereum/cpp-ethereum/blob/develop/docker/Dockerfile +FROM ubuntu:14.04 + +ENV DEBIAN_FRONTEND noninteractive +RUN apt-get update +RUN apt-get upgrade -y + +# Ethereum dependencies +RUN apt-get install -qy build-essential g++-4.8 git cmake libboost-all-dev libcurl4-openssl-dev wget +RUN apt-get install -qy automake unzip libgmp-dev libtool libleveldb-dev yasm libminiupnpc-dev libreadline-dev scons +RUN apt-get install -qy libjsoncpp-dev libargtable2-dev + +# NCurses based GUI (not optional though for a succesful compilation, see https://github.com/ethereum/cpp-ethereum/issues/452 ) +RUN apt-get install -qy libncurses5-dev + +# Qt-based GUI +# RUN apt-get install -qy qtbase5-dev qt5-default qtdeclarative5-dev libqt5webkit5-dev + +# Ethereum PPA +RUN apt-get install -qy software-properties-common +RUN add-apt-repository ppa:ethereum/ethereum +RUN apt-get update +RUN apt-get install -qy libcryptopp-dev libjson-rpc-cpp-dev + +# Build Ethereum (HEADLESS) +RUN git clone --depth=1 --branch develop https://github.com/ethereum/cpp-ethereum +RUN mkdir -p cpp-ethereum/build +RUN cd cpp-ethereum/build && cmake .. -DCMAKE_BUILD_TYPE=Release -DHEADLESS=1 && make -j $(cat /proc/cpuinfo | grep processor | wc -l) && make install +RUN ldconfig + +ENTRYPOINT ["/cpp-ethereum/build/test/createRandomTest"] + diff --git a/ansible/test-files/docker-go/Dockerfile b/ansible/test-files/docker-go/Dockerfile index 235ffff440..2302518f33 100644 --- a/ansible/test-files/docker-go/Dockerfile +++ b/ansible/test-files/docker-go/Dockerfile @@ -16,7 +16,7 @@ RUN apt-get install -y git mercurial build-essential software-properties-common ## Build and install Go RUN hg clone -u release https://code.google.com/p/go RUN cd go && hg update go1.4 -RUN cd go/src && ./all.bash && go version +RUN cd go/src && ./make.bash && go version ## Install GUI dependencies RUN add-apt-repository ppa:ubuntu-sdk-team/ppa -y diff --git a/ansible/test-files/testrunner.sh b/ansible/test-files/testrunner.sh new file mode 100644 index 0000000000..08b21c88e4 --- /dev/null +++ b/ansible/test-files/testrunner.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +# create random virtual machine test +#cd ~/software/Ethereum/pyethereum (python has local dependencies so only works from within the directory) +while [ 1 ] +do + TEST="$(~/software/Ethereum/cpp-ethereum/build/test/createRandomTest)" + # echo "$TEST" + + # test pyethereum + + #OUTPUT_PYTHON="$(python ./tests/test_vm.py "$TEST")" + #RESULT_PYTHON=$? + + # test go + OUTPUT_GO="$(ethtest "$TEST")" + RESULT_GO=$? + + # test cpp-jit + #OUTPUT_CPPJIT="$(~/software/Ethereum/cpp-ethereum/build/test/checkRandomTest "$TEST")" + #RESULT_CPPJIT=$? + +# go fails +if [ "$RESULT_GO" -ne 0 ]; then + echo Failed: + echo Output_GO: + echo $OUTPUT_GO + echo Test: + echo "$TEST" + echo "$TEST" > FailedTest.json + mv FailedTest.json $(date -d "today" +"%Y%m%d%H%M")GO.json # replace with scp to central server +fi + +# python fails +#if [ "$RESULT_PYTHON" -ne 0 ]; then +# echo Failed: +# echo Output_PYTHON: +# echo $OUTPUT_PYTHON +# echo Test: +# echo "$TEST" +# echo "$TEST" > FailedTest.json +# mv FailedTest.json $(date -d "today" +"%Y%m%d%H%M")PYTHON.json +#fi + +# cppjit fails +#if [ "$RESULT_CPPJIT" -ne 0 ]; then +# echo Failed: +# echo Output_CPPJIT: +# echo $OUTPUT_CPPJIT +# echo Test: +# echo "$TEST" +# echo "$TEST" > FailedTest.json +# mv FailedTest.json $(date -d "today" +"%Y%m%d%H%M")CPPJIT.json +#fi + diff --git a/ansible/testrunner-config.yml b/ansible/testrunner-config.yml index 99323f82bc..0304883f18 100644 --- a/ansible/testrunner-config.yml +++ b/ansible/testrunner-config.yml @@ -1,12 +1,12 @@ --- -- name: setting up buildslave configuration +- name: preparing and running tests # testing hosts: all # live - # hosts: poc-8.ethdev.com + # hosts: TBD # TODO use the right user for configuring, until credentials set, stay with default vagrant user - # remote_user: buildsalve + # remote_user: ubuntu roles: - - buildslave + - testrunner