Created
December 20, 2018 19:04
-
-
Save adamcfraser/022f368447d807067a6cb0cfd8ab0b10 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set | |
# Abort on errors | |
set -e | |
# Output all executed shell commands | |
set -x | |
# Helper function to repeat until it fails | |
repeat() { | |
number=$1 | |
shift | |
for i in `seq $number`; do | |
$@ | |
if [ $? -ne 0 ]; then | |
return $? | |
fi | |
done | |
} | |
# "gvm use $GO_VERSION" is not working. It gives the same error as | |
# described in https://github.com/moovweb/gvm/issues/188. Even working | |
# around it by the fix described in https://github.com/moovweb/gvm/issues/177 | |
# is not setting the $PATH for subshells. To work around it, manually set | |
# the path to the version installed via "gvm install ..". | |
export PATH=$PATH:/root/.gvm/gos/$GO_VERSION/bin | |
echo "PATH: $PATH" | |
go version | |
# -------------- Sync Gateway Build ------------------- | |
# Get bootstrap script | |
wget https://raw.githubusercontent.com/couchbase/sync_gateway/$SG_COMMIT/bootstrap.sh | |
chmod +x bootstrap.sh | |
pwd | |
ls -alh | |
# Run bootstrap script | |
if [ "$BUILD_TEST_SG_ACCEL" == "true" ]; then | |
./bootstrap.sh -c $SG_COMMIT -p sg-accel | |
else | |
./bootstrap.sh -c $SG_COMMIT | |
fi | |
# -------------- Install Couchbase Server ------------------- | |
# Delete previous install (the "|| true" at the end prevents a non-zero exit code if not previously installed) | |
rpm -qe couchbase-server | xargs rpm -e || true | |
# Download couchbase rpm | |
wget $CB_SERVER_RPM_URL | |
# Install couchbase | |
RPM_FILENAME=$(basename "$CB_SERVER_RPM_URL") | |
rpm -i $RPM_FILENAME | |
# Wait for a bit for couchbase to boot up | |
sleep 10 | |
# -------------- Environment Variables ------------------- | |
# Print out the specific commit hashes used in this build | |
# because having branch names isn't enough sometimes | |
cd "$WORKSPACE/godeps/src/github.com/couchbase/sync_gateway" | |
echo "sync_gateway git commit hash: $(git rev-parse HEAD)" | |
cd $WORKSPACE | |
export SG_TEST_BACKING_STORE="$SG_TEST_BACKING_STORE" | |
export SG_TEST_COUCHBASE_SERVER_URL="http://localhost:8091" | |
export SG_TEST_USE_XATTRS="$SG_TEST_USE_XATTRS" | |
export SG_TEST_DROP_INDEXES="$SG_TEST_DROP_INDEXES" | |
export SG_TEST_TIMEOUT="$SG_TEST_TIMEOUT" | |
# Should we run the tests with -race? | |
RACE_FLAG="" | |
if [ "$DETECT_RACES" == "true" ]; then | |
RACE_FLAG="-race" | |
fi | |
# Should we run the tests with -v? | |
VERBOSE_FLAG="" | |
if [ "$VERBOSE_TESTS" == "true" ]; then | |
VERBOSE_FLAG="-v" | |
fi | |
# Should we run all tests, or be more specific? | |
RUN_FLAG="" | |
if [ "$TARGET_TEST" != "ALL" ]; then | |
RUN_FLAG="-run $TARGET_TEST" | |
fi | |
# -------------- Run Tests ------------------- | |
repeat $NUM_TIMES_REPEAT ./test.sh $RACE_FLAG $VERBOSE_FLAG $RUN_FLAG | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment