Skip to content

Commit 4369b3c

Browse files
committed
Merge tag 'linux-kselftest-next-5.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
Pull Kselftest update from Shuah Khan: "Fixes to build errors, false negatives, and several code cleanups, including the ARRAY_SIZE cleanup that removes 25+ duplicates ARRAY_SIZE defines from individual tests" * tag 'linux-kselftest-next-5.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: selftests/vm: remove ARRAY_SIZE define from individual tests selftests/timens: remove ARRAY_SIZE define from individual tests selftests/sparc64: remove ARRAY_SIZE define from adi-test selftests/seccomp: remove ARRAY_SIZE define from seccomp_benchmark selftests/rseq: remove ARRAY_SIZE define from individual tests selftests/net: remove ARRAY_SIZE define from individual tests selftests/landlock: remove ARRAY_SIZE define from common.h selftests/ir: remove ARRAY_SIZE define from ir_loopback.c selftests/core: remove ARRAY_SIZE define from close_range_test.c selftests/cgroup: remove ARRAY_SIZE define from cgroup_util.h selftests/arm64: remove ARRAY_SIZE define from vec-syscfg.c tools: fix ARRAY_SIZE defines in tools and selftests hdrs selftests: cgroup: build error multiple outpt files selftests/move_mount_set_group remove unneeded conversion to bool selftests/mount: remove unneeded conversion to bool selftests: harness: avoid false negatives if test has no ASSERTs selftests/ftrace: make kprobe profile testcase description unique selftests: clone3: clone3: add case CLONE3_ARGS_NO_TEST selftests: timers: Remove unneeded semicolon kselftests: timers:Remove unneeded semicolon
2 parents ca1a46d + e899082 commit 4369b3c

31 files changed

+49
-57
lines changed

tools/include/linux/kernel.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ int vscnprintf(char *buf, size_t size, const char *fmt, va_list args);
9292
int scnprintf(char * buf, size_t size, const char * fmt, ...);
9393
int scnprintf_pad(char * buf, size_t size, const char * fmt, ...);
9494

95+
#ifndef ARRAY_SIZE
9596
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
97+
#endif
9698

9799
#define current_gfp_context(k) 0
98100
#define synchronize_rcu()

tools/testing/selftests/arm64/fp/vec-syscfg.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
#include "../../kselftest.h"
2222
#include "rdvl.h"
2323

24-
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
25-
2624
#define ARCH_MIN_VL SVE_VL_MIN
2725

2826
struct vec_data {

tools/testing/selftests/cgroup/Makefile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ TEST_GEN_PROGS += test_core
1111
TEST_GEN_PROGS += test_freezer
1212
TEST_GEN_PROGS += test_kill
1313

14+
LOCAL_HDRS += $(selfdir)/clone3/clone3_selftests.h $(selfdir)/pidfd/pidfd.h
15+
1416
include ../lib.mk
1517

16-
$(OUTPUT)/test_memcontrol: cgroup_util.c ../clone3/clone3_selftests.h
17-
$(OUTPUT)/test_kmem: cgroup_util.c ../clone3/clone3_selftests.h
18-
$(OUTPUT)/test_core: cgroup_util.c ../clone3/clone3_selftests.h
19-
$(OUTPUT)/test_freezer: cgroup_util.c ../clone3/clone3_selftests.h
20-
$(OUTPUT)/test_kill: cgroup_util.c ../clone3/clone3_selftests.h ../pidfd/pidfd.h
18+
$(OUTPUT)/test_memcontrol: cgroup_util.c
19+
$(OUTPUT)/test_kmem: cgroup_util.c
20+
$(OUTPUT)/test_core: cgroup_util.c
21+
$(OUTPUT)/test_freezer: cgroup_util.c
22+
$(OUTPUT)/test_kill: cgroup_util.c

tools/testing/selftests/cgroup/cgroup_util.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
#include <stdbool.h>
33
#include <stdlib.h>
44

5-
#define PAGE_SIZE 4096
5+
#include "../kselftest.h"
66

7-
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
7+
#define PAGE_SIZE 4096
88

99
#define MB(x) (x << 20)
1010

tools/testing/selftests/clone3/clone3.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ static int call_clone3(uint64_t flags, size_t size, enum test_mode test_mode)
5252
size = sizeof(struct __clone_args);
5353

5454
switch (test_mode) {
55+
case CLONE3_ARGS_NO_TEST:
56+
/*
57+
* Uses default 'flags' and 'SIGCHLD'
58+
* assignment.
59+
*/
60+
break;
5561
case CLONE3_ARGS_ALL_0:
5662
args.flags = 0;
5763
args.exit_signal = 0;

tools/testing/selftests/core/close_range_test.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@ static inline int sys_close_range(unsigned int fd, unsigned int max_fd,
5050
return syscall(__NR_close_range, fd, max_fd, flags);
5151
}
5252

53-
#ifndef ARRAY_SIZE
54-
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
55-
#endif
56-
5753
TEST(core_close_range)
5854
{
5955
int i, ret;

tools/testing/selftests/ftrace/test.d/kprobe/profile.tc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22
# SPDX-License-Identifier: GPL-2.0
3-
# description: Kprobe dynamic event - adding and removing
3+
# description: Kprobe profile
44
# requires: kprobe_events
55

66
! grep -q 'myevent' kprobe_profile

tools/testing/selftests/ir/ir_loopback.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include "../kselftest.h"
2727

2828
#define TEST_SCANCODES 10
29-
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
3029
#define SYSFS_PATH_MAX 256
3130
#define DNAME_PATH_MAX 256
3231

tools/testing/selftests/kselftest.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@
4848
#include <stdarg.h>
4949
#include <stdio.h>
5050

51+
#ifndef ARRAY_SIZE
52+
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
53+
#endif
54+
5155
/* define kselftest exit codes */
5256
#define KSFT_PASS 0
5357
#define KSFT_FAIL 1

tools/testing/selftests/kselftest_harness.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,9 @@
671671
#define EXPECT_STRNE(expected, seen) \
672672
__EXPECT_STR(expected, seen, !=, 0)
673673

674+
#ifndef ARRAY_SIZE
674675
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
676+
#endif
675677

676678
/* Support an optional handler after and ASSERT_* or EXPECT_*. The approach is
677679
* not thread-safe, but it should be fine in most sane test scenarios.
@@ -969,7 +971,7 @@ void __run_test(struct __fixture_metadata *f,
969971
t->passed = 1;
970972
t->skip = 0;
971973
t->trigger = 0;
972-
t->step = 0;
974+
t->step = 1;
973975
t->no_print = 0;
974976
memset(t->results->reason, 0, sizeof(t->results->reason));
975977

0 commit comments

Comments
 (0)