linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests/damon/_damon_sysfs: skip testcases if CONFIG_DAMON_SYSFS is disabled
@ 2025-05-31  9:39 Enze Li
  2025-05-31 16:48 ` SeongJae Park
  0 siblings, 1 reply; 2+ messages in thread
From: Enze Li @ 2025-05-31  9:39 UTC (permalink / raw)
  To: sj, shuah; +Cc: damon, linux-mm, linux-kselftest, enze.li, Enze Li

When CONFIG_DAMON_SYSFS is disabled, the selftests fail with the
following outputs,

not ok 2 selftests: damon: sysfs_update_schemes_tried_regions_wss_estimation.py # exit=1
not ok 3 selftests: damon: damos_quota.py # exit=1
not ok 4 selftests: damon: damos_quota_goal.py # exit=1
not ok 5 selftests: damon: damos_apply_interval.py # exit=1
not ok 6 selftests: damon: damos_tried_regions.py # exit=1
not ok 7 selftests: damon: damon_nr_regions.py # exit=1
not ok 11 selftests: damon: sysfs_update_schemes_tried_regions_hang.py # exit=1

The root cause of this issue is that all the testcases above do not
check the sysfs interface of DAMON whether it exists or not.  With this
patch applied, all the testcases above now pass successfully.

Signed-off-by: Enze Li <lienze@kylinos.cn>
---
 tools/testing/selftests/damon/_damon_sysfs.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/testing/selftests/damon/_damon_sysfs.py b/tools/testing/selftests/damon/_damon_sysfs.py
index 6e136dc3df19..cab67addfb00 100644
--- a/tools/testing/selftests/damon/_damon_sysfs.py
+++ b/tools/testing/selftests/damon/_damon_sysfs.py
@@ -15,6 +15,10 @@ if sysfs_root is None:
     print('Seems sysfs not mounted?')
     exit(ksft_skip)
 
+if not os.path.exists(sysfs_root):
+    print('Seems DAMON disabled?')
+    exit(ksft_skip)
+
 def write_file(path, string):
     "Returns error string if failed, or None otherwise"
     string = '%s' % string

base-commit: 0f70f5b08a47a3bc1a252e5f451a137cde7c98ce
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] selftests/damon/_damon_sysfs: skip testcases if CONFIG_DAMON_SYSFS is disabled
  2025-05-31  9:39 [PATCH] selftests/damon/_damon_sysfs: skip testcases if CONFIG_DAMON_SYSFS is disabled Enze Li
@ 2025-05-31 16:48 ` SeongJae Park
  0 siblings, 0 replies; 2+ messages in thread
From: SeongJae Park @ 2025-05-31 16:48 UTC (permalink / raw)
  To: Enze Li
  Cc: SeongJae Park, shuah, damon, linux-mm, linux-kselftest, enze.li,
	Andrew Morton

On Sat, 31 May 2025 17:39:37 +0800 Enze Li <lienze@kylinos.cn> wrote:

> When CONFIG_DAMON_SYSFS is disabled, the selftests fail with the
> following outputs,
> 
> not ok 2 selftests: damon: sysfs_update_schemes_tried_regions_wss_estimation.py # exit=1
> not ok 3 selftests: damon: damos_quota.py # exit=1
> not ok 4 selftests: damon: damos_quota_goal.py # exit=1
> not ok 5 selftests: damon: damos_apply_interval.py # exit=1
> not ok 6 selftests: damon: damos_tried_regions.py # exit=1
> not ok 7 selftests: damon: damon_nr_regions.py # exit=1
> not ok 11 selftests: damon: sysfs_update_schemes_tried_regions_hang.py # exit=1
> 
> The root cause of this issue is that all the testcases above do not
> check the sysfs interface of DAMON whether it exists or not.  With this
> patch applied, all the testcases above now pass successfully.

Thank you for finding and fixing this!

> 
> Signed-off-by: Enze Li <lienze@kylinos.cn>

Reviewed-by: SeongJae Park <sj@kernel.org>

> ---
>  tools/testing/selftests/damon/_damon_sysfs.py | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/tools/testing/selftests/damon/_damon_sysfs.py b/tools/testing/selftests/damon/_damon_sysfs.py
> index 6e136dc3df19..cab67addfb00 100644
> --- a/tools/testing/selftests/damon/_damon_sysfs.py
> +++ b/tools/testing/selftests/damon/_damon_sysfs.py
> @@ -15,6 +15,10 @@ if sysfs_root is None:
>      print('Seems sysfs not mounted?')
>      exit(ksft_skip)
>  
> +if not os.path.exists(sysfs_root):
> +    print('Seems DAMON disabled?')
> +    exit(ksft_skip)
> +
>  def write_file(path, string):
>      "Returns error string if failed, or None otherwise"
>      string = '%s' % string
> 
> base-commit: 0f70f5b08a47a3bc1a252e5f451a137cde7c98ce
> -- 
> 2.43.0


Thanks,
SJ

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-05-31 16:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-31  9:39 [PATCH] selftests/damon/_damon_sysfs: skip testcases if CONFIG_DAMON_SYSFS is disabled Enze Li
2025-05-31 16:48 ` SeongJae Park

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).