diff options
Diffstat (limited to 'tools/ci')
-rwxr-xr-x | tools/ci/retry.sh | 2 | ||||
-rwxr-xr-x | tools/ci/travis.sh | 62 |
2 files changed, 50 insertions, 14 deletions
diff --git a/tools/ci/retry.sh b/tools/ci/retry.sh index 6e79af1d5..688f02d9a 100755 --- a/tools/ci/retry.sh +++ b/tools/ci/retry.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # This file is part of Hercules. # http://herc.ws - http://github.com/HerculesWS/Hercules diff --git a/tools/ci/travis.sh b/tools/ci/travis.sh index 9a6322df6..fa7d5be93 100755 --- a/tools/ci/travis.sh +++ b/tools/ci/travis.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # This file is part of Hercules. # http://herc.ws - http://github.com/HerculesWS/Hercules @@ -33,6 +33,7 @@ function usage { echo "usage:" echo " $0 createdb <dbname> [dbuser] [dbpassword] [dbhost]" echo " $0 importdb <dbname> [dbuser] [dbpassword] [dbhost]" + echo " $0 adduser <dbname> <new_user> <new_user_password> [dbuser] [dbpassword] [dbhost]" echo " $0 build [configure args]" echo " $0 test <dbname> [dbuser] [dbpassword] [dbhost]" echo " $0 getplugins" @@ -48,10 +49,10 @@ function run_server { echo "Running: $1 --run-once $2" $1 --run-once $2 2>runlog.txt export errcode=$? - export teststr=$(cat runlog.txt) + export teststr=$(head -c 10000 runlog.txt) if [[ -n "${teststr}" ]]; then echo "Errors found in running server $1." - cat runlog.txt + head -c 10000 runlog.txt aborterror "Errors found in running server $1." else echo "No errors found for server $1." @@ -66,10 +67,10 @@ function run_test { echo "Running: test_$1" ./test_$1 2>runlog.txt export errcode=$? - export teststr=$(cat runlog.txt) + export teststr=$(head -c 10000 runlog.txt) if [[ -n "${teststr}" ]]; then echo "Errors found in running test $1." - cat runlog.txt + head -c 10000 runlog.txt aborterror "Errors found in running test $1." else echo "No errors found for test $1." @@ -93,29 +94,53 @@ case "$MODE" in fi DBNAME="$1" if [ -n "$2" ]; then - DBUSER_ARG="-u $2" + DBUSER_ARG="--user=$2" DBUSER="$2" fi if [ -n "$3" ]; then - DBPASS_ARG="-p$3" + DBPASS_ARG="--password=$3" DBPASS="$3" fi if [ -n "$4" ]; then - DBHOST_ARG="-h $4" + DBHOST_ARG="--host=$4" DBHOST="$4" fi ;; + adduser) + if [ -z "$3" ]; then + usage + fi + DBNAME="$1" + NEWUSER="$2" + NEWPASS="$3" + if [ -n "$4" ]; then + DBUSER_ARG="--user=$4" + DBUSER="$4" + fi + if [ -n "$5" ]; then + DBPASS_ARG="--password=$5" + DBPASS="$5" + fi + if [ -n "$6" ]; then + DBHOST_ARG="--host=$6" + DBHOST="$6" + fi + ;; esac case "$MODE" in createdb) - echo "Creating database $DBNAME..." - mysql $DBUSER_ARG $DBPASS_ARG $DBHOST_ARG -e "create database $DBNAME;" || aborterror "Unable to create database." + echo "Creating database $DBNAME as $DBUSER..." + mysql $DBUSER_ARG $DBPASS_ARG $DBHOST_ARG --execute="CREATE DATABASE $DBNAME;" || aborterror "Unable to create database." ;; importdb) - echo "Importing tables into $DBNAME..." - mysql $DBUSER_ARG $DBPASS_ARG $DBHOST_ARG $DBNAME < sql-files/main.sql || aborterror "Unable to import main database." - mysql $DBUSER_ARG $DBPASS_ARG $DBHOST_ARG $DBNAME < sql-files/logs.sql || aborterror "Unable to import logs database." + echo "Importing tables into $DBNAME as $DBUSER..." + mysql $DBUSER_ARG $DBPASS_ARG $DBHOST_ARG --database=$DBNAME < sql-files/main.sql || aborterror "Unable to import main database." + mysql $DBUSER_ARG $DBPASS_ARG $DBHOST_ARG --database=$DBNAME < sql-files/logs.sql || aborterror "Unable to import logs database." + ;; + adduser) + echo "Adding user $NEWUSER as $DBUSER, with access to database $DBNAME..." + mysql $DBUSER_ARG $DBPASS_ARG $DBHOST_ARG --execute="GRANT SELECT,INSERT,UPDATE,DELETE ON $DBNAME.* TO '$NEWUSER'@'$DBHOST' IDENTIFIED BY '$NEWPASS';" ;; build) (cd tools && ./validateinterfaces.py silent) || aborterror "Interface validation error." @@ -125,6 +150,11 @@ case "$MODE" in make plugin.script_mapquit -j3 || aborterror "Build failed." make test || aborterror "Build failed." ;; + buildhpm) + ./configure $@ || (cat config.log && aborterror "Configure error, aborting build.") + cd tools/HPMHookGen + make + ;; test) cat > conf/travis_sql_connection.conf << EOF sql_connection: { @@ -173,6 +203,12 @@ EOF ARGS="--load-plugin script_mapquit $ARGS --load-script npc/dev/ci_test.txt" PLUGINS="--load-plugin HPMHooking --load-plugin sample" echo "run tests" + if [[ $DBUSER == "travis" ]]; then + echo "Disable leak dection on travis" + export ASAN_OPTIONS=detect_leaks=0:detect_stack_use_after_return=true:strict_init_order=true + else + export ASAN_OPTIONS=detect_stack_use_after_return=true:strict_init_order=true + fi # run_test spinlock # Not running the spinlock test for the time being (too time consuming) run_test libconfig echo "run all servers without HPM" |