test_acceptance.sh 1.39 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#! /bin/bash

set -e
set -x

git remote prune origin

# Reset the submodule, in case it changed
git submodule foreach 'git reset --hard HEAD'

# Set the IO encoding to UTF-8 so that askbot will start
export PYTHONIOENCODING=UTF-8

if [ ! -d /mnt/virtualenvs/"$JOB_NAME" ]; then
    mkdir -p /mnt/virtualenvs/"$JOB_NAME"
16
    virtualenv --system-site-packages /mnt/virtualenvs/"$JOB_NAME"
17 18 19 20 21
fi

export PIP_DOWNLOAD_CACHE=/mnt/pip-cache

source /mnt/virtualenvs/"$JOB_NAME"/bin/activate
22
rake install_prereqs
23 24 25 26 27 28 29 30
rake clobber

TESTS_FAILED=0

# Assumes that Xvfb has been started by upstart
# and is capturing display :1
# The command for this is:
# /usr/bin/Xvfb :1 -screen 0 1024x268x24
31
# This allows us to run Chrome or Firefox without a display
32
export DISPLAY=:1
33 34
SKIP_TESTS=""

JonahStanley committed
35
# Testing for the existance of these environment variables
36
if [ ! -z ${LETTUCE_BROWSER+x} ]; then
37
	SKIP_TESTS="--tag -skip_$LETTUCE_BROWSER"
38 39
fi
if [ ! -z ${SAUCE_ENABLED+x} ]; then
JonahStanley committed
40 41 42 43
	# SAUCE_INFO is a - seperated string PLATFORM-BROWSER-VERSION-DEVICE
	# Error checking is done in the setting up of the browser
	IFS='-' read -a SAUCE <<< "${SAUCE_INFO}"
	SKIP_TESTS="--tag -skip_sauce --tag -skip_${SAUCE[1]}"
44
fi
45 46

# Run the lms and cms acceptance tests
47
# (the -v flag turns off color in the output)
48 49
rake test_acceptance_lms["-v 3 $SKIP_TESTS"] || TESTS_FAILED=1
rake test_acceptance_cms["-v 3 $SKIP_TESTS"] || TESTS_FAILED=1
50 51

[ $TESTS_FAILED == '0' ]