Skip to contentSkip to conversation

execve: Move KUnit tests to tests/ subdirectory

PATCH Superseded Kees Cook 3 participants 3 messages Jul 17, 2024 – Jul 18, 2024

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Kees Cook

author maintainer
#0 lore raw

PATCH 1/1 execve: Move KUnit tests to tests/ subdirectory

Move the exec KUnit tests into a separate directory to avoid polluting the local directory namespace. Additionally update MAINTAINERS for the new files and mark myself as Maintainer.

---
I'll toss this into -next and send it to Linus before -rc1 closes.
---
Cc: Alexander Viro <[email protected]>
Cc: Christian Brauner <[email protected]>
Cc: Jan Kara <[email protected]>
Cc: Eric Biederman <[email protected]>
Cc: David Gow <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 MAINTAINERS                      | 5 +++--
 fs/binfmt_elf.c                  | 2 +-
 fs/exec.c                        | 2 +-
 fs/{ => tests}/binfmt_elf_test.c | 0
 fs/{ => tests}/exec_test.c       | 0
 5 files changed, 5 insertions(+), 4 deletions(-)
 rename fs/{ => tests}/binfmt_elf_test.c (100%)
 rename fs/{ => tests}/exec_test.c (100%)
MAINTAINERS +3 -2
index 8dfbe998f175..35474718c05b 100644
@@ -8211,8 +8211,8 @@ S:	Maintained
 F:	rust/kernel/net/phy.rs
 
 EXEC & BINFMT API, ELF
+M:	Kees Cook <[email protected]>
 R:	Eric Biederman <[email protected]>
-R:	Kees Cook <[email protected]>
 L:	[email protected]
 S:	Supported
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/execve
@@ -8220,7 +8220,8 @@ F:	Documentation/userspace-api/ELF.rst
 F:	fs/*binfmt_*.c
 F:	fs/Kconfig.binfmt
 F:	fs/exec.c
-F:	fs/exec_test.c
+F:	fs/tests/binfmt_*_test.c
+F:	fs/tests/exec_test.c
 F:	include/linux/binfmts.h
 F:	include/linux/elf.h
 F:	include/uapi/linux/binfmts.h
fs/binfmt_elf.c +1 -1
index 40111451aa95..1a032811b304 100644
@@ -2152,5 +2152,5 @@ core_initcall(init_elf_binfmt);
 module_exit(exit_elf_binfmt);
 
 #ifdef CONFIG_BINFMT_ELF_KUNIT_TEST
-#include "binfmt_elf_test.c"
+#include "tests/binfmt_elf_test.c"
 #endif
fs/exec.c +1 -1
index 5b580ff8d955..5a59063c50b1 100644
@@ -2244,5 +2244,5 @@ fs_initcall(init_fs_exec_sysctls);
 #endif /* CONFIG_SYSCTL */
 
 #ifdef CONFIG_EXEC_KUNIT_TEST
-#include "exec_test.c"
+#include "tests/exec_test.c"
 #endif
fs/tests/binfmt_elf_test.c renamed from fs/binfmt_elf_test.c +0 -0
similarity index 100%
rename from fs/binfmt_elf_test.c
rename to fs/tests/binfmt_elf_test.c
fs/tests/exec_test.c renamed from fs/exec_test.c +0 -0
similarity index 100%
rename from fs/exec_test.c
rename to fs/tests/exec_test.c
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Kees Cook

Move the exec KUnit tests into a separate directory to avoid polluting the local directory namespace. Additionally update MAINTAINERS for the new files and mark myself as Maintainer.

---
I'll toss this into -next and send it to Linus before -rc1 closes.
---

With s/_test/_kunit (once the docs changes are sorted), this looks good.

Cheers,
-- David

Quoted 75 lines
Cc Alexander Viro <[email protected]>
Cc Christian Brauner <[email protected]>
Cc Jan Kara <[email protected]>
Cc Eric Biederman <[email protected]>
Cc David Gow <[email protected]>
Cc Linus Torvalds <[email protected]>
---
 MAINTAINERS                      | 5 +++--
 fs/binfmt_elf.c                  | 2 +-
 fs/exec.c                        | 2 +-
 fs/{ => tests}/binfmt_elf_test.c | 0
 fs/{ => tests}/exec_test.c       | 0
 5 files changed, 5 insertions(+), 4 deletions(-)
 rename fs/{ => tests}/binfmt_elf_test.c (100%)
 rename fs/{ => tests}/exec_test.c (100%)
MAINTAINERS +3 -2
index 8dfbe998f175..35474718c05b 100644
@@ -8211,8 +8211,8 @@ S:        Maintained
 F:     rust/kernel/net/phy.rs
 
 EXEC & BINFMT API, ELF
+M:     Kees Cook <[email protected]>
 R:     Eric Biederman <[email protected]>
-R:     Kees Cook <[email protected]>
 L:     [email protected]
 S:     Supported
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/execve
@@ -8220,7 +8220,8 @@ F:        Documentation/userspace-api/ELF.rst
 F:     fs/*binfmt_*.c
 F:     fs/Kconfig.binfmt
 F:     fs/exec.c
-F:     fs/exec_test.c
+F:     fs/tests/binfmt_*_test.c
+F:     fs/tests/exec_test.c
 F:     include/linux/binfmts.h
 F:     include/linux/elf.h
 F:     include/uapi/linux/binfmts.h
fs/binfmt_elf.c +1 -1
index 40111451aa95..1a032811b304 100644
@@ -2152,5 +2152,5 @@ core_initcall(init_elf_binfmt);
 module_exit(exit_elf_binfmt);
 
 #ifdef CONFIG_BINFMT_ELF_KUNIT_TEST
-#include "binfmt_elf_test.c"
+#include "tests/binfmt_elf_test.c"
 #endif
fs/exec.c +1 -1
index 5b580ff8d955..5a59063c50b1 100644
@@ -2244,5 +2244,5 @@ fs_initcall(init_fs_exec_sysctls);
 #endif /* CONFIG_SYSCTL */
 
 #ifdef CONFIG_EXEC_KUNIT_TEST
-#include "exec_test.c"
+#include "tests/exec_test.c"
 #endif
fs/tests/binfmt_elf_test.c renamed from fs/binfmt_elf_test.c +0 -0
similarity index 100%
rename from fs/binfmt_elf_test.c
rename to fs/tests/binfmt_elf_test.c
fs/tests/exec_test.c renamed from fs/exec_test.c +0 -1
similarity index 100%
rename from fs/exec_test.c
rename to fs/tests/exec_test.c
--

2.34.1

Reviewed-by
#2 lore raw
Quoted 6 lines · On Thu, 18 Jul 2024 14:04:14 +0800 David Gow <[email protected]> wrote:
Quoted 5 lines · Kees Cook

Move the exec KUnit tests into a separate directory to avoid polluting the local directory namespace. Additionally update MAINTAINERS for the new files and mark myself as Maintainer.

Quoted 6 lines
Quoted 4 lines

---
I'll toss this into -next and send it to Linus before -rc1 closes.
---

With s/_test/_kunit (once the docs changes are sorted), this looks good.

I have no strong opinion, but I agree to David's rationale [1] on preferrence of _kunit overall, and would prefer having a consistent and simple rule.

[1] https://lore.kernel.org/CABVgOS=B29PcKyhVXtTk47k_BhjSaoxL8eF15fVhzty_0syeSQ@mail.gmail.com

Quoted 2 lines

Thanks,
SJ

[...]