[gjs: 1/18] build: Make LSan exit with code 23 on leaks



commit c1bb8bdd8c7b8e1415164bbd92599342a8dd18ad
Author: Philip Chimento <philip chimento gmail com>
Date:   Thu Oct 31 22:12:45 2019 -0700

    build: Make LSan exit with code 23 on leaks
    
    This allows us to catch memory leaks in the expected-fail script tests.
    Previously, we could not distinguish between LSan exiting with a nonzero
    code and the test's expected failure with a nonzero code. Arbitrarily
    designate 23 as LSan's exit code and check for it.

 installed-tests/scripts/testCommandLine.sh | 6 ++++--
 meson.build                                | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/installed-tests/scripts/testCommandLine.sh b/installed-tests/scripts/testCommandLine.sh
index b77d66f4..aaada2d7 100755
--- a/installed-tests/scripts/testCommandLine.sh
+++ b/installed-tests/scripts/testCommandLine.sh
@@ -71,8 +71,10 @@ report () {
 report_xfail () {
     exit_code=$?
     total=$((total + 1))
-    if test $exit_code -ne 0; then
-        echo "ok $total - $1"
+    if test $exit_code -eq 23; then
+        echo "not ok $total - $1 (leaked memory)"
+    elif test $exit_code -ne 0; then
+        echo "ok $total - $1 (exit code $exit_code)"
     else
         echo "not ok $total - $1"
     fi
diff --git a/meson.build b/meson.build
index d843e9f2..d5f7c2b1 100644
--- a/meson.build
+++ b/meson.build
@@ -568,7 +568,7 @@ tests_environment.prepend('GI_TYPELIB_PATH', meson.current_build_dir(),
 tests_environment.prepend('LD_LIBRARY_PATH', meson.current_build_dir(),
     js_tests_builddir)
 tests_environment.set('G_FILENAME_ENCODING', 'latin1')
-tests_environment.set('LSAN_OPTIONS', 'suppressions=@0@'.format(
+tests_environment.set('LSAN_OPTIONS', 'exitcode=23,suppressions=@0@'.format(
     meson.current_source_dir() / 'installed-tests' / 'extra' / 'lsan.supp'))
 tests_environment.set('NO_AT_BRIDGE', '1')
 tests_environment.set('LC_ALL', tests_locale)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]