common: fix kmemleak to work with sections

Refactor the kmemleak code to work correctly with sections.  This
requires changing the location of the "is kmemleak enabled?" flag to
use /tmp instead of RESULT_BASE, scanning for leaks after every
test, and clarifying which functions get used when.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
This commit is contained in:
Darrick J. Wong
2019-02-11 18:17:26 -08:00
committed by Eryu Guan
parent c869a6712a
commit 0c24aa077f
3 changed files with 29 additions and 12 deletions
+5 -2
View File
@@ -496,7 +496,7 @@ _expunge_test()
return 0
}
_init_kmemleak
_detect_kmemleak
_prepare_test_list
if $OPTIONS_HAVE_SECTIONS; then
@@ -771,9 +771,12 @@ for section in $HOST_OPTIONS_SECTIONS; do
# and log messages that shouldn't be there.
_check_filesystems
_check_dmesg || err=true
_check_kmemleak || err=true
fi
# Scan for memory leaks after every test so that associating
# a leak to a particular test will be as accurate as possible.
_check_kmemleak || err=true
# test ends after all checks are done.
$timestamp && _timestamp
stop=`_wallclock`