Hi Veronica,
On 4/28/20 6:38 AM, Veronika Kabatova wrote:
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.
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.
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.
Not sure how many people use this. It is a good idea keeping it around
for now.
Signed-off-by: Veronika Kabatova <vkabatov@xxxxxxxxxx>
Reviewed-by: Stefano Brivio <sbrivio@xxxxxxxxxx>
---
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(-)
diff --git a/Documentation/dev-tools/kselftest.rst b/Documentation/dev-tools/kselftest.rst
index 61ae13c44f91..3fc559bcb597 100644
--- a/Documentation/dev-tools/kselftest.rst
+++ b/Documentation/dev-tools/kselftest.rst
@@ -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
+
Does this work in the case of relocatable build.cross-build cases?
+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