From 457ec97eecfd44177fcdbce5568656b7cccd998c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 29 Mar 2020 14:49:55 +0200 Subject: [PATCH] Suppress reports about memory leaks in PostgreSQL ODBC test Unfortunately we don't get any information about these leaks, the entire report looks like this: ==6706==ERROR: LeakSanitizer: detected memory leaks Direct leak of 24 byte(s) in 1 object(s) allocated from: #0 0x7f6473f80602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602) #1 0x7f646f89ba82 (/usr/lib/x86_64-linux-gnu/odbc/psqlodbca.so+0x1ba82) Indirect leak of 25 byte(s) in 1 object(s) allocated from: #0 0x7f6473f80602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602) #1 0x7f646f89ba9a (/usr/lib/x86_64-linux-gnu/odbc/psqlodbca.so+0x1ba9a) SUMMARY: AddressSanitizer: 49 byte(s) leaked in 2 allocation(s). So we have no choice but to suppress all leaks from psqlodbca.so to let the tests to pass on Travis CI. --- scripts/suppress_odbc.txt | 6 ++++++ scripts/travis/script_odbc.sh | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 scripts/suppress_odbc.txt diff --git a/scripts/suppress_odbc.txt b/scripts/suppress_odbc.txt new file mode 100644 index 00000000..e264f482 --- /dev/null +++ b/scripts/suppress_odbc.txt @@ -0,0 +1,6 @@ +# This is a suppression file for LeakSanitizer when running ODBC tests. + +# Unfortunately there is a leak from psqlodbca.so for which ASAN doesn't show +# any stack at all, so we have no choice but to suppress all leaks from this +# library, even though it could easily hide real problems. +leak:psqlodbca.so diff --git a/scripts/travis/script_odbc.sh b/scripts/travis/script_odbc.sh index ec17822e..8ccc55f8 100755 --- a/scripts/travis/script_odbc.sh +++ b/scripts/travis/script_odbc.sh @@ -31,4 +31,4 @@ run_make # Exclude the tests which can't be run due to the absence of ODBC drivers (MS # SQL and MySQL). -run_test -E 'soci_odbc_test_m.sql' +LSAN_OPTIONS=suppressions=${TRAVIS_BUILD_DIR}/scripts/suppress_odbc.txt run_test -E 'soci_odbc_test_m.sql'