[PATCH 0/5] selftests/damon: misc fixes for test bugs

Kunwu Chan posted 5 patches 1 week ago
Only 1 patches received!
There is a newer version of this series
tools/testing/selftests/damon/_damon_sysfs.py | 14 +++++++++----
.../selftests/damon/damos_apply_interval.py   |  2 +-
.../selftests/damon/damos_quota_goal.py       |  2 +-
.../selftests/damon/damos_tried_regions.py    | 20 ++++++++++---------
.../selftests/damon/drgn_dump_damon_status.py |  2 +-
tools/testing/selftests/damon/sysfs.py        |  4 ++--
tools/testing/selftests/damon/sysfs.sh        |  6 +++---
...te_schemes_tried_regions_wss_estimation.py |  2 +-
8 files changed, 30 insertions(+), 22 deletions(-)
[PATCH 0/5] selftests/damon: misc fixes for test bugs
Posted by Kunwu Chan 1 week ago
From: Kunwu Chan <kunwu.chan@gmail.com>

This series fixes several bugs in the DAMON selftests.  Most are
trivial but cause tests to silently pass when they shouldn't, or
fail prematurely on slow machines.

Patch 1 fixes mutable default arguments in DamonCtx.__init__()
that cause state to leak between test instances.

Patch 2 fixes a trailing comma in DamosFilter that turns
memcg_path from a string into a tuple, silently breaking memcg
filter setup.

Patch 3-4 fix bugs in damos_tried_regions.py: wrong operator
precedence drops the "not met" prefix from failure output, and
empty early aggregation cycles cause premature test failure.

Patch 5 fixes several wrong strings that produce dead elif
branches, skipped file existence checks, and broken dict key
lookups.

Based on next-20260529.
base-commit: 7da7f07112610a520567421dd2ffcb51beaefbcc

Kunwu Chan (5):
  selftests/damon: prevent cross-context state pollution in DamonCtx
  selftests/damon: fix memcg filter path handling
  selftests/damon/damos_tried_regions: fix expectation output and join
    TypeError
  selftests/damon/damos_tried_regions: handle empty tried regions in
    early cycles
  selftests/damon: fix dead code, skipped checks, and broken lookups

 tools/testing/selftests/damon/_damon_sysfs.py | 14 +++++++++----
 .../selftests/damon/damos_apply_interval.py   |  2 +-
 .../selftests/damon/damos_quota_goal.py       |  2 +-
 .../selftests/damon/damos_tried_regions.py    | 20 ++++++++++---------
 .../selftests/damon/drgn_dump_damon_status.py |  2 +-
 tools/testing/selftests/damon/sysfs.py        |  4 ++--
 tools/testing/selftests/damon/sysfs.sh        |  6 +++---
 ...te_schemes_tried_regions_wss_estimation.py |  2 +-
 8 files changed, 30 insertions(+), 22 deletions(-)

-- 
2.43.0
Re: [PATCH 0/5] selftests/damon: misc fixes for test bugs
Posted by SeongJae Park 1 week ago
On Sun, 31 May 2026 16:56:28 +0800 Kunwu Chan <kunwu.chan@linux.dev> wrote:

> From: Kunwu Chan <kunwu.chan@gmail.com>
> 
> This series fixes several bugs in the DAMON selftests.  Most are
> trivial but cause tests to silently pass when they shouldn't, or
> fail prematurely on slow machines.

Thank you for sharing these great changes, Kunwu and Lian!

> 
> Patch 1 fixes mutable default arguments in DamonCtx.__init__()
> that cause state to leak between test instances.
> 
> Patch 2 fixes a trailing comma in DamosFilter that turns
> memcg_path from a string into a tuple, silently breaking memcg
> filter setup.
> 
> Patch 3-4 fix bugs in damos_tried_regions.py: wrong operator
> precedence drops the "not met" prefix from failure output, and
> empty early aggregation cycles cause premature test failure.
> 
> Patch 5 fixes several wrong strings that produce dead elif
> branches, skipped file existence checks, and broken dict key
> lookups.

I left comments to each patch.  To summarize,

Patches 1, 3 and 5 look good except signer/author info mismatch.

For patches 2 and 4, I think we need more discussions.


Thanks,
SJ

[...]
Re: [PATCH 0/5] selftests/damon: misc fixes for test bugs
Posted by Kunwu Chan 1 week ago
June 1, 2026 at 1:08 AM, "SeongJae Park" <sj@kernel.org mailto:sj@kernel.org?to=%22SeongJae%20Park%22%20%3Csj%40kernel.org%3E > wrote:


> 
> On Sun, 31 May 2026 16:56:28 +0800 Kunwu Chan <kunwu.chan@linux.dev> wrote:
> 
> > 
> > From: Kunwu Chan <kunwu.chan@gmail.com>
> >  
> >  This series fixes several bugs in the DAMON selftests. Most are
> >  trivial but cause tests to silently pass when they shouldn't, or
> >  fail prematurely on slow machines.
> > 
> Thank you for sharing these great changes, Kunwu and Lian!
> 
> > 
> > Patch 1 fixes mutable default arguments in DamonCtx.__init__()
> >  that cause state to leak between test instances.
> >  
> >  Patch 2 fixes a trailing comma in DamosFilter that turns
> >  memcg_path from a string into a tuple, silently breaking memcg
> >  filter setup.
> >  
> >  Patch 3-4 fix bugs in damos_tried_regions.py: wrong operator
> >  precedence drops the "not met" prefix from failure output, and
> >  empty early aggregation cycles cause premature test failure.
> >  
> >  Patch 5 fixes several wrong strings that produce dead elif
> >  branches, skipped file existence checks, and broken dict key
> >  lookups.
> > 
> I left comments to each patch. To summarize,
> 
> Patches 1, 3 and 5 look good except signer/author info mismatch.
> 
> For patches 2 and 4, I think we need more discussions.
> 
Thanks, SJ.

Noted. I'll fix the signer/author mismatch in v2. As discussed in the
individual replies, I'll drop patches 2 and 4 for now and revisit 4
once the underlying issues are better understood.

Thanks,
Kunwu

> Thanks,
> SJ
> 
> [...]
>