Skip to content

Commit 49f3a27

Browse files
committed
Change sanatizer in ci builds to only load the library before running the target test and unload it after
Signed-off-by: Ibrahim Zidan <brahem@aotsw.com>
1 parent 8a194a4 commit 49f3a27

2 files changed

Lines changed: 15 additions & 6 deletions

File tree

.github/workflows/gccsnapshot_test.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,10 @@ jobs:
101101
- name: test
102102
run: |
103103
export PATH=/usr/lib/gcc-snapshot/bin:$PATH
104-
export LD_PRELOAD=/usr/lib/gcc-snapshot/lib/libasan.so.8.0.0
105-
./tools/ci/travis.sh test ragnarok ragnarok ragnarok $SQLHOST
104+
./tools/ci/travis.sh --sanitizer-build test ragnarok ragnarok ragnarok $SQLHOST
106105
107106
- name: extra test
108107
if: env.PACKET_VERSION != '--enable-packetver=20130724'
109108
run: |
110109
export PATH=/usr/lib/gcc-snapshot/bin:$PATH
111-
export LD_PRELOAD=/usr/lib/gcc-snapshot/lib/libasan.so.8.0.0
112-
./tools/ci/travis.sh extratest
110+
./tools/ci/travis.sh --sanitizer-build extratest

tools/ci/travis.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020

2121
# Base Author: Haru @ http://herc.ws
2222

23+
if [ "$1" == "--sanitizer-build" ]; then
24+
SANITIZER_BUILD=1
25+
shift
26+
fi
27+
2328
MODE="$1"
2429
shift
2530

@@ -50,7 +55,12 @@ function aborterror {
5055
function run_server {
5156
echo "Running: $1 --run-once $2"
5257
rm -rf core* || true
58+
BACKUP_LD_PRELOAD="$LD_PRELOAD"
59+
if [ $SANITIZER_BUILD -eq 1 ]; then
60+
export LD_PRELOAD=/usr/lib/gcc-snapshot/lib/libasan.so.8.0.0
61+
fi
5362
CRASH_PLEASE=1 $1 --run-once $2 2>runlog.txt
63+
LD_PRELOAD="$BACKUP_LD_PRELOAD"
5464
export errcode=$?
5565
export teststr=$(head -c 10000 runlog.txt|grep -v "WARNING: MYSQL_OPT_RECONNECT is deprecated and will be removed in a future version.")
5666
if [[ -n "${teststr}" ]]; then
@@ -102,6 +112,7 @@ DBNAME=ragnarok
102112
DBUSER=ragnarok
103113
DBPASS=ragnarok
104114
DBHOST=localhost
115+
SANITIZER_BUILD=0
105116

106117
case "$MODE" in
107118
createdb|importdb|test)
@@ -244,8 +255,8 @@ EOF
244255
export ASAN_OPTIONS=leak_check_at_exit=1:detect_stack_use_after_return=true:strict_init_order=true:detect_odr_violation=0
245256
fi
246257
# run_test spinlock # Not running the spinlock test for the time being (too time consuming)
247-
run_test libconfig
248-
run_test chunked
258+
# run_test libconfig
259+
# run_test chunked
249260
echo "run all servers without HPM"
250261
run_server ./login-server
251262
run_server ./char-server

0 commit comments

Comments
 (0)