# Re: \[PATCH net-next\] selftests: forwarding: Import top-level lib.sh through $lib\_dir

- From: Hangbin Liu \<hidden\>
- Date: 2023-12-14 07:06:54 
- List: netdev
- Page: https://ratatoskr.run/netdev/2023/12/11280426
- Thread: https://ratatoskr.run/netdev/2023/12/11279846/t.md

```text
Hi Benjamin,

On Wed, Dec 13, 2023 at 04:40:53PM -0500, Benjamin Poirier wrote:
> > Hmm.. Is it possible to write a rule in the Makefile to create the net/
> > and net/forwarding folder so we can source the relative path directly. e.g.
> > 
> > ]# tree
> > .
> > ├── drivers
> > │   └── net
> > │       └── bonding
> > │           ├── bond-arp-interval-causes-panic.sh
> > │           ├── ...
> > │           └── settings
> > ├── kselftest
> > │   ├── module.sh
> > │   ├── prefix.pl
> > │   └── runner.sh
> > ├── kselftest-list.txt
> > ├── net
> > │   ├── forwarding
> > │   │   └── lib.sh
> > │   └── lib.sh
> > └── run_kselftest.sh
> 
> That sounds like a good idea. I started to work on that approach but I'm
> missing recursive inclusion. For instance
> 
> cd tools/testing/selftests
> make install TARGETS="drivers/net/bonding"
> ./kselftest_install/run_kselftest.sh -t drivers/net/bonding:dev_addr_lists.sh
> 
> includes net/forwarding/lib.sh but is missing net/lib.sh. I feel that my
> 'make' skills are rusty but I guess that with enough make code, it could
> be done. A workaround is simply to manually list the transitive
> dependencies in TEST_SH_LIBS:
>  TEST_SH_LIBS := \
> -	net/forwarding/lib.sh
> +	net/forwarding/lib.sh \
> +	net/lib.sh

Yes, this makes the user need to make sure all the recursive inclusions listed
here. A little inconvenient. But I "make" skill is worse than you...

> 
> I only converted a few files to validate that the approach is viable. I
> used the following tests:
> drivers/net/bonding/dev_addr_lists.sh
> net/test_vxlan_vnifiltering.sh
> net/forwarding/pedit_ip.sh
> 
> Let me know what you think.

Thanks! This works for me.

Cheers
Hangbin
```
