[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250521141945.13358-2-mailhol.vincent@wanadoo.fr>
Date: Wed, 21 May 2025 23:18:53 +0900
From: Vincent Mailhol <mailhol.vincent@...adoo.fr>
To: Felix Maurer <fmaurer@...hat.com>,
socketcan@...tkopp.net,
mkl@...gutronix.de
Cc: shuah@...nel.org,
davem@...emloft.net,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
horms@...nel.org,
linux-can@...r.kernel.org,
netdev@...r.kernel.org,
linux-kselftest@...r.kernel.org,
dcaratti@...hat.com,
fstornio@...hat.com,
Vincent Mailhol <mailhol.vincent@...adoo.fr>
Subject: [PATCH] selftests: can: test_raw_filter.sh: add support of physical interfaces
Allow the user to specify a physical interface through the $CANIF
environment variable. Add a $BITRATE environment variable set with a
default value of 500000.
If $CANIF is omitted or if it starts with vcan (e.g. vcan1), the test
will use the virtual can interface type. Otherwise, it will assume
that the provided interface is a physical can interface.
For example:
CANIF=can1 BITRATE=1000000 ./test_raw_filter.sh
will run set the can1 interface with a bitrate of one million and run
the tests on it.
Signed-off-by: Vincent Mailhol <mailhol.vincent@...adoo.fr>
---
This depends on "selftests: can: Import tst-filter from can-tests"
from Felix.
Link: https://lore.kernel.org/linux-can/87d289f333cba7bbcc9d69173ea1c320e4b5c3b8.1747833283.git.fmaurer@redhat.com/
---
tools/testing/selftests/net/can/test_raw_filter.sh | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/net/can/test_raw_filter.sh b/tools/testing/selftests/net/can/test_raw_filter.sh
index 2216134b431b..276d6c06ac95 100755
--- a/tools/testing/selftests/net/can/test_raw_filter.sh
+++ b/tools/testing/selftests/net/can/test_raw_filter.sh
@@ -9,17 +9,25 @@ net_dir=$(dirname $0)/..
source $net_dir/lib.sh
export CANIF=${CANIF:-"vcan0"}
+BITRATE=${BITRATE:-500000}
setup()
{
- ip link add name $CANIF type vcan || exit $ksft_skip
+ if [[ $CANIF == vcan* ]]; then
+ ip link add name $CANIF type vcan || exit $ksft_skip
+ else
+ ip link set dev $CANIF type can bitrate $BITRATE || exit $ksft_skip
+ fi
ip link set dev $CANIF up
pwd
}
cleanup()
{
- ip link delete $CANIF
+ ip link set dev $CANIF down
+ if [[ $CANIF == vcan* ]]; then
+ ip link delete $CANIF
+ fi
}
test_raw_filter()
--
2.49.0
Powered by blists - more mailing lists