linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: SeongJae Park <sj@kernel.org>
To: Joshua Hahn <joshua.hahnjy@gmail.com>
Cc: SeongJae Park <sj@kernel.org>, Enze Li <lienze@kylinos.cn>,
	shuah@kernel.org, damon@lists.linux.dev, linux-mm@kvack.org,
	linux-kselftest@vger.kernel.org, enze.li@gmx.com
Subject: Re: [PATCH] selftests/damon: introduce _common.sh to host shared function
Date: Thu, 17 Jul 2025 09:14:54 -0700	[thread overview]
Message-ID: <20250717161454.62245-1-sj@kernel.org> (raw)
In-Reply-To: <20250717135433.2113596-1-joshua.hahnjy@gmail.com>

Hi Joshua,

On Thu, 17 Jul 2025 06:54:32 -0700 Joshua Hahn <joshua.hahnjy@gmail.com> wrote:

> On Thu, 17 Jul 2025 17:19:02 +0800 Enze Li <lienze@kylinos.cn> wrote:
> 
> Hi Enze,
> 
> Thank you for the patch! I just have a few comments about the patch.
> 
> > The current test scripts contain duplicated root permission checks
> > in multiple locations.  This patch consolidates these checks into
> > _common.sh to eliminate code redundancy.
> 
> Is there a reason we named the file _common.sh? IIRC there are no other files
> that begin with an underscore, so it might be confusing for users. Maybe
> remaining it to damon_common.sh might fit better with the convention used
> by other selftests. 

This is my personal pattern that I sometimes use, to distinguish files that
aimed to be only indirectly be used.  We already have a file of the pattern,
namely _damon_sysfs.py.

I don't think this pattern is particularly good, but not making something
worse, so I'm ok with current file name.

> 
> [...snip...]
> 
> > diff --git a/tools/testing/selftests/damon/_common.sh b/tools/testing/selftests/damon/_common.sh
> > new file mode 100644
> > index 000000000000..3920b619c30f
> > --- /dev/null
> > +++ b/tools/testing/selftests/damon/_common.sh
> > @@ -0,0 +1,14 @@
> > +#!/bin/bash
> > +# SPDX-License-Identifier: GPL-2.0
> > +
> > +# Kselftest frmework requirement - SKIP code is 4.
> > +ksft_skip=4
> > +
> > +check_dependencies()
> > +{
> > +	if [ $EUID -ne 0 ]
> > +	then
> > +		echo "Run as root"
> > +		exit $ksft_skip
> > +	fi
> > +}
> > diff --git a/tools/testing/selftests/damon/lru_sort.sh b/tools/testing/selftests/damon/lru_sort.sh
> > index 61b80197c896..0d128d809fd3 100755
> > --- a/tools/testing/selftests/damon/lru_sort.sh
> > +++ b/tools/testing/selftests/damon/lru_sort.sh
> > @@ -1,14 +1,9 @@
> >  #!/bin/bash
> >  # SPDX-License-Identifier: GPL-2.0
> >  
> > -# Kselftest framework requirement - SKIP code is 4.
> > -ksft_skip=4
> 
> Hm, I think factoring out check_dependencies() is a good idea, but maybe we
> should keep ksft_skip in here since other checks in the script use the value?
> My 2c is that it might make it unnecessarily opaque for others.
> Same comment applies for the other files as well. 
> 
> But I will let SJ comment on this more ;)

I agree Joshua's point.  I'd prefer keeping ksft_skip definition here.

> 
> Thank you for your patch, I hope you have a great day!

Thank you for your valuable comments, Joshua :)


Thanks,
SJ

[...]


  reply	other threads:[~2025-07-17 16:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-17  9:19 [PATCH] selftests/damon: introduce _common.sh to host shared function Enze Li
2025-07-17 13:54 ` Joshua Hahn
2025-07-17 16:14   ` SeongJae Park [this message]
2025-07-18  6:27     ` Enze Li
2025-07-17 16:24 ` SeongJae Park

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250717161454.62245-1-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=damon@lists.linux.dev \
    --cc=enze.li@gmx.com \
    --cc=joshua.hahnjy@gmail.com \
    --cc=lienze@kylinos.cn \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).