diff options
-rw-r--r-- | .travis.yml | 17 | ||||
-rwxr-xr-x | configure | 2 | ||||
-rw-r--r-- | src/char/char.c | 16 | ||||
-rw-r--r-- | src/common/showmsg.h | 4 | ||||
-rw-r--r-- | src/common/socket.c | 2 | ||||
-rw-r--r-- | src/login/login.c | 14 | ||||
-rw-r--r-- | src/map/chrif.c | 2 | ||||
-rw-r--r-- | src/map/map.c | 2 | ||||
-rwxr-xr-x | travis.sh | 34 |
9 files changed, 72 insertions, 21 deletions
diff --git a/.travis.yml b/.travis.yml index 7aa0c7000..62f2f7cbc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ addons: - ubuntu-toolchain-r-test packages: - gcc-5 + - gcc-6 install: - ./travis.sh getplugins || true @@ -31,17 +32,21 @@ matrix: - env: ignore=this include: - compiler: clang - env: CONFIGURE_FLAGS="--enable-debug" + env: CONFIGURE_FLAGS="--enable-debug --enable-Werror --enable-buildbot" - compiler: clang - env: CONFIGURE_FLAGS="--enable-debug --disable-renewal" + env: CONFIGURE_FLAGS="--enable-debug --disable-renewal --enable-Werror --enable-buildbot" - compiler: gcc - env: CONFIGURE_FLAGS="--enable-debug" + env: CONFIGURE_FLAGS="--enable-debug --enable-Werror --enable-buildbot" - compiler: gcc - env: CONFIGURE_FLAGS="--enable-debug --disable-renewal" + env: CONFIGURE_FLAGS="--enable-debug --disable-renewal --enable-Werror --enable-buildbot" - compiler: gcc - env: LDFLAGS="-fuse-ld=gold" CONFIGURE_FLAGS="--enable-debug --enable-sanitize=full CC=gcc-5 --disable-manager" + env: LDFLAGS="-fuse-ld=gold" CONFIGURE_FLAGS="--enable-debug --enable-sanitize=full CC=gcc-5 --disable-manager --enable-Werror --enable-buildbot" - compiler: gcc - env: LDFLAGS="-fuse-ld=gold" CONFIGURE_FLAGS="--enable-debug --enable-sanitize=full CC=gcc-5 --disable-manager --disable-renewal" + env: LDFLAGS="-fuse-ld=gold" CONFIGURE_FLAGS="--enable-debug --enable-sanitize=full CC=gcc-5 --disable-manager --disable-renewal --enable-Werror --enable-buildbot" + - compiler: gcc + env: LDFLAGS="-fuse-ld=gold" CONFIGURE_FLAGS="--enable-debug --enable-sanitize=full CC=gcc-6 --disable-manager --enable-Werror --enable-buildbot" + - compiler: gcc + env: LDFLAGS="-fuse-ld=gold" CONFIGURE_FLAGS="--enable-debug --enable-sanitize=full CC=gcc-6 --disable-manager --disable-renewal --enable-Werror --enable-buildbot" notifications: email: false @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac 690e18f. +# From configure.ac c96e3c4. # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69. # diff --git a/src/char/char.c b/src/char/char.c index cf2f7d87c..5f92e37bf 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -5758,11 +5758,25 @@ static CMDLINEARG(netconfig) chr->NET_CONF_NAME = aStrdup(params); return true; } + +/** + * --run-once handler + * + * Causes the server to run its loop once, and shutdown. Useful for testing. + * @see cmdline->exec + */ +static CMDLINEARG(runonce) +{ + core->runflag = CORE_ST_STOP; + return true; +} + /** * Initializes the command line arguments handlers. */ void cmdline_args_init_local(void) { + CMDLINEARG_DEF2(run-once, runonce, "Closes server after loading (testing).", CMDLINE_OPT_NORMAL); CMDLINEARG_DEF2(char-config, charconfig, "Alternative char-server configuration.", CMDLINE_OPT_PARAM); CMDLINEARG_DEF2(inter-config, interconfig, "Alternative inter-server configuration.", CMDLINE_OPT_PARAM); CMDLINEARG_DEF2(net-config, netconfig, "Alternative network configuration.", CMDLINE_OPT_PARAM); @@ -5801,11 +5815,13 @@ int do_init(int argc, char **argv) { sockt->net_config_read(chr->NET_CONF_NAME); chr->sql_config_read(chr->SQL_CONF_NAME); +#ifndef BUILDBOT if (strcmp(chr->userid, "s1")==0 && strcmp(chr->passwd, "p1")==0) { ShowWarning("Using the default user/password s1/p1 is NOT RECOMMENDED.\n"); ShowNotice("Please edit your 'login' table to create a proper inter-server user/password (gender 'S')\n"); ShowNotice("And then change the user/password to use in conf/char-server.conf (or conf/import/char_conf.txt)\n"); } +#endif inter->init_sql(chr->INTER_CONF_NAME); // inter server configuration diff --git a/src/common/showmsg.h b/src/common/showmsg.h index 7b48d0df2..303c8dd28 100644 --- a/src/common/showmsg.h +++ b/src/common/showmsg.h @@ -130,7 +130,11 @@ struct showmsg_interface { #define ShowSQL(fmt, ...) (showmsg->showSQL((fmt), ##__VA_ARGS__)) #define ShowInfo(fmt, ...) (showmsg->showInfo((fmt), ##__VA_ARGS__)) #define ShowNotice(fmt, ...) (showmsg->showNotice((fmt), ##__VA_ARGS__)) +#ifdef BUILDBOT +#define ShowWarning(fmt, ...) (showmsg->showError((fmt), ##__VA_ARGS__)) +#else // BUILDBOT #define ShowWarning(fmt, ...) (showmsg->showWarning((fmt), ##__VA_ARGS__)) +#endif // BUILDBOT #define ShowDebug(fmt, ...) (showmsg->showDebug((fmt), ##__VA_ARGS__)) #define ShowError(fmt, ...) (showmsg->showError((fmt), ##__VA_ARGS__)) #define ShowFatalError(fmt, ...) (showmsg->showFatalError((fmt), ##__VA_ARGS__)) diff --git a/src/common/socket.c b/src/common/socket.c index 75b6128b6..60759d0bb 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -1752,10 +1752,12 @@ void socket_net_config_read(const char *filename) ShowError("No allowed server IP ranges configured. This server won't be able to accept connections from any char servers.\n"); } ARR_FIND(0, VECTOR_LENGTH(sockt->allowed_ips), i, SUBNET_MATCH(0, VECTOR_INDEX(sockt->allowed_ips, i).ip, VECTOR_INDEX(sockt->allowed_ips, i).mask)); +#ifndef BUILDBOT if (i != VECTOR_LENGTH(sockt->allowed_ips)) { ShowWarning("Using a wildcard IP range in the allowed server IPs is NOT RECOMMENDED.\n"); ShowNotice("Please edit your '%s' allowed list to fit your network configuration.\n", filename); } +#endif libconfig->destroy(&network_config); return; } diff --git a/src/login/login.c b/src/login/login.c index d7c7321d8..49508d564 100644 --- a/src/login/login.c +++ b/src/login/login.c @@ -1671,6 +1671,19 @@ static CMDLINEARG(loginconfig) login->LOGIN_CONF_NAME = aStrdup(params); return true; } + +/** + * --run-once handler + * + * Causes the server to run its loop once, and shutdown. Useful for testing. + * @see cmdline->exec + */ +static CMDLINEARG(runonce) +{ + core->runflag = CORE_ST_STOP; + return true; +} + /** * --net-config handler * @@ -1688,6 +1701,7 @@ static CMDLINEARG(netconfig) */ void cmdline_args_init_local(void) { + CMDLINEARG_DEF2(run-once, runonce, "Closes server after loading (testing).", CMDLINE_OPT_NORMAL); CMDLINEARG_DEF2(login-config, loginconfig, "Alternative login-server configuration.", CMDLINE_OPT_PARAM); CMDLINEARG_DEF2(net-config, netconfig, "Alternative subnet configuration.", CMDLINE_OPT_PARAM); } diff --git a/src/map/chrif.c b/src/map/chrif.c index 52af1137e..51e8e5143 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -236,11 +236,13 @@ void chrif_setpasswd(char *pwd) { // security check, prints warning if using default password void chrif_checkdefaultlogin(void) { +#ifndef BUILDBOT if (strcmp(chrif->userid, "s1")==0 && strcmp(chrif->passwd, "p1")==0) { ShowWarning("Using the default user/password s1/p1 is NOT RECOMMENDED.\n"); ShowNotice("Please edit your 'login' table to create a proper inter-server user/password (gender 'S')\n"); ShowNotice("and then edit your user/password in conf/map-server.conf (or conf/import/map_conf.txt)\n"); } +#endif } // sets char-server's ip address diff --git a/src/map/map.c b/src/map/map.c index 779f8d601..30c849ed1 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -6062,7 +6062,9 @@ int do_init(int argc, char *argv[]) char ip_str[16]; sockt->ip2str(sockt->addr_[0], ip_str); +#ifndef BUILDBOT ShowWarning("Not all IP addresses in /conf/map-server.conf configured, auto-detecting...\n"); +#endif if (sockt->naddr_ == 0) ShowError("Unable to determine your IP address...\n"); @@ -44,6 +44,23 @@ function aborterror { exit 1 } +function run_server { + $1 --run-once $2 2>runlog.txt + export errcode=$? + export teststr=$(cat runlog.txt) + if [[ -n "${teststr}" ]]; then + echo "Errors found in running server $1." + cat runlog.txt + aborterror "Errors found in running server $1." + else + echo "No errors found for server $1." + fi + if [ ${errcode} -ne 0 ]; then + echo "server $1 terminated with exit code ${errcode}" + aborterror "Test failed" + fi +} + case "$MODE" in createdb|importdb|test) DBNAME="$1" @@ -112,20 +129,9 @@ EOF ARGS="--load-script npc/dev/test.txt " ARGS="--load-plugin script_mapquit $ARGS --load-script npc/dev/ci_test.txt" echo "Running Hercules with command line: ./map-server --run-once $ARGS" - ./map-server --run-once $ARGS 2>runlog.txt - export errcode=$? - export teststr=$(cat runlog.txt) - if [[ -n "${teststr}" ]]; then - echo "Sanitizer errors found." - cat runlog.txt - aborterror "Sanitize errors found." - else - echo "No sanitizer errors found." - fi - if [ ${errcode} -ne 0 ]; then - echo "server terminated with exit code ${errcode}" - aborterror "Test failed" - fi + run_server ./login-server + run_server ./char-server + run_server ./map-server "$ARGS" ;; getplugins) echo "Cloning plugins repository..." |