diff options
author | panikon <panikon@zoho.com> | 2014-05-11 13:36:23 -0300 |
---|---|---|
committer | panikon <panikon@zoho.com> | 2014-05-11 13:36:23 -0300 |
commit | b0fb6e0aab72ebf4a465d013493a0df598ed5edb (patch) | |
tree | b78e8bd70700e2a8c076641c27c4137d7291a687 | |
parent | 3959b35170b784b47423a0533438ac67250a997f (diff) | |
parent | 23f7856488fb6f723778867a467efcea53edad59 (diff) | |
download | hercules-b0fb6e0aab72ebf4a465d013493a0df598ed5edb.tar.gz hercules-b0fb6e0aab72ebf4a465d013493a0df598ed5edb.tar.bz2 hercules-b0fb6e0aab72ebf4a465d013493a0df598ed5edb.tar.xz hercules-b0fb6e0aab72ebf4a465d013493a0df598ed5edb.zip |
Merge branch 'master' of http://github.com/HerculesWS/Hercules
-rw-r--r-- | .travis.yml | 17 | ||||
-rw-r--r-- | doc/atcommands.txt | 4 | ||||
-rw-r--r-- | npc/dev/test.txt | 2 | ||||
-rwxr-xr-x | travis.sh | 117 |
4 files changed, 133 insertions, 7 deletions
diff --git a/.travis.yml b/.travis.yml index 4de81e6a8..a7f6a789f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,14 +2,23 @@ language: c compiler: - clang - gcc + +install: + - ./travis.sh getplugins || true before_script: - - uname -a + - uname -a + - ./travis.sh createdb ragnarok root + - ./travis.sh importdb ragnarok travis + - mysql -u root -e "SET PASSWORD FOR 'travis'@'localhost' = PASSWORD('travis');" script: - - ./configure --enable-debug && make sql -j3 && ./map-server --version - - make clean - - ./configure --disable-renewal --enable-debug && make sql -j3 && ./map-server --version + - ./travis.sh build $CONFIGURE_FLAGS + - ./travis.sh test ragnarok travis travis + +env: + - CONFIGURE_FLAGS="--enable-debug" + - CONFIGURE_FLAGS="--disable-renewal --enable-debug" notifications: email: false diff --git a/doc/atcommands.txt b/doc/atcommands.txt index 4519cfb49..1e2bc786c 100644 --- a/doc/atcommands.txt +++ b/doc/atcommands.txt @@ -875,9 +875,9 @@ Summons the specified amount of spirit spheres around you. --------------------------------------- @mount -@newmount +@mount2 -Toggles mounting/unmounting a peco (@mount) or cash mount (@newmount). +Toggles mounting/unmounting a peco (@mount) or cash mount (@mount2). --------------------------------------- diff --git a/npc/dev/test.txt b/npc/dev/test.txt index 3cc714993..f9e4fc410 100644 --- a/npc/dev/test.txt +++ b/npc/dev/test.txt @@ -708,7 +708,7 @@ OnReportError: if (.errors == 1) debugmes "**** WARNING: Any self-test results past this point are unreliable because of previous errors. ****"; debugmes "Error: "+.@msg$+": '"+.@val$+"' (found) != '"+.@ref$+"' (expected)"; - .errors++; + ++.errors; //end; return; diff --git a/travis.sh b/travis.sh new file mode 100755 index 000000000..6f2eced20 --- /dev/null +++ b/travis.sh @@ -0,0 +1,117 @@ +#!/bin/bash + +MODE="$1" +shift + +function foo { + for i in "$@"; do + echo "> $i" + done +} + +function usage { + echo "usage:" + echo " $0 createdb <dbname> [dbuser] [dbpassword]" + echo " $0 importdb <dbname> [dbuser] [dbpassword]" + echo " $0 build [configure args]" + echo " $0 test <dbname> [dbuser] [dbpassword]" + echo " $0 getplugins" + exit 1 +} + +function aborterror { + echo $@ + exit 1 +} + +case "$MODE" in + createdb|importdb|test) + DBNAME="$1" + DBUSER="$2" + DBPASS="$3" + if [ -z "$DBNAME" ]; then + usage + fi + if [ "$MODE" != "test" ]; then + if [ -n "$DBUSER" ]; then + DBUSER="-u $DBUSER" + fi + if [ -n "$DBPASS" ]; then + DBPASS="-p$DBPASS" + fi + fi + ;; +esac + +case "$MODE" in + createdb) + echo "Creating database $DBNAME..." + mysql $DBUSER $DBPASS -e "create database $DBNAME;" || aborterror "Unable to create database." + ;; + importdb) + echo "Importing tables into $DBNAME..." + mysql $DBUSER $DBPASS $DBNAME < sql-files/main.sql || aborterror "Unable to import main database." + mysql $DBUSER $DBPASS $DBNAME < sql-files/logs.sql || aborterror "Unable to import logs database." + ;; + build) + ./configure $@ || aborterror "Configure error, aborting build." + make sql -j3 || aborterror "Build failed." + if [ -f src/plugins/script_mapquit.c ]; then + make plugin.script_mapquit -j3 || aborterror "Build failed." + fi + ;; + test) + cat >> conf/import/login_conf.txt << EOF +ipban.sql.db_username: $DBUSER +ipban.sql.db_password: $DBPASS +ipban.sql.db_database: $DBNAME +account.sql.db_username: $DBUSER +account.sql.db_password: $DBPASS +account.sql.db_database: $DBNAME +account.sql.db_hostname: localhost +EOF + [ $? -eq 0 ] || aborterror "Unable to import configuration, aborting tests." + cat >> conf/import/inter_conf.txt << EOF +sql.db_username: $DBUSER +sql.db_password: $DBPASS +sql.db_database: $DBNAME +sql.db_hostname: localhost +char_server_id: $DBUSER +char_server_pw: $DBPASS +char_server_db: $DBNAME +char_server_ip: localhost +map_server_id: $DBUSER +map_server_pw: $DBPASS +map_server_db: $DBNAME +map_server_ip: localhost +log_db_id: $DBUSER +log_db_pw: $DBPASS +log_db_db: $DBNAME +log_db_ip: localhost +EOF + [ $? -eq 0 ] || aborterror "Unable to import configuration, aborting tests." + ARGS="--load-script npc/dev/test.txt " + if [ -f src/plugins/script_mapquit.c ]; then + ARGS="--load-plugin script_mapquit $ARGS --load-script npc/dev/ci_test.txt" + fi + echo "Running Hercules with command line: ./map-server --run-once $ARGS" + ./map-server --run-once $ARGS || aborterror "Test failed." + ;; + getplugins) + echo "Cloning plugins repository..." + git clone http://github.com/HerculesWS/StaffPlugins.git || aborterror "Unable to fetch plugin repository" + if [ -f StaffPlugins/Haru/script_mapquit/script_mapquit.c -a -f StaffPlugins/Haru/script_mapquit/examples/ci_test.txt ]; then + pushd src/plugins || aborterror "Unable to enter plugins directory." + ln -s ../../StaffPlugins/Haru/script_mapquit/script_mapquit.c ./ + popd + pushd npc/dev || aborterror "Unable to enter scripts directory." + ln -s ../../StaffPlugins/Haru/script_mapquit/examples/ci_test.txt ./ + popd + else + echo "Plugin not found, skipping advanced tests." + fi + ;; + *) + usage + ;; +esac |