[504029]: run_tests Maximize Restore History

Download this file

run_tests    54 lines (47 with data), 1.3 kB

#!/bin/bash

function check_port() {
    PORT=$1
    echo 'quit' |telnet localhost $PORT >/dev/null 2>&1
}

if [ -z "$VIRTUAL_ENV" ]; then
    source /var/local/env-allura/bin/activate
fi

# If this is sandbox and local SOLR isn't running, start it
if [ -n "$SF_SYSTEM_FUNC" ]; then
    if ! check_port 50065; then
        SOLRCONFIG="/var/local/allura/solr_config"
        SOLRLOG=/usr/local/solr/logs/console.log
        echo "Starting SOLR, log is at $SOLRLOG"
        pushd /usr/local/solr
        /usr/java/jdk1.5.0_15/bin/java -Dsolr.solr.home="$SOLRCONFIG" -jar start.jar >$SOLRLOG 2>&1 &
        popd
        sleep 15
    fi
fi

# main

if [ "$TEST_MODULES"  == "" ]; then
    TEST_MODULES="\
    AlluraTesting \
    Allura \
    ForgeBlog \
    ForgeLink \
    ForgeDiscussion \
    ForgeGit \
    ForgeHg \
    ForgeMail \
    ForgeSVN \
    ForgeTracker \
    ForgeWiki \
    ForgeDownloads \
    "
fi

# Run with --with-coverage for coverage (add --cover-html for html report)
for module in $TEST_MODULES; do
    (
        echo "Running tests in module $module"
        cd $module
        # Use bash4 feature to lowercase string
        cover_package=${module,,}
        nosetests --cover-package=$cover_package --cover-html-dir=report.coverage --cover-erase $* || exit
    ) || exit
done