summaryrefslogtreecommitdiff
path: root/Documentation/dev-tools
diff options
context:
space:
mode:
authorVeronika Kabatova <vkabatov@redhat.com>2020-05-19 22:00:45 +0200
committerShuah Khan <skhan@linuxfoundation.org>2020-05-19 16:11:46 -0600
commita5f304670b80973dfce5bc86cacff20244926cf6 (patch)
treea778cb73ee28bd813278c14fbfb0cfab7732504a /Documentation/dev-tools
parent2ef96a5bb12be62ef75b5828c0aab838ebb29cb8 (diff)
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. Signed-off-by: Veronika Kabatova <vkabatov@redhat.com> Reviewed-by: Stefano Brivio <sbrivio@redhat.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'Documentation/dev-tools')
-rw-r--r--Documentation/dev-tools/kselftest.rst23
1 files changed, 23 insertions, 0 deletions
diff --git a/Documentation/dev-tools/kselftest.rst b/Documentation/dev-tools/kselftest.rst
index 61ae13c44f91..d4f6341cf4d9 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
+
+This generates a tarball in the `INSTALL_PATH/kselftest-packages` directory. By
+default, `.gz` format is used. The tar format can be overridden 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
======================