From 4f21b8d169f762608680a1f98f0b4dbc73a3f405 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 5 Jun 2020 09:13:02 +0300 Subject: Show runlog.txt on libconfig tests crash --- tools/ci/travis.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/ci/travis.sh b/tools/ci/travis.sh index 10c653925..489e15bc7 100755 --- a/tools/ci/travis.sh +++ b/tools/ci/travis.sh @@ -71,7 +71,8 @@ function run_server { function run_test { echo "Running: test_$1" sysctl -w kernel.core_pattern=core || true - ./test_$1 2>runlog.txt + rm -rf core* || true + CRASH_PLEASE=1 ./test_$1 2>runlog.txt export errcode=$? export teststr=$(head -c 10000 runlog.txt) if [[ -n "${teststr}" ]]; then @@ -83,6 +84,13 @@ function run_test { fi if [ ${errcode} -ne 0 ]; then echo "test $1 terminated with exit code ${errcode}" + echo cat runlog.txt + cat runlog.txt + echo crash dump + COREFILE=$(find . -maxdepth 1 -name "core*" | head -n 1) + if [[ -f "$COREFILE" ]]; then + gdb -c "$COREFILE" $1 -ex "thread apply all bt" -ex "set pagination 0" -batch + fi aborterror "Test failed" fi } -- cgit v1.2.3-70-g09d2 From 993d28e6afc3a3406c0197973dc9289a95c5d81e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 6 Jun 2020 07:09:31 +0300 Subject: Use python2 in validateinterfaces.py --- tools/validateinterfaces.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/validateinterfaces.py b/tools/validateinterfaces.py index e031c34ab..6758ba44f 100755 --- a/tools/validateinterfaces.py +++ b/tools/validateinterfaces.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python2 # -*- coding: utf8 -*- # # This file is part of Hercules. -- cgit v1.2.3-70-g09d2 From 56a402c6b096a4b3f7bd6e27ba1dace44638c4dc Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 6 Jun 2020 07:55:16 +0300 Subject: Convert validateinterfaces.py to python3 --- tools/validateinterfaces.py | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) (limited to 'tools') diff --git a/tools/validateinterfaces.py b/tools/validateinterfaces.py index 6758ba44f..324a2aeec 100755 --- a/tools/validateinterfaces.py +++ b/tools/validateinterfaces.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python2 +#! /usr/bin/env python # -*- coding: utf8 -*- # # This file is part of Hercules. @@ -23,7 +23,6 @@ import os import re import sys -from sets import Set interfaceRe = re.compile("struct (?P[a-z_]+)_interface (?P[a-z_]+)_s;") @@ -44,7 +43,7 @@ def searchStructStart(r, ifname): return False def readCFile(tracker, cFile): - methods = Set() + methods = set() shortIfName = "" with open(cFile, "r") as r: for line in r: @@ -78,7 +77,7 @@ def readCFile(tracker, cFile): return (None, shortIfName, methods) def readHFile(tracker, hFile, ifname): - methods = Set() + methods = set() with open(hFile, "r") as r: if searchStructStart(r, ifname) == False: return methods @@ -108,7 +107,7 @@ def checkIfFile(tracker, cFile, hFile): tracker.arr[ifname + "_" + method] = list() tracker.methods.add(ifname + "_" + method) if method not in cMethods: - print "Missing initialisation in file {0}: {1}".format(cFile, method) + print("Missing initialisation in file {0}: {1}".format(cFile, method)) tracker.retCode = 1 # for method in cMethods: # if method not in hMethods: @@ -175,13 +174,13 @@ def processDir(tracker, srcDir): checkFile(tracker, cPath) def reportMethods(tracker): - print "\n" + print("\n") for method in tracker.methods: if len(tracker.arr[method]) > 2: - print method + print(method) for t in tracker.arr[method]: - print t - print "\n" + print(t) + print("\n") def checkLostFile(tracker, cFile): @@ -198,7 +197,7 @@ def checkLostFile(tracker, cFile): continue if name not in tracker.fullmethods: # print "src : " + line - print name + print(name) def processLostDir(tracker, srcDir): files = os.listdir(srcDir) @@ -232,9 +231,9 @@ def runLong(): tracker = Tracker() tracker.arr = dict() -tracker.methods = Set() -tracker.fullmethods = Set() -tracker.interfaces = Set() +tracker.methods = set() +tracker.fullmethods = set() +tracker.interfaces = set() tracker.retCode = 0 if len(sys.argv) > 1: @@ -245,19 +244,19 @@ else: if cmd == "silent": runIf() elif cmd == "init": - print "Checking interfaces initialisation" + print("Checking interfaces initialisation") runIf() elif cmd == "lost": - print "Checking not added functions to interfaces" + print("Checking not added functions to interfaces") runLost(); elif cmd == "long": - print "Checking interfaces usage" + print("Checking interfaces usage") runLong(); else: - print "Checking interfaces initialisation" + print("Checking interfaces initialisation") runIf() - print "Checking not added functions to interfaces" + print("Checking not added functions to interfaces") runLost(); - print "Checking interfaces usage" + print("Checking interfaces usage") runLong(); exit(tracker.retCode) -- cgit v1.2.3-70-g09d2 From 93f613c3565151fd8478a6b7563d2af1850b2a86 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 6 Jun 2020 07:33:14 +0300 Subject: Add workaround for create sql user and grant rights to it In some mysql version default grant code not works. --- tools/ci/travis.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/ci/travis.sh b/tools/ci/travis.sh index 489e15bc7..a268f38eb 100755 --- a/tools/ci/travis.sh +++ b/tools/ci/travis.sh @@ -154,7 +154,12 @@ case "$MODE" in ;; 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';" + echo 'mysql $DBUSER_ARG $DBPASS_ARG $DBHOST_ARG --execute="GRANT SELECT,INSERT,UPDATE,DELETE ON $DBNAME.* TO '$NEWUSER'@'$DBHOST' IDENTIFIED BY '$NEWPASS';"' || true + mysql $DBUSER_ARG $DBPASS_ARG $DBHOST_ARG --execute="GRANT SELECT,INSERT,UPDATE,DELETE ON $DBNAME.* TO '$NEWUSER'@'$DBHOST' IDENTIFIED BY '$NEWPASS';" || true + echo 'mysql $DBUSER_ARG $DBPASS_ARG $DBHOST_ARG --execute="CREATE USER '$NEWUSER'@'$DBHOST' IDENTIFIED BY '$NEWPASS';"' || true + mysql $DBUSER_ARG $DBPASS_ARG $DBHOST_ARG --execute="CREATE USER '$NEWUSER'@'$DBHOST' IDENTIFIED BY '$NEWPASS';" || true + echo 'mysql $DBUSER_ARG $DBPASS_ARG $DBHOST_ARG --execute="GRANT SELECT,INSERT,UPDATE,DELETE ON $DBNAME.* TO '$NEWUSER'@'$DBHOST';"' || true + mysql $DBUSER_ARG $DBPASS_ARG $DBHOST_ARG --execute="GRANT SELECT,INSERT,UPDATE,DELETE ON $DBNAME.* TO '$NEWUSER'@'$DBHOST';" || true ;; build) (cd tools && ./validateinterfaces.py silent) || aborterror "Interface validation error." -- cgit v1.2.3-70-g09d2 From d27c70c87ba0728bd12193ceb15484a1919fa068 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 6 Jun 2020 09:26:53 +0300 Subject: Update travis.sh with fixes for travis and new os --- tools/ci/travis.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'tools') diff --git a/tools/ci/travis.sh b/tools/ci/travis.sh index a268f38eb..2e0684dbf 100755 --- a/tools/ci/travis.sh +++ b/tools/ci/travis.sh @@ -37,6 +37,7 @@ function usage { echo " $0 build [configure args]" echo " $0 test [dbuser] [dbpassword] [dbhost]" echo " $0 getplugins" + echo " $0 startmysql" exit 1 } @@ -154,12 +155,14 @@ case "$MODE" in ;; adduser) echo "Adding user $NEWUSER as $DBUSER, with access to database $DBNAME..." - echo 'mysql $DBUSER_ARG $DBPASS_ARG $DBHOST_ARG --execute="GRANT SELECT,INSERT,UPDATE,DELETE ON $DBNAME.* TO '$NEWUSER'@'$DBHOST' IDENTIFIED BY '$NEWPASS';"' || true mysql $DBUSER_ARG $DBPASS_ARG $DBHOST_ARG --execute="GRANT SELECT,INSERT,UPDATE,DELETE ON $DBNAME.* TO '$NEWUSER'@'$DBHOST' IDENTIFIED BY '$NEWPASS';" || true - echo 'mysql $DBUSER_ARG $DBPASS_ARG $DBHOST_ARG --execute="CREATE USER '$NEWUSER'@'$DBHOST' IDENTIFIED BY '$NEWPASS';"' || true mysql $DBUSER_ARG $DBPASS_ARG $DBHOST_ARG --execute="CREATE USER '$NEWUSER'@'$DBHOST' IDENTIFIED BY '$NEWPASS';" || true - echo 'mysql $DBUSER_ARG $DBPASS_ARG $DBHOST_ARG --execute="GRANT SELECT,INSERT,UPDATE,DELETE ON $DBNAME.* TO '$NEWUSER'@'$DBHOST';"' || true mysql $DBUSER_ARG $DBPASS_ARG $DBHOST_ARG --execute="GRANT SELECT,INSERT,UPDATE,DELETE ON $DBNAME.* TO '$NEWUSER'@'$DBHOST';" || true + mysql $DBUSER_ARG $DBPASS_ARG $DBHOST_ARG --execute="ALTER USER '$NEWUSER'@'$DBHOST' IDENTIFIED BY '$NEWPASS';" || true + mysql --defaults-file=/etc/mysql/debian.cnf $DBPASS_ARG $DBHOST_ARG --execute="CREATE USER '$NEWUSER'@'$DBHOST' IDENTIFIED BY '$NEWPASS';" || true + mysql --defaults-file=/etc/mysql/debian.cnf $DBPASS_ARG $DBHOST_ARG --execute="GRANT SELECT,INSERT,UPDATE,DELETE ON $DBNAME.* TO '$NEWUSER'@'$DBHOST';" || true + mysql --defaults-file=/etc/mysql/debian.cnf $DBPASS_ARG $DBHOST_ARG --execute="ALTER USER '$NEWUSER'@'$DBHOST' IDENTIFIED BY '$NEWPASS';" || true + ;; build) (cd tools && ./validateinterfaces.py silent) || aborterror "Interface validation error." @@ -251,6 +254,13 @@ EOF # echo "Plugin not found, skipping advanced tests." #fi ;; + startmysql) + echo "Starting mysql..." + service mysql status || true + service mysql stop || true + service mysql start || true + service mysql status || true + ;; *) usage ;; -- cgit v1.2.3-70-g09d2 From 6a491c515944da24d995d80face1a57133b230f6 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 8 Jun 2020 03:50:27 +0300 Subject: Disable odr violation detection in ci --- tools/ci/travis.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/ci/travis.sh b/tools/ci/travis.sh index 2e0684dbf..195bee2f8 100755 --- a/tools/ci/travis.sh +++ b/tools/ci/travis.sh @@ -227,9 +227,9 @@ EOF 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 + export ASAN_OPTIONS=detect_leaks=0:detect_stack_use_after_return=true:strict_init_order=true:detect_odr_violation=0 else - export ASAN_OPTIONS=detect_stack_use_after_return=true:strict_init_order=true + export ASAN_OPTIONS=detect_stack_use_after_return=true:strict_init_order=true:detect_odr_violation=0 fi # run_test spinlock # Not running the spinlock test for the time being (too time consuming) run_test libconfig -- cgit v1.2.3-70-g09d2 From ad15a28454e81aa1258868a5002eab0c31fabf2f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 8 Jun 2020 10:36:26 +0300 Subject: Run servers in travis.sh with all existing plugins --- tools/ci/travis.sh | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/ci/travis.sh b/tools/ci/travis.sh index 195bee2f8..1014787a8 100755 --- a/tools/ci/travis.sh +++ b/tools/ci/travis.sh @@ -223,7 +223,7 @@ EOF [ $? -eq 0 ] || aborterror "Unable to override inter-server configuration, aborting tests." ARGS="--load-script npc/dev/test.txt " ARGS="--load-plugin script_mapquit $ARGS --load-script npc/dev/ci_test.txt" - PLUGINS="--load-plugin HPMHooking --load-plugin sample" + PLUGINS="--load-plugin HPMHooking" echo "run tests" if [[ $DBUSER == "travis" ]]; then echo "Disable leak dection on travis" @@ -237,10 +237,31 @@ EOF run_server ./login-server run_server ./char-server run_server ./map-server "$ARGS" - echo "run all servers wit HPM" + echo "run all servers with HPM" run_server ./login-server "$PLUGINS" run_server ./char-server "$PLUGINS" run_server ./map-server "$ARGS $PLUGINS" + echo "run all servers with sample plugin" + run_server ./login-server "$PLUGINS --load-plugin sample" + run_server ./char-server "$PLUGINS --load-plugin sample" + run_server ./map-server "$PLUGINS --load-plugin sample" + echo "run all servers with constdb2doc" + run_server ./map-server "$PLUGINS --load-plugin constdb2doc --constdb2doc" + echo "run all servers with db2sql" + run_server ./map-server "$PLUGINS --load-plugin db2sql --db2sql" + run_server ./map-server "$PLUGINS --load-plugin db2sql --itemdb2sql" + run_server ./map-server "$PLUGINS --load-plugin db2sql --mobdb2sql" +# echo "run all servers with dbghelpplug" +# run_server ./login-server "$PLUGINS --load-plugin dbghelpplug" +# run_server ./char-server "$PLUGINS --load-plugin dbghelpplug" +# run_server ./map-server "$PLUGINS --load-plugin dbghelpplug" + echo "run all servers with generate-translations" + run_server ./map-server "$PLUGINS --load-plugin generate-translations --generate-translations" + echo "run all servers with mapcache" +# for other flags need grf or other files + run_server ./map-server "$PLUGINS --load-plugin mapcache --fix-md5" + echo "run all servers with script_mapquit" + run_server ./map-server "$PLUGINS --load-plugin script_mapquit" ;; getplugins) echo "Cloning plugins repository..." -- cgit v1.2.3-70-g09d2 From 0dfeb4a25fc55f965f57c8517095999a1030c72d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 9 Jun 2020 08:18:06 +0300 Subject: Add into travis.sh check with all custom scripts uncommented --- .github/workflows/clang10_test.yml | 6 ++++++ .github/workflows/gcc10_test.yml | 6 ++++++ .github/workflows/gcc9_test.yml | 6 ++++++ .github/workflows/mariadb.yml | 11 +++++++++++ .github/workflows/mysql.yml | 6 ++++++ tools/ci/travis.sh | 11 +++++++++++ tools/ci/uncomment.sh | 4 ++++ 7 files changed, 50 insertions(+) create mode 100755 tools/ci/uncomment.sh (limited to 'tools') diff --git a/.github/workflows/clang10_test.yml b/.github/workflows/clang10_test.yml index 28cb144f6..5fd53c371 100644 --- a/.github/workflows/clang10_test.yml +++ b/.github/workflows/clang10_test.yml @@ -41,6 +41,7 @@ jobs: SQLHOST: mariadb CC: ${{ matrix.CC }} CONFIGURE_FLAGS: CC=${{ matrix.CC }} --enable-debug --enable-Werror --enable-buildbot ${{ matrix.RENEWAL }} ${{ matrix.CLIENT_TYPE }} ${{ matrix.SANITIZER }} ${{ matrix.PACKET_VERSION }} + PACKET_VERSION: ${{ matrix.PACKET_VERSION }} steps: - uses: actions/checkout@v1 with: @@ -70,3 +71,8 @@ jobs: - name: test run: | ./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST + + - name: extra test + if: env.PACKET_VERSION != '--enable-packetver=20130724' + run: | + ./tools/ci/travis.sh extratest diff --git a/.github/workflows/gcc10_test.yml b/.github/workflows/gcc10_test.yml index 1b0909be8..2225fbba1 100644 --- a/.github/workflows/gcc10_test.yml +++ b/.github/workflows/gcc10_test.yml @@ -40,6 +40,7 @@ jobs: SQLHOST: mariadb CC: ${{ matrix.CC }} CONFIGURE_FLAGS: CC=${{ matrix.CC }} --enable-debug --enable-Werror --enable-buildbot ${{ matrix.RENEWAL }} ${{ matrix.CLIENT_TYPE }} ${{ matrix.SANITIZER }} ${{ matrix.PACKET_VERSION }} --enable-lto + PACKET_VERSION: ${{ matrix.PACKET_VERSION }} steps: - uses: actions/checkout@v1 with: @@ -69,3 +70,8 @@ jobs: - name: test run: | ./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST + + - name: extra test + if: env.PACKET_VERSION != '--enable-packetver=20130724' + run: | + ./tools/ci/travis.sh extratest diff --git a/.github/workflows/gcc9_test.yml b/.github/workflows/gcc9_test.yml index 4e9dc9bd9..798b6c476 100644 --- a/.github/workflows/gcc9_test.yml +++ b/.github/workflows/gcc9_test.yml @@ -40,6 +40,7 @@ jobs: SQLHOST: mariadb CC: ${{ matrix.CC }} CONFIGURE_FLAGS: CC=${{ matrix.CC }} --enable-debug --enable-Werror --enable-buildbot ${{ matrix.RENEWAL }} ${{ matrix.CLIENT_TYPE }} ${{ matrix.SANITIZER }} ${{ matrix.PACKET_VERSION }} --enable-lto + PACKET_VERSION: ${{ matrix.PACKET_VERSION }} steps: - uses: actions/checkout@v1 with: @@ -69,3 +70,8 @@ jobs: - name: test run: | ./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST + + - name: extra test + if: env.PACKET_VERSION != '--enable-packetver=20130724' + run: | + ./tools/ci/travis.sh extratest diff --git a/.github/workflows/mariadb.yml b/.github/workflows/mariadb.yml index 4479e9e4d..5293dd98b 100644 --- a/.github/workflows/mariadb.yml +++ b/.github/workflows/mariadb.yml @@ -38,6 +38,7 @@ jobs: SQLHOST: mysql CC: ${{ matrix.CC }} CONFIGURE_FLAGS: CC=${{ matrix.CC }} --enable-debug --enable-Werror --enable-buildbot ${{ matrix.RENEWAL }} ${{ matrix.CLIENT_TYPE }} ${{ matrix.SANITIZER }} ${{ matrix.PACKET_VERSION }} + PACKET_VERSION: ${{ matrix.PACKET_VERSION }} steps: - uses: actions/checkout@v1 with: @@ -67,3 +68,13 @@ jobs: - name: test run: | ./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST + + - name: extra test + if: env.PACKET_VERSION != '--enable-packetver=20130724' + run: | + ./tools/ci/travis.sh extratest + + - name: extra test + if: env.PACKET_VERSION != '--enable-packetver=20130724' + run: | + ./tools/ci/travis.sh extratest diff --git a/.github/workflows/mysql.yml b/.github/workflows/mysql.yml index 98e760a87..f26f86892 100644 --- a/.github/workflows/mysql.yml +++ b/.github/workflows/mysql.yml @@ -38,6 +38,7 @@ jobs: SQLHOST: mysql CC: ${{ matrix.CC }} CONFIGURE_FLAGS: CC=${{ matrix.CC }} --enable-debug --enable-Werror --enable-buildbot ${{ matrix.RENEWAL }} ${{ matrix.CLIENT_TYPE }} ${{ matrix.SANITIZER }} ${{ matrix.PACKET_VERSION }} + PACKET_VERSION: ${{ matrix.PACKET_VERSION }} steps: - uses: actions/checkout@v1 with: @@ -67,3 +68,8 @@ jobs: - name: test run: | ./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST + + - name: extra test + if: env.PACKET_VERSION != '--enable-packetver=20130724' + run: | + ./tools/ci/travis.sh extratest diff --git a/tools/ci/travis.sh b/tools/ci/travis.sh index 1014787a8..a1a3c7700 100755 --- a/tools/ci/travis.sh +++ b/tools/ci/travis.sh @@ -38,6 +38,7 @@ function usage { echo " $0 test [dbuser] [dbpassword] [dbhost]" echo " $0 getplugins" echo " $0 startmysql" + echo " $0 extratest" exit 1 } @@ -251,6 +252,7 @@ EOF run_server ./map-server "$PLUGINS --load-plugin db2sql --db2sql" run_server ./map-server "$PLUGINS --load-plugin db2sql --itemdb2sql" run_server ./map-server "$PLUGINS --load-plugin db2sql --mobdb2sql" +# look like works on windows only # echo "run all servers with dbghelpplug" # run_server ./login-server "$PLUGINS --load-plugin dbghelpplug" # run_server ./char-server "$PLUGINS --load-plugin dbghelpplug" @@ -263,6 +265,15 @@ EOF echo "run all servers with script_mapquit" run_server ./map-server "$PLUGINS --load-plugin script_mapquit" ;; + extratest) + export ASAN_OPTIONS=detect_stack_use_after_return=true:strict_init_order=true:detect_odr_violation=0 + PLUGINS="--load-plugin HPMHooking" + echo "run map server with uncommented old and custom scripts" + find ./npc -type f -name "*.conf" -exec ./tools/ci/uncomment.sh {} \; + run_server ./login-server "$PLUGINS" + run_server ./char-server "$PLUGINS" + run_server ./map-server "$ARGS $PLUGINS" + ;; getplugins) echo "Cloning plugins repository..." # Nothing to clone right now, all relevant plugins are part of the repository. diff --git a/tools/ci/uncomment.sh b/tools/ci/uncomment.sh new file mode 100755 index 000000000..22fe4e966 --- /dev/null +++ b/tools/ci/uncomment.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +sed -i "s|//\"npc/|\"npc/|g" $1 +sed -i "s|\"npc/location/to/script.txt\"|//\"npc/location/to/script.txt\"|g" $1 -- cgit v1.2.3-70-g09d2