Message ID | 20240124170222.261664-1-bpoirier@nvidia.com |
---|---|
Headers | show |
Series | selftests: Add TEST_INCLUDES directive and adjust tests to use it | expand |
On 2024-01-24 10:24 -0800, Jay Vosburgh wrote: [...] > >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?