From 5e3963910ef748b85f4a84460eac89f18ac0a3f7 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 3 Jul 2016 16:44:05 +0300 Subject: Add --enable-Werror into travis. --- .travis.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7aa0c7000..6b09a25f1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,17 +31,17 @@ matrix: - env: ignore=this include: - compiler: clang - env: CONFIGURE_FLAGS="--enable-debug" + env: CONFIGURE_FLAGS="--enable-debug --enable-Werror" - compiler: clang - env: CONFIGURE_FLAGS="--enable-debug --disable-renewal" + env: CONFIGURE_FLAGS="--enable-debug --disable-renewal --enable-Werror" - compiler: gcc - env: CONFIGURE_FLAGS="--enable-debug" + env: CONFIGURE_FLAGS="--enable-debug --enable-Werror" - compiler: gcc - env: CONFIGURE_FLAGS="--enable-debug --disable-renewal" + env: CONFIGURE_FLAGS="--enable-debug --disable-renewal --enable-Werror" - 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" - 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" notifications: email: false -- cgit v1.2.3-60-g2f50 From c96e3c44f59333378adb87d155884b1bea1a25d0 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 3 Jul 2016 16:52:00 +0300 Subject: Add gcc 6 into travis. --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index 6b09a25f1..259b1bf72 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 @@ -42,6 +43,10 @@ matrix: env: LDFLAGS="-fuse-ld=gold" CONFIGURE_FLAGS="--enable-debug --enable-sanitize=full CC=gcc-5 --disable-manager --enable-Werror" - compiler: gcc env: LDFLAGS="-fuse-ld=gold" CONFIGURE_FLAGS="--enable-debug --enable-sanitize=full CC=gcc-5 --disable-manager --disable-renewal --enable-Werror" + - compiler: gcc + env: LDFLAGS="-fuse-ld=gold" CONFIGURE_FLAGS="--enable-debug --enable-sanitize=full CC=gcc-6 --disable-manager --enable-Werror" + - compiler: gcc + env: LDFLAGS="-fuse-ld=gold" CONFIGURE_FLAGS="--enable-debug --enable-sanitize=full CC=gcc-6 --disable-manager --disable-renewal --enable-Werror" notifications: email: false -- cgit v1.2.3-60-g2f50 From 1e07ec7b4d232902530f3457e7237353a40262f6 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 3 Jul 2016 17:56:41 +0300 Subject: Add --run-once flag into login server. --- configure | 2 +- src/login/login.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/configure b/configure index d5d5528c0..88950feb3 100755 --- a/configure +++ b/configure @@ -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/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); } -- cgit v1.2.3-60-g2f50 From ee1e885da332d6103d1228bf21fedff762f84139 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 3 Jul 2016 18:03:11 +0300 Subject: Add --run-once flag into char server. --- src/char/char.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/char/char.c b/src/char/char.c index cf2f7d87c..613a3deec 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); -- cgit v1.2.3-60-g2f50 From df05163715bd33dfe7a50d1f68f0ed997b281923 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 3 Jul 2016 18:06:59 +0300 Subject: Run all servers in travis check. --- travis.sh | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/travis.sh b/travis.sh index b1f639935..646532374 100755 --- a/travis.sh +++ b/travis.sh @@ -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..." -- cgit v1.2.3-60-g2f50 From 33e4f2773b43a04b388a5769d65d9173acdc992d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 3 Jul 2016 18:26:48 +0300 Subject: Add into travis configure option --enable-buildbot. Also disable all known default warnings if build bot option enabled. --- .travis.yml | 16 ++++++++-------- src/char/char.c | 2 ++ src/common/socket.c | 2 ++ src/map/chrif.c | 2 ++ src/map/map.c | 2 ++ 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 259b1bf72..62f2f7cbc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,21 +32,21 @@ matrix: - env: ignore=this include: - compiler: clang - env: CONFIGURE_FLAGS="--enable-debug --enable-Werror" + env: CONFIGURE_FLAGS="--enable-debug --enable-Werror --enable-buildbot" - compiler: clang - env: CONFIGURE_FLAGS="--enable-debug --disable-renewal --enable-Werror" + env: CONFIGURE_FLAGS="--enable-debug --disable-renewal --enable-Werror --enable-buildbot" - compiler: gcc - env: CONFIGURE_FLAGS="--enable-debug --enable-Werror" + env: CONFIGURE_FLAGS="--enable-debug --enable-Werror --enable-buildbot" - compiler: gcc - env: CONFIGURE_FLAGS="--enable-debug --disable-renewal --enable-Werror" + 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 --enable-Werror" + 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 --enable-Werror" + 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" + 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" + 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 diff --git a/src/char/char.c b/src/char/char.c index 613a3deec..5f92e37bf 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -5815,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/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/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"); -- cgit v1.2.3-60-g2f50 From 7b350fbf497d737c12cc03ddd888bb6a0ee486e4 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 3 Jul 2016 18:28:32 +0300 Subject: Replace all warnings to errors if build bot configure option enabled. --- src/common/showmsg.h | 4 ++++ 1 file changed, 4 insertions(+) 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__)) -- cgit v1.2.3-60-g2f50