Skip to content

Commit 521ed1c

Browse files
pmachatadavem330
authored andcommitted
selftests: forwarding: Remove duplicated lib.sh content
commit 25ae948 ("selftests/net: add lib.sh") added net/lib.sh to contain code shared by tests under net/ and net/forwarding/. However, this caused issues with selftests from directories other than net/forwarding/, in particular those under drivers/net/. Those issues were avoided in a simple way by duplicating some content in commit 2114e83 ("selftests: forwarding: Avoid failures to source net/lib.sh"). In order to remove the duplicated content, restore the inclusion of net/lib.sh from net/forwarding/lib.sh but with the following changes: * net/lib.sh is imported through the net_forwarding_dir path The original expression "source ../lib.sh" would look for lib.sh in the directory above the script file's one, which did not work for tests under drivers/net/. * net/lib.sh is added to TEST_INCLUDES Since net/forwarding/lib.sh now sources net/lib.sh, both of those files must be exported along with tests which source net/forwarding/lib.sh. Suggested-by: Hangbin Liu <[email protected]> Reviewed-by: Hangbin Liu <[email protected]> Signed-off-by: Petr Machata <[email protected]> Signed-off-by: Benjamin Poirier <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9f2af91 commit 521ed1c

File tree

5 files changed

+10
-28
lines changed

5 files changed

+10
-28
lines changed

tools/testing/selftests/drivers/net/bonding/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ TEST_FILES := \
1818
bond_topo_3d1c.sh
1919

2020
TEST_INCLUDES := \
21-
../../../net/forwarding/lib.sh
21+
../../../net/forwarding/lib.sh \
22+
../../../net/lib.sh
2223

2324
include ../../../lib.mk

tools/testing/selftests/drivers/net/dsa/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ TEST_INCLUDES := \
2626
../../../net/forwarding/local_termination.sh \
2727
../../../net/forwarding/no_forwarding.sh \
2828
../../../net/forwarding/tc_actions.sh \
29-
../../../net/forwarding/tc_common.sh
29+
../../../net/forwarding/tc_common.sh \
30+
../../../net/lib.sh
3031

3132
include ../../../lib.mk

tools/testing/selftests/drivers/net/team/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ TEST_PROGS := dev_addr_lists.sh
55

66
TEST_INCLUDES := \
77
../bonding/lag_lib.sh \
8-
../../../net/forwarding/lib.sh
8+
../../../net/forwarding/lib.sh \
9+
../../../net/lib.sh
910

1011
include ../../../lib.mk

tools/testing/selftests/net/forwarding/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,4 +129,7 @@ TEST_PROGS_EXTENDED := devlink_lib.sh \
129129
sch_tbf_etsprio.sh \
130130
tc_common.sh
131131

132+
TEST_INCLUDES := \
133+
../lib.sh
134+
132135
include ../../lib.mk

tools/testing/selftests/net/forwarding/lib.sh

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -35,31 +35,7 @@ if [[ -f $net_forwarding_dir/forwarding.config ]]; then
3535
source "$net_forwarding_dir/forwarding.config"
3636
fi
3737

38-
# Kselftest framework requirement - SKIP code is 4.
39-
ksft_skip=4
40-
41-
busywait()
42-
{
43-
local timeout=$1; shift
44-
45-
local start_time="$(date -u +%s%3N)"
46-
while true
47-
do
48-
local out
49-
out=$("$@")
50-
local ret=$?
51-
if ((!ret)); then
52-
echo -n "$out"
53-
return 0
54-
fi
55-
56-
local current_time="$(date -u +%s%3N)"
57-
if ((current_time - start_time > timeout)); then
58-
echo -n "$out"
59-
return 1
60-
fi
61-
done
62-
}
38+
source "$net_forwarding_dir/../lib.sh"
6339

6440
##############################################################################
6541
# Sanity checks

0 commit comments

Comments
 (0)