lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 17 Mar 2022 22:27:57 +0500
From:   Muhammad Usama Anjum <usama.anjum@...labora.com>
To:     Shuah Khan <shuah@...nel.org>, Jonathan Corbet <corbet@....net>
Cc:     Muhammad Usama Anjum <usama.anjum@...labora.com>,
        kernel@...labora.com, linux-kselftest@...r.kernel.org,
        linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] docs/kselftest: add more guidelines for adding new tests

Add the following new guidelines:
- Add instruction to use lib.mk
- Add instruction about how to use headers from kernel source
- Add instruction to add .gitignore file
- Add instruction about how to add new test in selftests/Makefile
- Add instruction about different build commands to test

Signed-off-by: Muhammad Usama Anjum <usama.anjum@...labora.com>
---
Following patch is fixing build of kselftest when separate output
direcotry is specified using kernel's top most Makefile. It should be
accepted first:
https://lore.kernel.org/lkml/20220223191016.1658728-1-usama.anjum@collabora.com/
---
 Documentation/dev-tools/kselftest.rst | 46 ++++++++++++++++++++++++++-
 1 file changed, 45 insertions(+), 1 deletion(-)

diff --git a/Documentation/dev-tools/kselftest.rst b/Documentation/dev-tools/kselftest.rst
index a833ecf12fbc1..637f83d1450dc 100644
--- a/Documentation/dev-tools/kselftest.rst
+++ b/Documentation/dev-tools/kselftest.rst
@@ -208,6 +208,13 @@ In general, the rules for selftests are
 Contributing new tests (details)
 ================================
 
+ * Use lib.mk instead of writing Makefile from sratch. Specify flags and
+   binaries generation flags on need basis before including lib.mk. ::
+
+    CFLAGS = $(KHDR_INCLUDES)
+    TEST_GEN_PROGS := close_range_test
+    include ../lib.mk
+
  * Use TEST_GEN_XXX if such binaries or files are generated during
    compiling.
 
@@ -230,13 +237,50 @@ Contributing new tests (details)
  * First use the headers inside the kernel source and/or git repo, and then the
    system headers.  Headers for the kernel release as opposed to headers
    installed by the distro on the system should be the primary focus to be able
-   to find regressions.
+   to find regressions. Use KHDR_INCLUDES in Makefile to include headers from
+   the kernel source.
 
  * If a test needs specific kernel config options enabled, add a config file in
    the test directory to enable them.
 
    e.g: tools/testing/selftests/android/config
 
+ * Create a .gitignore file inside test directory and add all generated objects
+   in it.
+
+ * Add new test name in TARGETS in selftests/Makefile::
+
+    TARGETS += android
+
+ * All of the following build commands should be successful
+
+   - Same directory build of kselftests::
+
+      make kselftest-all
+      make kselftest-install
+      make kselftest-clean
+      make kselftest-gen_tar
+
+   - Build with absolute output directory path::
+
+      make kselftest-all O=/abs_build_path
+      make kselftest-install O=/abs_build_path
+      make kselftest-clean O=/abs_build_path
+      make kselftest-gen_tar O=/abs_build_path
+
+   - Build with relative output directory path::
+
+      make kselftest-all O=relative_path
+      make kselftest-install O=relative_path
+      make kselftest-clean O=relative_path
+      make kselftest-gen_tar O=relative_path
+
+   - Build from Makefile of selftests directly::
+
+      make -C tools/testing/selftests
+      make -C tools/testing/selftests O=/abs_build_path
+      make -C tools/testing/selftests O=relative_path
+
 Test Module
 ===========
 
-- 
2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ