Skip to content

Commit 3e20585

Browse files
vincent-mailholmarckleinebudde
authored andcommitted
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 <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
1 parent 77442ff commit 3e20585

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

tools/testing/selftests/net/can/test_raw_filter.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,25 @@ net_dir=$(dirname $0)/..
99
source $net_dir/lib.sh
1010

1111
export CANIF=${CANIF:-"vcan0"}
12+
BITRATE=${BITRATE:-500000}
1213

1314
setup()
1415
{
15-
ip link add name $CANIF type vcan || exit $ksft_skip
16+
if [[ $CANIF == vcan* ]]; then
17+
ip link add name $CANIF type vcan || exit $ksft_skip
18+
else
19+
ip link set dev $CANIF type can bitrate $BITRATE || exit $ksft_skip
20+
fi
1621
ip link set dev $CANIF up
1722
pwd
1823
}
1924

2025
cleanup()
2126
{
22-
ip link delete $CANIF
27+
ip link set dev $CANIF down
28+
if [[ $CANIF == vcan* ]]; then
29+
ip link delete $CANIF
30+
fi
2331
}
2432

2533
test_raw_filter()

0 commit comments

Comments
 (0)