tools: ynl: tests: adjust Makefile to mimic ksft
Subsystems (3)
Jakub Kicinski
maintainercover tools: ynl: tests: adjust Makefile to mimic ksft
Make a few minor adjustments to tools/net/ynl/tests/Makefile to align its behavior more with how real kselftests behave. This series allows running the YNL tests in NIPA with little extra integration effort.
If anyone already integrated these tests into their CI minor adjustments to the integration may be needed (due to patch 2).
Jakub Kicinski (4):
tools: ynl: rename TESTS variable to TEST_PROGS
tools: ynl: don't install tests in /usr/bin/
tools: ynl: support INSTALL_PATH in the tests Makefile
tools: ynl: produce kselftest-list.txt from tests
tools/net/ynl/tests/Makefile | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-)
Signature · 1 line
2.53.0
Jakub Kicinski
maintainerPATCH 1/4 tools: ynl: rename TESTS variable to TEST_PROGS
Use the standard kselftest variable naming for tests in the Makefile. NIPA depends on being able to selectively target tests by setting those variables on the CLI.
--- tools/net/ynl/tests/Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
tools/net/ynl/tests/Makefile +6 -6
@@ -1,23 +1,23 @@ # SPDX-License-Identifier: GPL-2.0 # Makefile for YNL tests -TESTS := \ +TEST_PROGS := \ test_ynl_cli.sh \ test_ynl_ethtool.sh \ -# end of TESTS +# end of TEST_PROGS -all: $(TESTS) +all: $(TEST_PROGS) run_tests: - @for test in $(TESTS); do \ + @for test in $(TEST_PROGS); do \ ./$$test; \ done -install: $(TESTS) +install: $(TEST_PROGS) @mkdir -p $(DESTDIR)/usr/bin @mkdir -p $(DESTDIR)/usr/share/kselftest @cp ../../../testing/selftests/kselftest/ktap_helpers.sh $(DESTDIR)/usr/share/kselftest/ - @for test in $(TESTS); do \ + @for test in $(TEST_PROGS); do \ name=$$(basename $$test .sh); \ sed -e 's|^ynl=.*|ynl="ynl"|' \ -e 's|^ynl_ethtool=.*|ynl_ethtool="ynl-ethtool"|' \
Signature · 1 line
2.53.0
Jakub Kicinski
maintainerPATCH 2/4 tools: ynl: don't install tests in /usr/bin/
In reply to Jakub KicinskiUntil commit 790792ebc960 ("tools: ynl: don't install tests") YNL selftests were installed with all the other YNL outputs. That's no longer the case, as tests are not really production artifacts. Let's not install them in /usr/bin at all, and mirror kselftest format more closely:
For: make -C tools/net/ynl/tests/ install DESTDIR=tmp
tmp/usr/share/kselftest
├── ktap_helpers.sh
└── ynl
├── test_ynl_cli.sh
└── test_ynl_ethtool.sh--- tools/net/ynl/tests/Makefile | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
tools/net/ynl/tests/Makefile +4 -5
@@ -14,16 +14,15 @@ all: $(TEST_PROGS) done install: $(TEST_PROGS) - @mkdir -p $(DESTDIR)/usr/bin - @mkdir -p $(DESTDIR)/usr/share/kselftest + @mkdir -p $(DESTDIR)/usr/share/kselftest/ynl @cp ../../../testing/selftests/kselftest/ktap_helpers.sh $(DESTDIR)/usr/share/kselftest/ @for test in $(TEST_PROGS); do \ - name=$$(basename $$test .sh); \ + name=$$(basename $$test); \ sed -e 's|^ynl=.*|ynl="ynl"|' \ -e 's|^ynl_ethtool=.*|ynl_ethtool="ynl-ethtool"|' \ -e 's|KSELFTEST_KTAP_HELPERS=.*|KSELFTEST_KTAP_HELPERS="/usr/share/kselftest/ktap_helpers.sh"|' \ - $$test > $(DESTDIR)/usr/bin/$$name; \ - chmod +x $(DESTDIR)/usr/bin/$$name; \ + $$test > $(DESTDIR)/usr/share/kselftest/ynl/$$name; \ + chmod +x $(DESTDIR)/usr/share/kselftest/ynl/$$name; \ done clean distclean:
Signature · 1 line
2.53.0
Jakub Kicinski
maintainerPATCH 3/4 tools: ynl: support INSTALL_PATH in the tests Makefile
In reply to Jakub KicinskiWe have modelled the YNL tests after ksft to be able to reuse the NIPA wrappers. Make sure YNL honors INSTALL_PATH not just DESTDIR, ksft uses INSTALL_PATH.
--- tools/net/ynl/tests/Makefile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
tools/net/ynl/tests/Makefile +7 -5
@@ -6,6 +6,8 @@ TEST_PROGS := \ test_ynl_ethtool.sh \ # end of TEST_PROGS +INSTALL_PATH ?= $(DESTDIR)/usr/share/kselftest + all: $(TEST_PROGS) run_tests:
@@ -14,15 +16,15 @@ all: $(TEST_PROGS) done install: $(TEST_PROGS) - @mkdir -p $(DESTDIR)/usr/share/kselftest/ynl - @cp ../../../testing/selftests/kselftest/ktap_helpers.sh $(DESTDIR)/usr/share/kselftest/ + @mkdir -p $(INSTALL_PATH)/ynl + @cp ../../../testing/selftests/kselftest/ktap_helpers.sh $(INSTALL_PATH)/ @for test in $(TEST_PROGS); do \ name=$$(basename $$test); \ sed -e 's|^ynl=.*|ynl="ynl"|' \ -e 's|^ynl_ethtool=.*|ynl_ethtool="ynl-ethtool"|' \ - -e 's|KSELFTEST_KTAP_HELPERS=.*|KSELFTEST_KTAP_HELPERS="/usr/share/kselftest/ktap_helpers.sh"|' \ - $$test > $(DESTDIR)/usr/share/kselftest/ynl/$$name; \ - chmod +x $(DESTDIR)/usr/share/kselftest/ynl/$$name; \ + -e 's|KSELFTEST_KTAP_HELPERS=.*|KSELFTEST_KTAP_HELPERS="$(INSTALL_PATH)/ktap_helpers.sh"|' \ + $$test > $(INSTALL_PATH)/ynl/$$name; \ + chmod +x $(INSTALL_PATH)/ynl/$$name; \ done clean distclean:
Signature · 1 line
2.53.0
Jakub Kicinski
maintainerPATCH 4/4 tools: ynl: produce kselftest-list.txt from tests
In reply to Jakub KicinskiExecutors will need kselftest-list.txt so create it when tests are installed.
--- tools/net/ynl/tests/Makefile | 3 +++ 1 file changed, 3 insertions(+)
tools/net/ynl/tests/Makefile +3 -0
@@ -26,6 +26,9 @@ install: $(TEST_PROGS) $$test > $(INSTALL_PATH)/ynl/$$name; \ chmod +x $(INSTALL_PATH)/ynl/$$name; \ done + @for test in $(TEST_PROGS); do \ + echo "ynl:$$test"; \ + done > $(INSTALL_PATH)/kselftest-list.txt clean distclean: @# Nothing to clean
Signature · 1 line
2.53.0
Hi Jakub,
Quoted 4 lines · Jakub Kicinski
Make a few minor adjustments to
tools/net/ynl/tests/Makefileto align its behavior more with how real kselftests behave. This series allows running the YNL tests in NIPA with little extra integration effort.
Good idea! This looks good to me:
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.
Quoted 8 lines · Jakub Kicinski
Make a few minor adjustments to
tools/net/ynl/tests/Makefileto align its behavior more with how real kselftests behave. This series allows running the YNL tests in NIPA with little extra integration effort.If anyone already integrated these tests into their CI minor adjustments to the integration may be needed (due to patch 2).
Quoted 12 lines
Jakub Kicinski (4):
tools: ynl: rename TESTS variable toTEST_PROGS
tools: ynl: don't install tests in/usr/bin/
tools: ynl: supportINSTALL_PATHin the testsMakefile
tools: ynl: produce kselftest-list.txt from teststools/net/ynl/tests/Makefile | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-)Signature · 1 line
2.53.0
Quoted 8 lines · Jakub Kicinski
Make a few minor adjustments to
tools/net/ynl/tests/Makefileto align its behavior more with how real kselftests behave. This series allows running the YNL tests in NIPA with little extra integration effort.If anyone already integrated these tests into their CI minor adjustments to the integration may be needed (due to patch 2).
Quoted 8 lines
Jakub Kicinski (4):
tools: ynl: rename TESTS variable toTEST_PROGS
tools: ynl: don't install tests in/usr/bin/
tools: ynl: supportINSTALL_PATHin the testsMakefile
tools: ynl: produce kselftest-list.txt from teststools/net/ynl/tests/Makefile | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-)
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Tue, 3 Mar 2026 08:35:00 -0800 you wrote:
Make a few minor adjustments to
tools/net/ynl/tests/Makefileto align its behavior more with how real kselftests behave. This series allows running the YNL tests in NIPA with little extra integration effort.If anyone already integrated these tests into their CI minor adjustments to the integration may be needed (due to patch 2).
[...]
Here is the summary with links:
- [net-next,1/4] tools: ynl: rename TESTS variable to TEST_PROGS
https://git.kernel.org/netdev/net-next/c/d86670b837fb - [net-next,2/4] tools: ynl: don't install tests in /usr/bin/ https://git.kernel.org/netdev/net-next/c/3e90e00da96b - [net-next,3/4] tools: ynl: support INSTALL_PATH in the tests Makefile https://git.kernel.org/netdev/net-next/c/2bfc36f5ea16 - [net-next,4/4] tools: ynl: produce kselftest-list.txt from tests https://git.kernel.org/netdev/net-next/c/32d6fd5832ad
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html