Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Felix Maurer <fmaurer@redhat.com>
To: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Cc: socketcan@hartkopp.net, mkl@pengutronix.de, shuah@kernel.org,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, horms@kernel.org, linux-can@vger.kernel.org,
	netdev@vger.kernel.org, linux-kselftest@vger.kernel.org,
	dcaratti@redhat.com, fstornio@redhat.com
Subject: Re: [PATCH 1/4] selftests: can: Import tst-filter from can-tests
Date: Thu, 24 Apr 2025 16:02:00 +0200	[thread overview]
Message-ID: <96bd9677-c257-480b-be3c-7c4b9b79b238@redhat.com> (raw)
In-Reply-To: <CAMZ6RqKfdNRBKoH16=7JDC2QKB+XO68mahg2X7zKDcUAM+8bzw@mail.gmail.com>

On 24.04.25 09:42, Vincent Mailhol wrote:
> On Tue. 22 Apr. 2025 at 21:08, Felix Maurer <fmaurer@redhat.com> wrote:
[...]
>> +ALL_TESTS="
>> +       test_raw_filter
>> +"
>> +
>> +net_dir=$(dirname $0)/..
>> +source $net_dir/lib.sh
>> +
>> +VCANIF="vcan0"
> 
> Here, you are making the VCANIF variable configuration, but then, in
> your test_raw_filter.c I see:
> 
>   #define VCANIF "vcan0"
> 
> This means that in order to modify the interface, one would have to
> both modify the .sh script and the .c source. Wouldn't it be possible
> to centralize this? For example by reading the environment variable in
> the C file?
> 
> Or maybe there is a smarter way to pass values in the kernel selftests
> framework which I am not aware of?

Good point, I'll try to come up with something to avoid the duplication
(either from the selftest framework or just for the CAN tests). I'd
prefer an argument to the program though, as I find this the more usual
way to pass info if one ever wants to run the test directly.

>> +setup()
>> +{
>> +       ip link add name $VCANIF type vcan || exit $ksft_skip
>> +       ip link set dev $VCANIF up
>> +       pwd
>> +}
>> +
>> +cleanup()
>> +{
>> +       ip link delete $VCANIF
>> +}
> 
> I guess that this setup() and this cleanup() is something that you
> will also need in the other can tests. Would it make sense to declare
> these in a common.sh file and just do a
> 
>   source common.sh
> 
> here?

I usually try to avoid making changes in anticipation of the future. I'm
not sure if all the tests need a similar environment and would prefer to
split this when we encounter that they do. Are you okay with that?

Thanks,
   Felix


  reply	other threads:[~2025-04-24 14:02 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-22 12:02 [PATCH 0/4] selftest: can: Start importing selftests from can-tests Felix Maurer
2025-04-22 12:02 ` [PATCH 1/4] selftests: can: Import tst-filter " Felix Maurer
2025-04-24  7:42   ` Vincent Mailhol
2025-04-24 14:02     ` Felix Maurer [this message]
2025-04-24 14:23       ` Vincent Mailhol
2025-04-22 12:02 ` [PATCH 2/4] selftests: can: use kselftest harness in test_raw_filter Felix Maurer
2025-04-24  7:42   ` Vincent Mailhol
2025-04-22 12:02 ` [PATCH 3/4] selftests: can: Use fixtures " Felix Maurer
2025-04-24  7:43   ` Vincent Mailhol
2025-04-22 12:02 ` [PATCH 4/4] selftests: can: Document test_raw_filter test cases Felix Maurer
2025-04-24  7:44   ` Vincent Mailhol
2025-04-24  8:21     ` Vincent Mailhol
2025-04-24 14:02     ` Felix Maurer
2025-04-24 15:08       ` Vincent Mailhol
2025-04-30  9:36         ` Felix Maurer
2025-04-24  7:45 ` [PATCH 0/4] selftest: can: Start importing selftests from can-tests Vincent Mailhol
2025-04-24 14:01   ` Felix Maurer
2025-04-24 15:19     ` Vincent Mailhol
2025-04-24 23:02 ` Jakub Kicinski

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=96bd9677-c257-480b-be3c-7c4b9b79b238@redhat.com \
    --to=fmaurer@redhat.com \
    --cc=davem@davemloft.net \
    --cc=dcaratti@redhat.com \
    --cc=edumazet@google.com \
    --cc=fstornio@redhat.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mailhol.vincent@wanadoo.fr \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.org \
    --cc=socketcan@hartkopp.net \
    /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