Re: [PATCH net-next 2/6] selftests: bonding: Add net/forwarding/lib.sh to TEST_INCLUDES

From
Jay Vosburgh <hidden>
Date
2024-01-25 01:04:18
Also in
linux-doc, linux-kselftest
Reply to
Benjamin Poirier, 2024-01-24
Benjamin Poirier [off-list ref] wrote:
On 2024-01-24 10:24 -0800, Jay Vosburgh wrote:
[...]
quoted
quoted
diff --git a/tools/testing/selftests/drivers/net/bonding/bond_topo_2d1c.sh b/tools/testing/selftests/drivers/net/bonding/bond_topo_2d1c.sh
index a509ef949dcf..0eb7edfb584c 100644
--- a/tools/testing/selftests/drivers/net/bonding/bond_topo_2d1c.sh
+++ b/tools/testing/selftests/drivers/net/bonding/bond_topo_2d1c.sh
@@ -28,7 +28,7 @@
REQUIRE_MZ=no
NUM_NETIFS=0
lib_dir=$(dirname "$0")
-source ${lib_dir}/net_forwarding_lib.sh
+source "$lib_dir"/../../../net/forwarding/lib.sh
	Is there a way to pass TEST_INCLUDES via the environment or as a
parameter, so that it's not necessary to hard code the path name here
and in the similar cases below?
It think would be possible but I see two issues:

1) Tests can be run in a myriad ways. Some of them (`make run_tests`,
`run_kselftest.sh`) use runner.sh which would be the place to set
environment variables for a test. However it's also possible to run
tests directly:

tools/testing/selftests/drivers/net/bonding# ./dev_addr_lists.sh

In that case, there's nothing to automatically set an environment
variable for the test.

I think that could be addressed, for example by putting the content of
TEST_INCLUDES in a file and having the test read it itself, but ...

2)
As can be seen in the dsa case and in the bonding and team cases after
patch 6, the relationship between the files listed in TEST_INCLUDES and
the files sourced in a test is not 1:1. So automatically sourcing all
files listed in TEST_INCLUDES is not generally applicable.

Given these two points, I'm inclined to stick with the current approach.
What do you think?
	That rationale sounds fine; I was wondering if there was a
straightforward way to centralize the naming of the "library" without
having to literally hard code it all over the place, but that doesn't
seem to be the case.  Thanks for the explanation.

	-J

---
	-Jay Vosburgh, jay.vosburgh@canonical.com
Thread (14 messages) 14 messages, 4 authors, last reply 2024-01-25
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help