tools/include/linux/kernel.h and kselftest_harness.h are missing
ifndef guard around ARRAY_SIZE define. Fix them to avoid duplicate
define errors during compile when another file defines it. This
problem was found when compiling selftests that include a header
with ARRAY_SIZE define.
ARRAY_SIZE is defined in several selftests. There are about 25+
duplicate defines in various selftests source and header files.
Add ARRAY_SIZE to kselftest.h in preparation for removing duplicate
ARRAY_SIZE defines from individual test files.
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
---
tools/include/linux/kernel.h | 2 ++
tools/testing/selftests/kselftest.h | 4 ++++
tools/testing/selftests/kselftest_harness.h | 2 ++
3 files changed, 8 insertions(+)
@@ -671,7 +671,9 @@#define EXPECT_STRNE(expected, seen) \__EXPECT_STR(expected,seen,!=,0)+#ifndef ARRAY_SIZE#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))+#endif/* Support an optional handler after and ASSERT_* or EXPECT_*. The approach is*notthread-safe,butitshouldbefineinmostsanetestscenarios.
ARRAY_SIZE is defined in several selftests. Remove definitions from
individual test files and include header file for the define instead.
ARRAY_SIZE define is added in a separate patch to prepare for this
change.
Remove ARRAY_SIZE from cgroup_util.h and pickup the one defined in
kselftest.h.
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
---
tools/testing/selftests/cgroup/cgroup_util.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
ARRAY_SIZE is defined in several selftests. Remove definitions from
individual test files and include header file for the define instead.
ARRAY_SIZE define is added in a separate patch to prepare for this
change.
Remove ARRAY_SIZE from ir_loopback.c and pickup the one defined
in kselftest.h.
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
---
tools/testing/selftests/ir/ir_loopback.c | 1 -
1 file changed, 1 deletion(-)
ARRAY_SIZE is defined in several selftests. Remove definitions from
individual test files and include header file for the define instead.
ARRAY_SIZE define is added in a separate patch to prepare for this
change.
Remove ARRAY_SIZE from close_range_test.c and pickup the one defined
in kselftest.h.
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
---
tools/testing/selftests/core/close_range_test.c | 4 ----
1 file changed, 4 deletions(-)
ARRAY_SIZE is defined in several selftests. Remove definitions from
individual test files and include header file for the define instead.
ARRAY_SIZE define is added in a separate patch to prepare for this
change.
Remove ARRAY_SIZE from vec-syscfg.c and pickup the one defined in
kselftest.h.
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
---
tools/testing/selftests/arm64/fp/vec-syscfg.c | 2 --
1 file changed, 2 deletions(-)
ARRAY_SIZE is defined in several selftests. Remove definitions from
individual test files and include header file for the define instead.
ARRAY_SIZE define is added in a separate patch to prepare for this
change.
Remove ARRAY_SIZE from common.h and pickup the one defined in
kselftest.h.
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
---
tools/testing/selftests/landlock/common.h | 4 ----
1 file changed, 4 deletions(-)
ARRAY_SIZE is defined in several selftests. Remove definitions from
individual test files and include header file for the define instead.
ARRAY_SIZE define is added in a separate patch to prepare for this
change.
Remove ARRAY_SIZE from net tests and pickup the one defined in
kselftest.h.
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
---
tools/testing/selftests/net/gro.c | 3 ++-
tools/testing/selftests/net/ipsec.c | 1 -
tools/testing/selftests/net/reuseport_bpf.c | 4 +---
tools/testing/selftests/net/rxtimestamp.c | 2 +-
tools/testing/selftests/net/socket.c | 3 ++-
tools/testing/selftests/net/tcp_fastopen_backup_key.c | 6 ++----
6 files changed, 8 insertions(+), 11 deletions(-)
ARRAY_SIZE is defined in several selftests. Remove definitions from
individual test files and include header file for the define instead.
ARRAY_SIZE define is added in a separate patch to prepare for this
change.
Remove ARRAY_SIZE from rseq tests and pickup the one defined in
kselftest.h.
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
---
tools/testing/selftests/rseq/basic_percpu_ops_test.c | 3 +--
tools/testing/selftests/rseq/rseq.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
ARRAY_SIZE is defined in several selftests. Remove definitions from
individual test files and include header file for the define instead.
ARRAY_SIZE define is added in a separate patch to prepare for this
change.
Remove ARRAY_SIZE from seccomp_benchmark and pickup the one defined in
kselftest.h.
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
---
tools/testing/selftests/seccomp/seccomp_benchmark.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
ARRAY_SIZE is defined in several selftests. Remove definitions from
individual test files and include header file for the define instead.
ARRAY_SIZE define is added in a separate patch to prepare for this
change.
Remove ARRAY_SIZE from timens tests and pickup the one defined in
kselftest.h.
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
---
tools/testing/selftests/timens/procfs.c | 2 --
tools/testing/selftests/timens/timens.c | 2 --
2 files changed, 4 deletions(-)
ARRAY_SIZE is defined in several selftests. Remove definition from
individual test files and include header file for the define instead.
ARRAY_SIZE define is added in a separate patch to prepare for this
change.
Remove ARRAY_SIZE from adi-test and pickup the one defined in
kselftest.h.
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
---
tools/testing/selftests/sparc64/drivers/adi-test.c | 4 ----
1 file changed, 4 deletions(-)
ARRAY_SIZE is defined in several selftests. Remove definitions from
individual test files and include header file for the define instead.
ARRAY_SIZE define is added in a separate patch to prepare for this
change.
Remove ARRAY_SIZE from vm tests and pickup the one defined in
kselftest.h.
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
---
tools/testing/selftests/vm/mremap_test.c | 1 -
tools/testing/selftests/vm/pkey-helpers.h | 3 ++-
tools/testing/selftests/vm/va_128TBswitch.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
From: Jakub Kicinski <kuba@kernel.org> Date: 2021-12-11 03:04:00
On Fri, 10 Dec 2021 10:33:17 -0700 Shuah Khan wrote:
ARRAY_SIZE is defined in several selftests. Remove definitions from
individual test files and include header file for the define instead.
ARRAY_SIZE define is added in a separate patch to prepare for this
change.
Remove ARRAY_SIZE from net tests and pickup the one defined in
kselftest.h.
ARRAY_SIZE is defined in several selftests. Remove definitions from
individual test files and include header file for the define instead.
ARRAY_SIZE define is added in a separate patch to prepare for this
change.
Remove ARRAY_SIZE from common.h and pickup the one defined in
kselftest.h.
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
From: Will Deacon <will@kernel.org> Date: 2021-12-13 15:45:54
On Fri, Dec 10, 2021 at 10:33:12AM -0700, Shuah Khan wrote:
quoted hunk
ARRAY_SIZE is defined in several selftests. Remove definitions from
individual test files and include header file for the define instead.
ARRAY_SIZE define is added in a separate patch to prepare for this
change.
Remove ARRAY_SIZE from vec-syscfg.c and pickup the one defined in
kselftest.h.
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
---
tools/testing/selftests/arm64/fp/vec-syscfg.c | 2 --
1 file changed, 2 deletions(-)
On Fri, Dec 10, 2021 at 10:33:11AM -0700, Shuah Khan wrote:
tools/include/linux/kernel.h and kselftest_harness.h are missing
ifndef guard around ARRAY_SIZE define. Fix them to avoid duplicate
define errors during compile when another file defines it. This
problem was found when compiling selftests that include a header
with ARRAY_SIZE define.
ARRAY_SIZE is defined in several selftests. There are about 25+
duplicate defines in various selftests source and header files.
Add ARRAY_SIZE to kselftest.h in preparation for removing duplicate
ARRAY_SIZE defines from individual test files.
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
On Fri, Dec 10, 2021 at 10:33:19AM -0700, Shuah Khan wrote:
ARRAY_SIZE is defined in several selftests. Remove definitions from
individual test files and include header file for the define instead.
ARRAY_SIZE define is added in a separate patch to prepare for this
change.
Remove ARRAY_SIZE from seccomp_benchmark and pickup the one defined in
kselftest.h.
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Good idea to clean these up; thanks!
Reviewed-by: Kees Cook <redacted>
--
Kees Cook