* [PATCH 1/6] selftests/damon/huge_count_read_write: provide sufficiently large buffer for DEPRECATED file read
2024-10-28 23:30 [PATCH 0/6] damon/{self,kunit}tests: minor fixups for DAMON debugfs interface tests SeongJae Park
@ 2024-10-28 23:30 ` SeongJae Park
2024-10-28 23:30 ` [PATCH 2/6] selftests/damon/huge_count_read_write: remove unnecessary debugging message SeongJae Park
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: SeongJae Park @ 2024-10-28 23:30 UTC (permalink / raw)
To: Andrew Morton
Cc: Andrew Paniakin, SeongJae Park, Shuah Khan, damon, linux-mm,
linux-kselftest, linux-kernel
From: Andrew Paniakin <apanyaki@amazon.com>
'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.
Fixes: b4a002889d24 ("selftests/damon: test debugfs file reads/writes with huge count")
Signed-off-by: Andrew Paniakin <apanyaki@amazon.com>
Signed-off-by: SeongJae Park <sj@kernel.org>
---
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(-)
diff --git a/tools/testing/selftests/damon/huge_count_read_write.c b/tools/testing/selftests/damon/huge_count_read_write.c
index a6fe0689f88d..f3c199dc8eba 100644
--- a/tools/testing/selftests/damon/huge_count_read_write.c
+++ b/tools/testing/selftests/damon/huge_count_read_write.c
@@ -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);
--
2.39.5
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH 2/6] selftests/damon/huge_count_read_write: remove unnecessary debugging message
2024-10-28 23:30 [PATCH 0/6] damon/{self,kunit}tests: minor fixups for DAMON debugfs interface tests SeongJae Park
2024-10-28 23:30 ` [PATCH 1/6] selftests/damon/huge_count_read_write: provide sufficiently large buffer for DEPRECATED file read SeongJae Park
@ 2024-10-28 23:30 ` SeongJae Park
2024-10-28 23:30 ` [PATCH 3/6] selftests/damon/_debugfs_common: hide expected error message from test_write_result() SeongJae Park
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: SeongJae Park @ 2024-10-28 23:30 UTC (permalink / raw)
To: Andrew Morton
Cc: SeongJae Park, Shuah Khan, damon, linux-mm, linux-kselftest,
linux-kernel
The 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.
Fixes: b4a002889d24 ("selftests/damon: test debugfs file reads/writes with huge count")
Signed-off-by: SeongJae Park <sj@kernel.org>
---
tools/testing/selftests/damon/huge_count_read_write.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/tools/testing/selftests/damon/huge_count_read_write.c b/tools/testing/selftests/damon/huge_count_read_write.c
index f3c199dc8eba..53e69a669668 100644
--- a/tools/testing/selftests/damon/huge_count_read_write.c
+++ b/tools/testing/selftests/damon/huge_count_read_write.c
@@ -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);
}
--
2.39.5
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH 3/6] selftests/damon/_debugfs_common: hide expected error message from test_write_result()
2024-10-28 23:30 [PATCH 0/6] damon/{self,kunit}tests: minor fixups for DAMON debugfs interface tests SeongJae Park
2024-10-28 23:30 ` [PATCH 1/6] selftests/damon/huge_count_read_write: provide sufficiently large buffer for DEPRECATED file read SeongJae Park
2024-10-28 23:30 ` [PATCH 2/6] selftests/damon/huge_count_read_write: remove unnecessary debugging message SeongJae Park
@ 2024-10-28 23:30 ` SeongJae Park
2024-10-28 23:30 ` [PATCH 4/6] selftests/damon/debugfs_duplicate_context_creation: hide errors from expected file write failures SeongJae Park
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: SeongJae Park @ 2024-10-28 23:30 UTC (permalink / raw)
To: Andrew Morton
Cc: SeongJae Park, Shuah Khan, damon, linux-mm, linux-kselftest,
linux-kernel
DAMON 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.
Fixes: b348eb7abd09 ("mm/damon: add user space selftests")
Signed-off-by: SeongJae Park <sj@kernel.org>
---
tools/testing/selftests/damon/_debugfs_common.sh | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/damon/_debugfs_common.sh b/tools/testing/selftests/damon/_debugfs_common.sh
index aa995516870b..54d45791b0d9 100644
--- a/tools/testing/selftests/damon/_debugfs_common.sh
+++ b/tools/testing/selftests/damon/_debugfs_common.sh
@@ -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"
--
2.39.5
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH 4/6] selftests/damon/debugfs_duplicate_context_creation: hide errors from expected file write failures
2024-10-28 23:30 [PATCH 0/6] damon/{self,kunit}tests: minor fixups for DAMON debugfs interface tests SeongJae Park
` (2 preceding siblings ...)
2024-10-28 23:30 ` [PATCH 3/6] selftests/damon/_debugfs_common: hide expected error message from test_write_result() SeongJae Park
@ 2024-10-28 23:30 ` SeongJae Park
2024-10-28 23:30 ` [PATCH 5/6] mm/damon/Kconfig: update DBGFS_KUNIT prompt copy for SYSFS_KUNIT SeongJae Park
2024-10-28 23:30 ` [PATCH 6/6] mm/damon/tests/dbgfs-kunit: fix the header double inclusion guarding ifdef comment SeongJae Park
5 siblings, 0 replies; 7+ messages in thread
From: SeongJae Park @ 2024-10-28 23:30 UTC (permalink / raw)
To: Andrew Morton
Cc: SeongJae Park, Shuah Khan, damon, linux-mm, linux-kselftest,
linux-kernel
debugfs_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.
Fixes: ade38b8ca5ce ("selftest/damon: add a test for duplicate context dirs creation")
Signed-off-by: SeongJae Park <sj@kernel.org>
---
.../selftests/damon/debugfs_duplicate_context_creation.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/damon/debugfs_duplicate_context_creation.sh b/tools/testing/selftests/damon/debugfs_duplicate_context_creation.sh
index 4a76e37ef16b..bd6c22d96ead 100755
--- a/tools/testing/selftests/damon/debugfs_duplicate_context_creation.sh
+++ b/tools/testing/selftests/damon/debugfs_duplicate_context_creation.sh
@@ -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
--
2.39.5
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH 5/6] mm/damon/Kconfig: update DBGFS_KUNIT prompt copy for SYSFS_KUNIT
2024-10-28 23:30 [PATCH 0/6] damon/{self,kunit}tests: minor fixups for DAMON debugfs interface tests SeongJae Park
` (3 preceding siblings ...)
2024-10-28 23:30 ` [PATCH 4/6] selftests/damon/debugfs_duplicate_context_creation: hide errors from expected file write failures SeongJae Park
@ 2024-10-28 23:30 ` SeongJae Park
2024-10-28 23:30 ` [PATCH 6/6] mm/damon/tests/dbgfs-kunit: fix the header double inclusion guarding ifdef comment SeongJae Park
5 siblings, 0 replies; 7+ messages in thread
From: SeongJae Park @ 2024-10-28 23:30 UTC (permalink / raw)
To: Andrew Morton; +Cc: SeongJae Park, damon, linux-mm, linux-kernel
CONFIG_DAMON_SYSFS_KUNIT_TEST prompt is copied from that for DAMON
debugfs interface kunit tests, and not correctly updated. Fix it.
Fixes: b8ee5575f763 ("mm/damon/sysfs-test: add a unit test for damon_sysfs_set_targets()")
Signed-off-by: SeongJae Park <sj@kernel.org>
---
mm/damon/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/damon/Kconfig b/mm/damon/Kconfig
index 35b72f88983a..d0357f3e9372 100644
--- a/mm/damon/Kconfig
+++ b/mm/damon/Kconfig
@@ -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
--
2.39.5
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH 6/6] mm/damon/tests/dbgfs-kunit: fix the header double inclusion guarding ifdef comment
2024-10-28 23:30 [PATCH 0/6] damon/{self,kunit}tests: minor fixups for DAMON debugfs interface tests SeongJae Park
` (4 preceding siblings ...)
2024-10-28 23:30 ` [PATCH 5/6] mm/damon/Kconfig: update DBGFS_KUNIT prompt copy for SYSFS_KUNIT SeongJae Park
@ 2024-10-28 23:30 ` SeongJae Park
5 siblings, 0 replies; 7+ messages in thread
From: SeongJae Park @ 2024-10-28 23:30 UTC (permalink / raw)
To: Andrew Morton
Cc: SeongJae Park, Brendan Higgins, David Gow, damon, linux-mm,
kunit-dev, linux-kselftest, linux-kernel
Closing 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.
Fixes: 17ccae8bb5c9 ("mm/damon: add kunit tests")
Signed-off-by: SeongJae Park <sj@kernel.org>
---
mm/damon/tests/dbgfs-kunit.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/damon/tests/dbgfs-kunit.h b/mm/damon/tests/dbgfs-kunit.h
index d2ecfcc8db86..087e53f641a8 100644
--- a/mm/damon/tests/dbgfs-kunit.h
+++ b/mm/damon/tests/dbgfs-kunit.h
@@ -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 */
--
2.39.5
^ permalink raw reply [flat|nested] 7+ messages in thread