selftests: introduce gen_tar Makefile target
Subsystems (3)
PATCH 1/1 selftests: introduce gen_tar Makefile target
The gen_kselftest_tar.sh always packages *all* selftests and doesn't pass along any variables to make install to influence what should be built. This can result in an early error on the command line ("Unknown tarball format TARGETS=XXX"), or unexpected test failures as the tarball contains tests people wanted to skip on purpose.
Since the makefile already contains all the logic, we can add a target for packaging. Keep the default .gz target the script uses, and actually extend the supported formats by using tar's autodetection.
To not break current workflows, keep the gen_kselftest_tar.sh script as it is, with an added suggestion to use the makefile target instead.
--- Documentation/dev-tools/kselftest.rst | 23 ++++++++++++++++++++ tools/testing/selftests/Makefile | 9 +++++++- tools/testing/selftests/gen_kselftest_tar.sh | 5 +++++ 3 files changed, 36 insertions(+), 1 deletion(-)
Documentation/dev-tools/kselftest.rst +23 -0
@@ -151,6 +151,29 @@ note some tests will require root privileges:: $ cd kselftest $ ./run_kselftest.sh +Packaging selftests +=================== + +In some cases packaging is desired, such as when tests need to run on a +different system. To package selftests, run:: + + $ make -C tools/testing/selftests gen_tar + +This generates a tarball in the `INSTALL_PATH/kselftest-packages` directory. By +default, `.gz` format is used. The tar format can be overriden by specifying +a `FORMAT` make variable. Any value recognized by `tar's auto-compress`_ option +is supported, such as:: + + $ make -C tools/testing/selftests gen_tar FORMAT=.xz + +`make gen_tar` invokes `make install` so you can use it to package a subset of +tests by using variables specified in `Running a subset of selftests`_ +section:: + + $ make -C tools/testing/selftests gen_tar TARGETS="bpf" FORMAT=.xz + +.. _tar's auto-compress: https://www.gnu.org/software/tar/manual/html_node/gzip.html#auto_002dcompress + Contributing new tests ======================
tools/testing/selftests/Makefile +8 -1
@@ -249,10 +249,17 @@ else $(error Error: set INSTALL_PATH to use install) endif +FORMAT ?= .gz +TAR_PATH = $(abspath ${INSTALL_PATH}/kselftest-packages/kselftest.tar${FORMAT}) +gen_tar: install + @mkdir -p ${INSTALL_PATH}/kselftest-packages/ + @tar caf ${TAR_PATH} --exclude=kselftest-packages -C ${INSTALL_PATH} . + @echo "Created ${TAR_PATH}" + clean: @for TARGET in $(TARGETS); do \ BUILD_TARGET=$$BUILD/$$TARGET; \ $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\ done; -.PHONY: khdr all run_tests hotplug run_hotplug clean_hotplug run_pstore_crash install clean +.PHONY: khdr all run_tests hotplug run_hotplug clean_hotplug run_pstore_crash install clean gen_tar
tools/testing/selftests/gen_kselftest_tar.sh +5 -0
@@ -49,6 +49,11 @@ main() # directory ./kselftest_install.sh "$install_dir" (cd "$install_work"; tar $copts "$dest"/kselftest${ext} $install_name) + + # Don't put the message at the actual end as people may be parsing the + # "archive created" line in their scripts. + echo -e "\nConsider using 'make gen_tar' instead of this script\n" + echo "Kselftest archive kselftest${ext} created!" # clean up top-level install work directory
Signature · 1 line
2.25.1
shuah
maintainerHi Veronica,
Quoted 10 lines · Veronika Kabatova
The
gen_kselftest_tar.shalways packages *all* selftests and doesn't pass along any variables tomake installto influence what should be built. This can result in an early error on the command line ("Unknown tarball format TARGETS=XXX"), or unexpected test failures as the tarball contains tests people wanted to skip on purpose.Since the makefile already contains all the logic, we can add a target for packaging. Keep the default .gz target the script uses, and actually extend the supported formats by using tar's autodetection.
Thanks for working on this. gen_kselftest_tar.sh a while back before a lot of the install features went in and Makefile supports it fully. It makes perfect sense to use Makefile drive this.
Quoted 3 lines
To not break current workflows, keep the
gen_kselftest_tar.shscript as it is, with an added suggestion to use the makefile target instead.
Not sure how many people use this. It is a good idea keeping it around for now.
Quoted 14 lines
Signed-off-by Veronika Kabatova <[email protected]>Reviewed-by Stefano Brivio <[email protected]>--- Documentation/dev-tools/kselftest.rst | 23 ++++++++++++++++++++ tools/testing/selftests/Makefile | 9 +++++++- tools/testing/selftests/gen_kselftest_tar.sh | 5 +++++ 3 files changed, 36 insertions(+), 1 deletion(-)Documentation/dev-tools/kselftest.rst +0
-0@@ -151,6 +151,29 @@ note some tests will require root privileges:: $ cd kselftest
Documentation/dev-tools/kselftest.rst note some tests will require root privileges:: · line 161
Quoted 10 lines
Documentation/dev-tools/kselftest.rst +8
-0$ ./run_kselftest.sh +Packaging selftests +=================== + +In some cases packaging is desired, such as when tests need to run on a +different system. To package selftests, run:: + + $ make -C tools/testing/selftests gen_tar +
Does this work in the case of relocatable build.cross-build cases?
Documentation/dev-tools/kselftest.rst note some tests will require root privileges:: · line 173
Quoted 12 lines
Documentation/dev-tools/kselftest.rst +12
-0+This generates a tarball in the `INSTALL_PATH/kselftest-packages` directory. By +default, `.gz` format is used. The tar format can be overriden by specifying +a `FORMAT` make variable. Any value recognized by `tar's auto-compress`_ option +is supported, such as:: + + $ make -C tools/testing/selftests gen_tar FORMAT=.xz + +`make gen_tar` invokes `make install` so you can use it to package a subset of +tests by using variables specified in `Running a subset of selftests`_ +section:: + + $ make -C tools/testing/selftests gen_tar TARGETS="bpf" FORMAT=.xz
Does this work in the case of relocatable build.cross-build cases?
Please try these cases as well and let me know.
I would like to get this in for 5.8-rc1.
thanks,
-- Shuah
----- Original Message -----
Quoted 9 lines
From: "shuah" <[email protected]>
To: "Veronika Kabatova" <[email protected]>
Cc: [email protected], [email protected], "Veronika Kabatova" <[email protected]>, "shuah" <[email protected]>
Sent: Friday, May 1, 2020 4:49:34 PM
Subject: Re: [PATCH] selftests: introducegen_tarMakefiletargetHi Veronica,
Hi,
Quoted 61 lines · Veronika Kabatova
Quoted 10 lines
The
gen_kselftest_tar.shalways packages *all* selftests and doesn't pass along any variables tomake installto influence what should be built. This can result in an early error on the command line ("Unknown tarball format TARGETS=XXX"), or unexpected test failures as the tarball contains tests people wanted to skip on purpose.Since the makefile already contains all the logic, we can add a target for packaging. Keep the default .gz target the script uses, and actually extend the supported formats by using tar's autodetection.
Thanks for working on this.
gen_kselftest_tar.sha while back before a lot of the install features went in andMakefilesupports it fully. It makes perfect sense to useMakefiledrive this.Quoted 3 lines
To not break current workflows, keep the
gen_kselftest_tar.shscript as it is, with an added suggestion to use the makefile target instead.Not sure how many people use this. It is a good idea keeping it around for now.
Quoted 15 lines
Signed-off-by Veronika Kabatova <[email protected]>Reviewed-by Stefano Brivio <[email protected]>--- Documentation/dev-tools/kselftest.rst | 23 ++++++++++++++++++++ tools/testing/selftests/Makefile | 9 +++++++- tools/testing/selftests/gen_kselftest_tar.sh | 5 +++++ 3 files changed, 36 insertions(+), 1 deletion(-)Documentation/dev-tools/kselftest.rst +0
-0@@ -151,6 +151,29 @@ note some tests will require root privileges:: $ cd kselftestDocumentation/dev-tools/kselftest.rst note some tests will require root privileges:: · line 161
Quoted 10 lines
Documentation/dev-tools/kselftest.rst +8
-0$ ./run_kselftest.sh +Packaging selftests +=================== + +In some cases packaging is desired, such as when tests need to run on a +different system. To package selftests, run:: + + $ make -C tools/testing/selftests gen_tar +Does this work in the case of relocatable build.cross-build cases?
Quoted 10 lines
Documentation/dev-tools/kselftest.rst +1
-0+This generates a tarball in the `INSTALL_PATH/kselftest-packages`directory. By
+default,.gzformat is used. The tar format can be overriden by specifying
+aFORMATmake variable. Any value recognized bytar's auto-compress_ optionDocumentation/dev-tools/kselftest.rst +4
-0+is supported, such as:: + + $ make -C tools/testing/selftests gen_tar FORMAT=.xz +
Quoted 9 lines
Documentation/dev-tools/kselftest.rst note some tests will require root privileges:: · line 173
Quoted 6 lines
+
make gen_tarinvokesmake installso you can use it to package a subset ofDocumentation/dev-tools/kselftest.rst +4
-0+tests by using variables specified in `Running a subset of selftests`_ +section:: + + $ make -C tools/testing/selftests gen_tar TARGETS="bpf" FORMAT=.xzDoes this work in the case of relocatable build.cross-build cases?
The command only adds a "tar" call on top of "make install" and doesn't reach outside of INSTALL_PATH. If the cases you mention are supported by the regular "make install" then they should work with "gen_tar" as well.
Veronika
Quoted 8 lines
Please try these cases as well and let me know.
I would like to get this in for 5.8-rc1.
thanks,
-- Shuah
shuah
maintainerQuoted 86 lines · Veronika Kabatova
----- Original Message -----
Quoted 9 lines
From: "shuah" <[email protected]>
To: "Veronika Kabatova" <[email protected]>
Cc: [email protected], [email protected], "Veronika Kabatova" <[email protected]>, "shuah" <[email protected]>
Sent: Friday, May 1, 2020 4:49:34 PM
Subject: Re: [PATCH] selftests: introducegen_tarMakefiletargetHi Veronica,
Hi,
Quoted 61 lines · Veronika Kabatova
Quoted 10 lines
The
gen_kselftest_tar.shalways packages *all* selftests and doesn't pass along any variables tomake installto influence what should be built. This can result in an early error on the command line ("Unknown tarball format TARGETS=XXX"), or unexpected test failures as the tarball contains tests people wanted to skip on purpose.Since the makefile already contains all the logic, we can add a target for packaging. Keep the default .gz target the script uses, and actually extend the supported formats by using tar's autodetection.
Thanks for working on this.
gen_kselftest_tar.sha while back before a lot of the install features went in andMakefilesupports it fully. It makes perfect sense to useMakefiledrive this.Quoted 3 lines
To not break current workflows, keep the
gen_kselftest_tar.shscript as it is, with an added suggestion to use the makefile target instead.Not sure how many people use this. It is a good idea keeping it around for now.
Quoted 15 lines
Signed-off-by Veronika Kabatova <[email protected]>Reviewed-by Stefano Brivio <[email protected]>--- Documentation/dev-tools/kselftest.rst | 23 ++++++++++++++++++++ tools/testing/selftests/Makefile | 9 +++++++- tools/testing/selftests/gen_kselftest_tar.sh | 5 +++++ 3 files changed, 36 insertions(+), 1 deletion(-)Documentation/dev-tools/kselftest.rst +0
-0@@ -151,6 +151,29 @@ note some tests will require root privileges:: $ cd kselftestDocumentation/dev-tools/kselftest.rst note some tests will require root privileges:: · line 161
Quoted 10 lines
Documentation/dev-tools/kselftest.rst +8
-0$ ./run_kselftest.sh +Packaging selftests +=================== + +In some cases packaging is desired, such as when tests need to run on a +different system. To package selftests, run:: + + $ make -C tools/testing/selftests gen_tar +Does this work in the case of relocatable build.cross-build cases?
Quoted 10 lines
Documentation/dev-tools/kselftest.rst +1
-0+This generates a tarball in the `INSTALL_PATH/kselftest-packages`directory. By
+default,.gzformat is used. The tar format can be overriden by specifying
+aFORMATmake variable. Any value recognized bytar's auto-compress_ optionDocumentation/dev-tools/kselftest.rst +4
-0+is supported, such as:: + + $ make -C tools/testing/selftests gen_tar FORMAT=.xz +Quoted 9 lines
Documentation/dev-tools/kselftest.rst note some tests will require root privileges:: · line 173
Quoted 6 lines
+
make gen_tarinvokesmake installso you can use it to package a subset ofDocumentation/dev-tools/kselftest.rst +4
-0+tests by using variables specified in `Running a subset of selftests`_ +section:: + + $ make -C tools/testing/selftests gen_tar TARGETS="bpf" FORMAT=.xzDoes this work in the case of relocatable build.cross-build cases?
Quoted 4 lines
The command only adds a "tar" call on top of "make install" and doesn't reach outside of
INSTALL_PATH. If the cases you mention are supported by the regular "make install" then they should work with "gen_tar" as well.
Sounds good. I will queue this up for 5.8-rc1
thanks,
-- Shuah
shuah
maintainerHi Veronika,
Quoted 32 lines · shuah
Quoted 31 lines · Veronika Kabatova
----- Original Message -----
Quoted 9 lines
From: "shuah" <[email protected]>
To: "Veronika Kabatova" <[email protected]>
Cc: [email protected], [email protected], "Veronika Kabatova" <[email protected]>, "shuah" <[email protected]>
Sent: Friday, May 1, 2020 4:49:34 PM
Subject: Re: [PATCH] selftests: introducegen_tarMakefiletargetHi Veronica,
Hi,
Quoted 16 lines · Veronika Kabatova
Quoted 10 lines
The
gen_kselftest_tar.shalways packages *all* selftests and doesn't pass along any variables tomake installto influence what should be built. This can result in an early error on the command line ("Unknown tarball format TARGETS=XXX"), or unexpected test failures as the tarball contains tests people wanted to skip on purpose.Since the makefile already contains all the logic, we can add a target for packaging. Keep the default .gz target the script uses, and actually extend the supported formats by using tar's autodetection.
Thanks for working on this. gen_kselftest_tar.sh a while back before a lot of the install features went in and
Makefilesupports it fully. It makes perfect sense to useMakefiledrive this.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
To not break current workflows, keep the
gen_kselftest_tar.shscript as it is, with an added suggestion to use the makefile target instead.Not sure how many people use this. It is a good idea keeping it around for now.
Quoted 1 line
Signed-off-by Veronika Kabatova <[email protected]>
There is a mispatch between your from email address and signed-off line. Please make sure they match.
Also there is a spelling error in the document.
WARNING: 'overriden' may be misspelled - perhaps 'overridden'? #125: FILE: Documentation/dev-tools/kselftest.rst:163:
+default, .gz format is used. The tar format can be overriden by specifying
WARNING: Missing Signed-off-by: line by nominal patch author 'Veronika Kabatova <[email protected]>'
Please fix them and sen me v2.
thanks,
-- Shuah
----- Original Message -----
Quoted 56 lines
From: "shuah" <[email protected]>
To: "Veronika Kabatova" <[email protected]>
Cc: "Veronika Kabatova" <[email protected]>, [email protected], [email protected], "shuah" <[email protected]>
Sent: Tuesday, May 19, 2020 8:39:23 PM
Subject: Re: [PATCH] selftests: introducegen_tarMakefiletargetHi Veronika,
Quoted 34 lines · shuah
Quoted 33 lines · Veronika Kabatova
----- Original Message -----
Quoted 10 lines
From: "shuah" <[email protected]>
To: "Veronika Kabatova" <[email protected]>
Cc: [email protected], [email protected], "Veronika Kabatova" <[email protected]>, "shuah" <[email protected]>
Sent: Friday, May 1, 2020 4:49:34 PM
Subject: Re: [PATCH] selftests: introducegen_tarMakefiletargetHi Veronica,
Hi,
Quoted 17 lines · Veronika Kabatova
Quoted 11 lines
The
gen_kselftest_tar.shalways packages *all* selftests and doesn't pass along any variables tomake installto influence what should be built. This can result in an early error on the command line ("Unknown tarball format TARGETS=XXX"), or unexpected test failures as the tarball contains tests people wanted to skip on purpose.Since the makefile already contains all the logic, we can add a target for packaging. Keep the default .gz target the script uses, and actually
extend the supported formats by using tar's autodetection.Thanks for working on this. gen_kselftest_tar.sh a while back before a lot of the install features went in and
Makefilesupports it fully. It makes perfect sense to useMakefiledrive this.Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
To not break current workflows, keep the
gen_kselftest_tar.shscript as it is, with an added suggestion to use the makefile target instead.Not sure how many people use this. It is a good idea keeping it around for now.
Quoted 1 line
Signed-off-by Veronika Kabatova <[email protected]>There is a mispatch between your from email address and signed-off line. Please make sure they match.
Quoted 8 lines
Also there is a spelling error in the document.
WARNING: 'overriden' may be misspelled - perhaps 'overridden'? #125: FILE:
Documentation/dev-tools/kselftest.rst:163:
+default,.gzformat is used. The tar format can be overriden by specifying
Thanks for pointing it out.
Quoted 3 lines
WARNING: Missing Signed-off-by: line by nominal patch author 'Veronika Kabatova <[email protected]>'
Yes, that's because the work email decided to drop some public addresses and the original patch didn't make it to you or the list. We got it fixed so I'll send a v2 from there in a minute, sorry for the trouble.
Veronika
Quoted 6 lines
Please fix them and sen me v2.
thanks,
-- Shuah