2016-04-07 08:34:58 -04:00
|
|
|
#!/bin/sh
|
|
|
|
# This script is used as a single command to run the x-plugins tests.
|
2016-01-18 18:20:33 -05:00
|
|
|
#
|
2016-04-07 08:34:58 -04:00
|
|
|
# It will attempt to check out 'elasticsearch' into a sibling directory
|
|
|
|
# unless the environment variable `USE_EXISTING_ES` has a value
|
2016-01-18 18:20:33 -05:00
|
|
|
#
|
|
|
|
|
|
|
|
# Turn on semi-strict mode
|
2016-04-07 08:34:58 -04:00
|
|
|
set -euf pipefail
|
2016-01-18 18:20:33 -05:00
|
|
|
|
2016-04-07 08:34:58 -04:00
|
|
|
SCRIPT="$0"
|
2016-01-18 18:20:33 -05:00
|
|
|
|
2016-04-07 08:34:58 -04:00
|
|
|
# SCRIPT may be an arbitrarily deep series of symlinks. Loop until we have the concrete path.
|
|
|
|
while [ -h "$SCRIPT" ] ; do
|
|
|
|
ls=`ls -ld "$SCRIPT"`
|
|
|
|
# Drop everything prior to ->
|
|
|
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
|
|
if expr "$link" : '/.*' > /dev/null; then
|
|
|
|
SCRIPT="$link"
|
|
|
|
else
|
|
|
|
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
|
|
|
fi
|
|
|
|
done
|
2016-01-18 18:20:33 -05:00
|
|
|
|
2016-04-07 08:34:58 -04:00
|
|
|
# determine base directory
|
|
|
|
BASE_DIR=`dirname "$SCRIPT"`/..
|
|
|
|
|
|
|
|
# make BASE_DIR absolute
|
|
|
|
BASE_DIR=`cd "$BASE_DIR"; pwd`
|
|
|
|
|
|
|
|
PARENT_DIR=`cd "$BASE_DIR"/..; pwd`
|
|
|
|
|
|
|
|
# go to the parent directory
|
|
|
|
cd $PARENT_DIR
|
|
|
|
|
|
|
|
if [ -z ${USE_EXISTING_ES:+x} ]; then
|
2016-01-18 18:20:33 -05:00
|
|
|
if [ -d "./elasticsearch" ]; then
|
2016-04-07 08:34:58 -04:00
|
|
|
echo "I expected a clean workspace but an 'elasticsearch' sibling directory already exists in [$PARENT_DIR]!"
|
2016-01-18 18:20:33 -05:00
|
|
|
echo
|
2016-04-07 08:34:58 -04:00
|
|
|
echo "Either define 'USE_EXISTING_ES' or remove the existing 'elasticsearch' sibling."
|
2016-01-18 18:20:33 -05:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
echo "Checking out Elasticsearch 'master' branch..."
|
|
|
|
git clone https://github.com/elastic/elasticsearch.git --depth=1
|
|
|
|
else
|
|
|
|
if [ -d "./elasticsearch" ]; then
|
|
|
|
echo "Using existing 'elasticsearch' checkout"
|
|
|
|
else
|
2016-04-07 08:34:58 -04:00
|
|
|
echo "You have defined 'USE_EXISTING_ES' but no existing Elasticsearch directory exists!"
|
2016-01-18 18:20:33 -05:00
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Running X-Plugins tests..."
|
2016-04-07 08:34:58 -04:00
|
|
|
cd "$BASE_DIR" && echo "Running in $PWD"
|
|
|
|
|
|
|
|
# output the commands
|
|
|
|
set -x
|
|
|
|
|
|
|
|
# clean
|
|
|
|
gradle --stacktrace clean
|
2016-01-18 18:20:33 -05:00
|
|
|
|
2016-04-07 08:34:58 -04:00
|
|
|
# Actually run the tests
|
|
|
|
gradle --info check -Dtests.network=true -Dtests.badapples=true
|
2016-01-18 18:20:33 -05:00
|
|
|
|
|
|
|
# ~*~ shell-script-mode ~*~
|