diff --git a/src/core/main.c b/src/core/main.c index 839dc062ff7..d4b19c9fff9 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -83,6 +83,10 @@ #include "virt.h" #include "watchdog.h" +#if HAS_FEATURE_ADDRESS_SANITIZER +#include +#endif + static enum { ACTION_RUN, ACTION_HELP, @@ -2612,6 +2616,10 @@ finish: } #endif +#if HAS_FEATURE_ADDRESS_SANITIZER + __lsan_do_leak_check(); +#endif + if (shutdown_verb) { r = become_shutdown(shutdown_verb, retval); log_error_errno(r, "Failed to execute shutdown binary, %s: %m", getpid_cached() == 1 ? "freezing" : "quitting"); diff --git a/test/TEST-01-BASIC/test.sh b/test/TEST-01-BASIC/test.sh index d74a2e00c1d..7aa21ff9997 100755 --- a/test/TEST-01-BASIC/test.sh +++ b/test/TEST-01-BASIC/test.sh @@ -26,7 +26,7 @@ Description=Testsuite service After=multi-user.target [Service] -ExecStart=/bin/sh -x -c 'systemctl --state=failed --no-legend --no-pager > /failed ; echo OK > /testok' +ExecStart=/bin/sh -x -c 'systemctl --state=failed --no-legend --no-pager > /failed ; systemctl daemon-reload ; echo OK > /testok' Type=oneshot EOF diff --git a/test/test-functions b/test/test-functions index 169ecdbf137..9aa99140cd7 100644 --- a/test/test-functions +++ b/test/test-functions @@ -462,6 +462,14 @@ check_result_nspawn() { ls -l $TESTDIR/journal/*/*.journal test -s $TESTDIR/failed && ret=$(($ret+1)) [ -n "$TIMED_OUT" ] && ret=$(($ret+1)) + if [[ "$IS_BUILT_WITH_ASAN" = "yes" ]]; then + ls -l "$TESTDIR/$1" + if [[ -e "$TESTDIR/$1/systemd.asan.log.1" ]]; then + cat "$TESTDIR/$1/systemd.asan.log.1" + ret=$(($ret+1)) + fi + fi + return $ret }