Commit fc2fb38c authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'linux-kselftest-5.8-rc1' of...

Merge tag 'linux-kselftest-5.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest

Pull kselftest updates from Shuah Khan:
 "This consists of:

   - Several fixes from Masami Hiramatsu to improve coverage for lib and
     sysctl tests.

   - Clean up to vdso test and a new test for getcpu() from Mark Brown.

   - Add new gen_tar selftests Makefile target generate selftest package
     running "make gen_tar" in selftests directory from Veronika
     Kabatova.

   - Other miscellaneous fixes to timens, exec, tpm2 tests"

* tag 'linux-kselftest-5.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
  selftests/sysctl: Make sysctl test driver as a module
  selftests/sysctl: Fix to load test_sysctl module
  lib: Make test_sysctl initialized as module
  lib: Make prime number generator independently selectable
  selftests/ftrace: Return unsupported if no error_log file
  selftests/ftrace: Use printf for backslash included command
  selftests/timens: handle a case when alarm clocks are not supported
  Kernel selftests: Add check if TPM devices are supported
  selftests: vdso: Add a selftest for vDSO getcpu()
  selftests: vdso: Use a header file to prototype parse_vdso API
  selftests: vdso: Rename vdso_test to vdso_test_gettimeofday
  selftests/exec: Verify execve of non-regular files fail
  selftests: introduce gen_tar Makefile target
parents a5ad5742 382561a0
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -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
======================

+6 −1
Original line number Diff line number Diff line
@@ -6,7 +6,12 @@ config CORDIC
	  calculations are in fixed point. Module will be called cordic.

config PRIME_NUMBERS
	tristate
	tristate "Simple prime number generator for testing"
	help
	  This option provides a simple prime number generator for test
	  modules.

	  If unsure, say N.

config RATIONAL
	bool
+1 −1
Original line number Diff line number Diff line
@@ -162,7 +162,7 @@ static int __init test_sysctl_init(void)
	}
	return 0;
}
late_initcall(test_sysctl_init);
module_init(test_sysctl_init);

static void __exit test_sysctl_exit(void)
{
+8 −1
Original line number Diff line number Diff line
@@ -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
+1 −0
Original line number Diff line number Diff line
@@ -9,3 +9,4 @@ execveat.ephemeral
execveat.denatured
/recursion-depth
xxxxxxxx*
pipe
Loading