mm/damon: Add kunit tests
+KUnit Development +David Gow
Quoted 45 lines · SeongJae Park
Quoted 42 lines · On Tue, 6 Oct 2020 03:42:01 +0800 kernel test robot <[email protected]> wrote:
Hi SeongJae,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on hnaz-linux-mm/master]
[also build test ERROR on kselftest/next tip/perf/core linus/master v5.9-rc= 8 next-20201002]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]url: https://github.com/0day-ci/linux/commits/SeongJae-Park/Introduce-Da=
ta-Access-MONitor-DAMON/20201005-190315
base: https://github.com/hnaz/linux-mm master
config: m68k-allmodconfig (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.0
reproduce (this is a W=3D1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/=
make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/bcd8ade170e80e5d63dacb96b=eb007bfd4e2845e
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review SeongJae-Park/Introduce-Data-Acces=
s-MONitor-DAMON/20201005-190315
git checkoutbcd8ade170e80e5d63dacb96beb007bfd4e2845e
# save the attached .config to linux build tree COMPILER_INSTALL_PATH=3D$HOME/0day COMPILER=3Dgcc-9.3.0 make.cross =
ARCH=3Dm68kIf you fix the issue, kindly add following tag as appropriate
Reported-by kernel test robot <[email protected]>All errors (new ones prefixed by >>):
m68k-linux-ld:
mm/damon/core.o: in function `damon_test_merge_two':core.c:(.text+0x63e): undefined reference to `kunit_binary_assert_format='
Quoted 1 line
Quoted 1 line
m68k-linux-ld: core.c:(.text+0x6ae): undefined reference to `kunit_binar=
y_assert_format'
m68k-linux-ld: core.c:(.text+0x722): undefined reference to `kunit_binar=y_assert_format'
Quoted 8 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line
m68k-linux-ld: core.c:(.text+0x790): undefined reference to `kunit_binar=
y_ptr_assert_format'
m68k-linux-ld: core.c:(.text+0x83c): undefined reference to `kunit_binar=y_assert_format'
m68k-linux-ld:mm/damon/core.o: in function `damon_test_merge_regions_of=
':core.c:(.text+0xa66): undefined reference to `kunit_binary_assert_format=[...]
This kind of looks like an issue with KUnit, since the symbol it is complaining about is a KUnit one. But we tested KUnit on m68k...hmmm...
Wait, I think I know what the issue is:
SeongJae, are your KUnit tests #include-d into mm/damon/core.c? Is that include properly #ifdef-ed?
Quoted 115 lines
Hi,
Thanks for the report. I fixed this with below 1/2 patch. I also noticed DAMON kunit tests are ignoring
KUNIT_ALL_TESTS, and fixed it with below 2/2 patch. Those will be merged in the next version of the patchset.Thanks,
SeongJae Park==================================== >8 ======================================= From
b0059c5f620adf8f3244cc1b893ffb1088f70831Mon Sep 17 00:00:00 2001
From: SeongJae Park <[email protected]>
Date: Tue, 6 Oct 2020 08:04:23 +0000
Subject: [PATCH 1/2] mm/damon: Make non-loadable kunit tests depend on KUNIT=yThe kunit tests for DAMON don't support module build, and therefore it could trigger compile errors with 'make allmodconfig' builds. This commit avoids such errors by making those to depend on KUNIT=y.
Reported-by kernel test robot <[email protected]>Signed-off-by SeongJae Park <[email protected]>--- mm/damon/Kconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)mm/damon/Kconfig +3
-4@@ -14,7 +14,7 @@ config DAMON config DAMON_KUNIT_TEST bool "Test for damon" - depends on DAMON && KUNIT + depends on DAMON && KUNIT=y help This builds the DAMON Kunit test suite.@@ -35,7 +35,7 @@ config DAMON_PRIMITIVES config DAMON_PRIMITIVES_KUNIT_TEST bool "Test for DAMON primitives" - depends on DAMON_PRIMITIVES && KUNIT + depends on DAMON_PRIMITIVES && KUNIT=y help This builds the DAMON PRIMITIVES Kunit test suite.@@ -55,7 +55,7 @@ config DAMON_DBGFS config DAMON_DBGFS_KUNIT_TEST bool "Test for damon debugfs interface" - depends on DAMON_DBGFS && KUNIT + depends on DAMON_DBGFS && KUNIT=y help This builds the DAMON debugfs interface Kunit test suite. --2.17.1
From
c6ee9b0e837dead2e40504c6ab344a689e2d1e96Mon Sep 17 00:00:00 2001
From: SeongJae Park <[email protected]>
Date: Tue, 6 Oct 2020 08:09:10 +0000
Subject: [PATCH 2/2] mm/damon: RespectKUNIT_ALL_TESTSDAMON kunit tests are not respecting '
KUNIT_ALL_TESTS' config. This commit fixes this problem by letting those default on it and don't let users turn off individual tests if 'KUNIT_ALL_TESTS' turned on.Signed-off-by SeongJae Park <[email protected]>--- mm/damon/Kconfig | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)mm/damon/Kconfig +6
-4@@ -13,8 +13,9 @@ config DAMON more information. config DAMON_KUNIT_TEST - bool "Test for damon" + bool "Test for damon" if !KUNIT_ALL_TESTS depends on DAMON && KUNIT=y + default KUNIT_ALL_TESTS help This builds the DAMON Kunit test suite.@@ -34,8 +35,9 @@ config DAMON_PRIMITIVES cover your use case, you can implement and use your own primitives. config DAMON_PRIMITIVES_KUNIT_TEST - bool "Test for DAMON primitives" + bool "Test for DAMON primitives" if !KUNIT_ALL_TESTS depends on DAMON_PRIMITIVES && KUNIT=y + default KUNIT_ALL_TESTS help This builds the DAMON PRIMITIVES Kunit test suite.@@ -54,8 +56,9 @@ config DAMON_DBGFS If unsure, say N. config DAMON_DBGFS_KUNIT_TEST - bool "Test for damon debugfs interface" + bool "Test for damon debugfs interface" if !KUNIT_ALL_TESTS depends on DAMON_DBGFS && KUNIT=y + default KUNIT_ALL_TESTS help This builds the DAMON debugfs interface Kunit test suite. --2.17.1