damon/{self,kunit}tests: minor fixups for DAMON debugfs interface tests
Subsystems (3)
SeongJae Park
maintainercover damon/{self,kunit}tests: minor fixups for DAMON debugfs interface tests
Fixup small broken window panes in DAMON selftests and kunit tests.
First four patches clean up DAMON debugfs interface selftests output, by fixing segmentation fault of a test program (patch 1), removing unnecessary debugging messages (patch 2), and hiding error messages from expected failures (patches 3 and 4).
Following two patches fix copy-paste mistakes in DAMON Kconfig help message that copied from debugfs kunit test (patch 5) and a comment on the debugfs kunit test code (patch 6).
Andrew Paniakin (1):
selftests/damon/huge_count_read_write: provide sufficiently large
buffer for DEPRECATED file read
SeongJae Park (5):
selftests/damon/huge_count_read_write: remove unnecessary debugging
message
selftests/damon/_debugfs_common: hide expected error message from
test_write_result()
selftests/damon/debugfs_duplicate_context_creation: hide errors from
expected file write failures
mm/damon/Kconfig: update DBGFS_KUNIT prompt copy for SYSFS_KUNIT mm/damon/tests/dbgfs-kunit: fix the header double inclusion guarding
ifdef comment
mm/damon/Kconfig | 2 +- mm/damon/tests/dbgfs-kunit.h | 2 +- tools/testing/selftests/damon/_debugfs_common.sh | 7 ++++++- .../selftests/damon/debugfs_duplicate_context_creation.sh | 2 +- tools/testing/selftests/damon/huge_count_read_write.c | 4 +--- 5 files changed, 10 insertions(+), 7 deletions(-)
base-commit: 13583c750117b4e10cdaf5578dcc7723b305ce4e
Signature · 1 line
2.39.5
SeongJae Park
maintainerPATCH 1/6 selftests/damon/huge_count_read_write: provide sufficiently large buffer for DEPRECATED file read
From: Andrew Paniakin <[email protected]>
'huge_count_read_write' crashes with segmentation fault when reading DEPRECATED file of DAMON debugfs interface. This is not causing any problem for users or other tests because the purpose of the test is just ensuring the read is not causing kernel warning messages. Nonetheless, it makes the output unnecessarily noisy, and the DEPRECATED file is not properly being tested.
It happens because the size of the content of the file is larger than the size of the buffer for the read. The file contains about 170 characters. Increase the buffer size to 256 characters.
---
Note that this fix has originally wrote[1] by Andrew for the downstream version of the same test. Because the downstream version is hosted on GitHub, the original patch was posted via GitHub pull request, not to the mailing list.
[1] https://github.com/damonitor/damon-tests/commit/fec6e1f4559a
tools/testing/selftests/damon/huge_count_read_write.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/damon/huge_count_read_write.c +1 -1
@@ -18,7 +18,7 @@void write_read_with_huge_count (char *file) {int filedesc =open (file,O_RDWR ); -char buf[25 ]; +char buf[256 ];int ret;printf ("%s %s\n" , __func__, file);
Signature · 1 line
2.39.5
SeongJae Park
maintainerPATCH 2/6 selftests/damon/huge_count_read_write: remove unnecessary debugging message
In reply to SeongJae ParkThe program prints expected errors from write/read of the files with invalid huge count, for only debugging purpose. It is only making the output noisy. Remove those.
--- tools/testing/selftests/damon/huge_count_read_write.c | 2 -- 1 file changed, 2 deletions(-)
tools/testing/selftests/damon/huge_count_read_write.c +0 -2
@@ -28,9 +28,7 @@ void write_read_with_huge_count(char *file) }write (filedesc,"" ,0xfffffffful ); -perror ("after write: " ); ret =read (filedesc, buf,0xfffffffful ); -perror ("after read: " );close (filedesc); }
Signature · 1 line
2.39.5
SeongJae Park
maintainerPATCH 3/6 selftests/damon/_debugfs_common: hide expected error message from test_write_result()
In reply to SeongJae ParkDAMON debugfs interface selftests use test_write_result() to check if valid or invalid writes to files of the interface success or fail as expected. File write error messages from expected failures are only making the output noisy. Hide such expected error messages.
--- tools/testing/selftests/damon/_debugfs_common.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
tools/testing/selftests/damon/_debugfs_common.sh +6 -1
@@ -8,7 +8,12 @@ test_write_result() { expect_reason=$4 expected=$5 - echo "$content" > "$file" + if [ "$expected" = "0" ] + then + echo "$content" > "$file" + else + echo "$content" > "$file" 2> /dev/null + fi if [ $? -ne "$expected" ] then echo "writing $content to $file doesn't return $expected"
Signature · 1 line
2.39.5
SeongJae Park
maintainerPATCH 4/6 selftests/damon/debugfs_duplicate_context_creation: hide errors from expected file write failures
In reply to SeongJae Parkdebugfs_duplicate_context_creation.sh does an invalid file write to ensure it fails. Check of the failure is sufficient, so the error message from the failure only makes the output unnecessarily noisy. Hide it.
--- .../selftests/damon/debugfs_duplicate_context_creation.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/damon/debugfs_duplicate_context_creation.sh +1 -1
@@ -12,7 +12,7 @@ then exit 1 fi -if echo foo > "$DBGFS/mk_contexts" +if echo foo > "$DBGFS/mk_contexts" 2> /dev/null then echo "duplicate context creation success" exit 1
Signature · 1 line
2.39.5
SeongJae Park
maintainerPATCH 5/6 mm/damon/Kconfig: update DBGFS_KUNIT prompt copy for SYSFS_KUNIT
In reply to SeongJae ParkCONFIG_DAMON_SYSFS_KUNIT_TEST prompt is copied from that for DAMON debugfs interface kunit tests, and not correctly updated. Fix it.
--- mm/damon/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/damon/Kconfig +1 -1
@@ -60,7 +60,7 @@ config DAMON_SYSFS the interface for arbitrary data access monitoring. config DAMON_SYSFS_KUNIT_TEST - bool "Test for damon debugfs interface" if !KUNIT_ALL_TESTS + bool "Test for damon sysfs interface" if !KUNIT_ALL_TESTS depends on DAMON_SYSFS && KUNIT=y default KUNIT_ALL_TESTS help
Signature · 1 line
2.39.5
SeongJae Park
maintainerPATCH 6/6 mm/damon/tests/dbgfs-kunit: fix the header double inclusion guarding ifdef comment
In reply to SeongJae ParkClosing part of double inclusion guarding macro for dbgfs-kunit.h was copy-pasted from somewhere (maybe before the initial mainline merge of DAMON), and not properly updated. Fix it.
--- mm/damon/tests/dbgfs-kunit.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/damon/tests/dbgfs-kunit.h +1 -1
@@ -168,6 +168,6 @@ static struct kunit_suite damon_test_suite = { };kunit_test_suite (damon_test_suite); -#endif /* _DAMON_TEST_H */ +#endif /* _DAMON_DBGFS_TEST_H */ #endif /* CONFIG_DAMON_KUNIT_TEST */
Signature · 1 line
2.39.5