diff options
author | Anike Arni <anikarni@gmail.com> | 2017-01-10 11:34:01 -0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-10 11:34:01 -0200 |
commit | 67f06daab61be9ec763fd228cf51a4d3f9c091a3 (patch) | |
tree | c7bbf6ec32d9b9eb5ab5ab3eac04fc60a6fcf253 /service/go | |
parent | bc84433a06a742c3b29e115fb9e88c86df0f2b1c (diff) | |
parent | 96e377d4957b32db440f8179d4c1b16de724fa71 (diff) |
Merge pull request #899 from bwagnerr/make
Creates a unified makefile for pixelated client and web-ui
Diffstat (limited to 'service/go')
-rwxr-xr-x | service/go | 170 |
1 files changed, 5 insertions, 165 deletions
@@ -1,167 +1,7 @@ #!/bin/bash -NUM_OF_CORES='' -NUM_OF_JOBS='' -TRIAL_PATH='' -TRIAL_REPORTER='verbose' - -function getTrialAbsolutePath { - TRIAL_PATH="$(which trial)" -} - -function resolveNumOfCores { - if [ "$(uname)" == "Darwin" ]; then - NUM_OF_CORES="$(sysctl -n hw.ncpu)" - else - NUM_OF_CORES="$(nproc)" - fi -} - -function resolveNumOfJobs { - resolveNumOfCores - if [ "$(uname)" == "Darwin" ]; then - # Somehow, the tests fail on MacOS X for NUM_OF_JOBS="$NUM_OF_CORES" - NUM_OF_JOBS="$(($NUM_OF_CORES > 1 ? $NUM_OF_CORES / 2 : 1))" - else - NUM_OF_JOBS="$NUM_OF_CORES" - fi -} - -function removeZmqCertificates { - if [ -d ~/.config/leap/events/zmq_certificates ] ; then - echo "Removing zmq folder before running tests." - rm -Rf ~/.config/leap/events/zmq_certificates - fi -} - -function setuppy { - echo "Installing Pixelated User Agent." - pip install --upgrade pip setuptools - if [ `uname -s` = "Darwin" ]; then - CFLAGS="-DCRYPTOPP_DISABLE_ASM=1" pip install --exists-action s -r requirements.txt - else - pip install --exists-action s -r requirements.txt - fi - pip install --exists-action s -r test_requirements.txt - echo "Done." -} - -function setupjs { - echo "Installing node and bower libraries." - cd ../web-ui - npm install - node_modules/bower/bin/bower install --config.interactive=false --allow-root - LC_ALL=en_US.UTF-8 ./go build - cd - - echo "Done." -} - -function runIntegrationTests { - echo "Executing Integration Tests." - resolveNumOfJobs - trial -j $NUM_OF_JOBS --reporter=$TRIAL_REPORTER $* test.integration - echo "Done." -} - -function runUnitTests { - echo "Executing Unit Tests." - removeZmqCertificates - trial --reporter=$TRIAL_REPORTER $* test.unit - echo "Done." -} - -function runPep8 { - echo "Verifying conformation to pep8." - pep8 pixelated test --ignore=E501 - echo "Done." -} - -function runJSHint { - echo "Executing JSHint." - cd ../web-ui - LC_ALL=en_US.UTF-8 ./go jshint - cd - - echo "Done." -} - -function runCoverageUnit { - echo "Generating Unit Test Converage Information." - coverage erase - getTrialAbsolutePath - coverage run -p --source=pixelated $TRIAL_PATH --reporter=$TRIAL_REPORTER $* test.unit - coverage combine - coverage html - echo "Done." -} - -function runCoverageIntegration { - echo "Generating Integration Test Converage Information." - coverage erase - getTrialAbsolutePath - coverage run -p --source=pixelated $TRIAL_PATH --reporter=$TRIAL_REPORTER $* test.integration - coverage combine - coverage html - echo "Done." -} - -function runCoverageUnitAndIntegration { - echo "Generating Unit and Integration Test Converage Information." - coverage erase - getTrialAbsolutePath - coverage run -p --source=pixelated $TRIAL_PATH --reporter=$TRIAL_REPORTER test.unit - coverage run -p --source=pixelated $TRIAL_PATH --reporter=$TRIAL_REPORTER test.integration - coverage combine - coverage html - echo "Done." -} - -function runFunctionalTests { - echo "Executing Functional Tests on headless PhantomJS." - removeZmqCertificates - echo "You should execute it on Debian box for more similar results with CI environment." - behave --tags ~@wip --tags ~@smoke test/functional/features - echo "Done." -} - -function cleanPyc { - find . -name '*.pyc' -delete -} - -if [ "$1" == 'test' ]; then - set -e - runPep8 - runUnitTests "${@:2}" - runIntegrationTests "${@:2}" -elif [ "$1" == 'unit' ]; then - set -e - cleanPyc - runUnitTests -elif [ "$1" == 'integration' ]; then - set -e - cleanPyc - runIntegrationTests -elif [ "$1" == 'pep8' ]; then - set -e - runPep8 -elif [ "$1" == 'setuppy' ]; then - setuppy -elif [ "$1" == 'setupjs' ]; then - setupjs -elif [ "$1" == 'setup' ]; then - setupjs - setuppy "${@:2}" -elif [ "$1" == 'coverage_unit' ]; then - runCoverageUnit "${@:2}" -elif [ "$1" == 'coverage_integration' ]; then - runCoverageIntegration "${@:2}" -elif [ "$1" == 'coverage_all' ]; then - set -e - runPep8 - runCoverageUnitAndIntegration "${@:2}" -elif [ "$1" == 'start' ]; then - /usr/bin/env pixelated-user-agent "${@:2}" -elif [ "$1" == "functional" ]; then - runFunctionalTests "${@:2}" -else - python setup.py $* -fi +type -t deactivate && deactivate +set -e +pushd .. +make $* +popd |