Skip to contentSkip to conversation

selftests: Make test_harness.h more generally available

PATCH Superseded Mickaël Salaün 4 participants 5 messages Apr 30, 2017 – May 1, 2017

Subsystems (2)

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests: Make test_harness.h more generally available

The seccomp/test_harness.h file contains useful helpers to build tests. Moving it to the selftest directory should benefit to other test components.

---
 tools/testing/selftests/seccomp/seccomp_bpf.c        | 2 +-
 tools/testing/selftests/{seccomp => }/test_harness.h | 0
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename tools/testing/selftests/{seccomp => }/test_harness.h (100%)
tools/testing/selftests/seccomp/seccomp_bpf.c +1 -1
index 03f1fa495d74..d7095ff58e72 100644
@@ -37,7 +37,7 @@
 #include <unistd.h>
 #include <sys/syscall.h>
 
-#include "test_harness.h"
+#include "../test_harness.h"
 
 #ifndef PR_SET_PTRACER
 # define PR_SET_PTRACER 0x59616d61
tools/testing/selftests/test_harness.h renamed from tools/testing/selftests/seccomp/test_harness.h +0 -0
similarity index 100%
rename from tools/testing/selftests/seccomp/test_harness.h
rename to tools/testing/selftests/test_harness.h
Signature · 1 line
2.11.0
Acked-by on v1 1/1
#1 lore raw
Quoted 3 lines · Mickaël Salaün

The seccomp/test_harness.h file contains useful helpers to build tests. Moving it to the selftest directory should benefit to other test components.

Unless Shuah thinks this should live in a new include/ directory, this looks fine to me.

Thanks!

-Kees

Quoted 33 lines
---
 tools/testing/selftests/seccomp/seccomp_bpf.c        | 2 +-
 tools/testing/selftests/{seccomp => }/test_harness.h | 0
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename tools/testing/selftests/{seccomp => }/test_harness.h (100%)
tools/testing/selftests/seccomp/seccomp_bpf.c +1 -1
index 03f1fa495d74..d7095ff58e72 100644
@@ -37,7 +37,7 @@
 #include <unistd.h>
 #include <sys/syscall.h>
 
-#include "test_harness.h"
+#include "../test_harness.h"
 
 #ifndef PR_SET_PTRACER
 # define PR_SET_PTRACER 0x59616d61
tools/testing/selftests/test_harness.h renamed from tools/testing/selftests/seccomp/test_harness.h +0 -1
similarity index 100%
rename from tools/testing/selftests/seccomp/test_harness.h
rename to tools/testing/selftests/test_harness.h
--

2.11.0

Signature · 2 lines
Kees Cook
Pixel Security
reviewer Acked-by
#2 lore raw
Quoted 10 lines · Kees Cook
Quoted 3 lines · Mickaël Salaün

The seccomp/test_harness.h file contains useful helpers to build tests. Moving it to the selftest directory should benefit to other test components.

Unless Shuah thinks this should live in a new include/ directory, this looks fine to me.

Same here!

Quoted 44 lines

Thanks!

-Kees

Quoted 31 lines
---
 tools/testing/selftests/seccomp/seccomp_bpf.c        | 2 +-
 tools/testing/selftests/{seccomp => }/test_harness.h | 0
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename tools/testing/selftests/{seccomp => }/test_harness.h (100%)
tools/testing/selftests/seccomp/seccomp_bpf.c +1 -1
index 03f1fa495d74..d7095ff58e72 100644
@@ -37,7 +37,7 @@
 #include <unistd.h>
 #include <sys/syscall.h>
 
-#include "test_harness.h"
+#include "../test_harness.h"
 
 #ifndef PR_SET_PTRACER
 # define PR_SET_PTRACER 0x59616d61
tools/testing/selftests/test_harness.h renamed from tools/testing/selftests/seccomp/test_harness.h +0 -1
similarity index 100%
rename from tools/testing/selftests/seccomp/test_harness.h
rename to tools/testing/selftests/test_harness.h
--
Quoted 2 lines

2.11.0

--
Kees Cook
Pixel Security

#3 lore raw

Maybe an update on the MAINTAINERS file could help for future reviews?

MAINTAINERS +1 -0
index c265a5fe4848..0361364afb50 100644
@@ -11254,6 +11254,7 @@ F:      kernel/seccomp.c
 F:     include/uapi/linux/seccomp.h
 F:     include/linux/seccomp.h
 F:     tools/testing/selftests/seccomp/*
+F:     tools/testing/selftests/test_harness.h
 K:     \bsecure_computing
 K:     \bTIF_SECCOMP\b
 
Quoted 61 lines · Will Drewry
Quoted 10 lines · Kees Cook
Quoted 3 lines · Mickaël Salaün

The seccomp/test_harness.h file contains useful helpers to build tests. Moving it to the selftest directory should benefit to other test components.

Unless Shuah thinks this should live in a new include/ directory, this looks fine to me.

Same here!

Quoted 44 lines

Thanks!

-Kees

Quoted 31 lines
---
 tools/testing/selftests/seccomp/seccomp_bpf.c        | 2 +-
 tools/testing/selftests/{seccomp => }/test_harness.h | 0
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename tools/testing/selftests/{seccomp => }/test_harness.h (100%)
tools/testing/selftests/seccomp/seccomp_bpf.c +1 -1
index 03f1fa495d74..d7095ff58e72 100644
@@ -37,7 +37,7 @@
 #include <unistd.h>
 #include <sys/syscall.h>
 
-#include "test_harness.h"
+#include "../test_harness.h"
 
 #ifndef PR_SET_PTRACER
 # define PR_SET_PTRACER 0x59616d61
tools/testing/selftests/test_harness.h renamed from tools/testing/selftests/seccomp/test_harness.h +0 -1
similarity index 100%
rename from tools/testing/selftests/seccomp/test_harness.h
rename to tools/testing/selftests/test_harness.h
--
Quoted 2 lines

2.11.0

--
Kees Cook
Pixel Security

maintainer
#4 lore raw
In reply to Will Drewry
Quoted 7 lines · Will Drewry
Quoted 6 lines · Kees Cook
Quoted 3 lines · Mickaël Salaün

The seccomp/test_harness.h file contains useful helpers to build tests. Moving it to the selftest directory should benefit to other test components.

Quoted 10 lines
Quoted 4 lines

Unless Shuah thinks this should live in a new include/ directory, this looks fine to me.

Same here!

Quoted 1 line

I think the location fine. It will be a good idea to write documentation on how to use this harness. I would recommend rename the file to kselftest_harness.h and a doc file kselftest_harness.txt which will go into Documentation directory.

thanks,
- Shuah