diff options
19 files changed, 280 insertions, 32 deletions
| @@ -299,19 +299,7 @@ KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null) | |||
| 299 | KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION) | 299 | KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION) |
| 300 | export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION | 300 | export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION |
| 301 | 301 | ||
| 302 | # SUBARCH tells the usermode build what the underlying arch is. That is set | 302 | include scripts/subarch.include |
| 303 | # first, and if a usermode build is happening, the "ARCH=um" on the command | ||
| 304 | # line overrides the setting of ARCH below. If a native build is happening, | ||
| 305 | # then ARCH is assigned, getting whatever value it gets normally, and | ||
| 306 | # SUBARCH is subsequently ignored. | ||
| 307 | |||
| 308 | SUBARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \ | ||
| 309 | -e s/sun4u/sparc64/ \ | ||
| 310 | -e s/arm.*/arm/ -e s/sa110/arm/ \ | ||
| 311 | -e s/s390x/s390/ -e s/parisc64/parisc/ \ | ||
| 312 | -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ | ||
| 313 | -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \ | ||
| 314 | -e s/riscv.*/riscv/) | ||
| 315 | 303 | ||
| 316 | # Cross compiling and selecting different set of gcc/bin-utils | 304 | # Cross compiling and selecting different set of gcc/bin-utils |
| 317 | # --------------------------------------------------------------------------- | 305 | # --------------------------------------------------------------------------- |
diff --git a/scripts/subarch.include b/scripts/subarch.include new file mode 100644 index 000000000000..650682821126 --- /dev/null +++ b/scripts/subarch.include | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | # SUBARCH tells the usermode build what the underlying arch is. That is set | ||
| 2 | # first, and if a usermode build is happening, the "ARCH=um" on the command | ||
| 3 | # line overrides the setting of ARCH below. If a native build is happening, | ||
| 4 | # then ARCH is assigned, getting whatever value it gets normally, and | ||
| 5 | # SUBARCH is subsequently ignored. | ||
| 6 | |||
| 7 | SUBARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \ | ||
| 8 | -e s/sun4u/sparc64/ \ | ||
| 9 | -e s/arm.*/arm/ -e s/sa110/arm/ \ | ||
| 10 | -e s/s390x/s390/ -e s/parisc64/parisc/ \ | ||
| 11 | -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ | ||
| 12 | -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \ | ||
| 13 | -e s/riscv.*/riscv/) | ||
diff --git a/tools/testing/selftests/android/Makefile b/tools/testing/selftests/android/Makefile index 72c25a3cb658..d9a725478375 100644 --- a/tools/testing/selftests/android/Makefile +++ b/tools/testing/selftests/android/Makefile | |||
| @@ -6,7 +6,7 @@ TEST_PROGS := run.sh | |||
| 6 | 6 | ||
| 7 | include ../lib.mk | 7 | include ../lib.mk |
| 8 | 8 | ||
| 9 | all: | 9 | all: khdr |
| 10 | @for DIR in $(SUBDIRS); do \ | 10 | @for DIR in $(SUBDIRS); do \ |
| 11 | BUILD_TARGET=$(OUTPUT)/$$DIR; \ | 11 | BUILD_TARGET=$(OUTPUT)/$$DIR; \ |
| 12 | mkdir $$BUILD_TARGET -p; \ | 12 | mkdir $$BUILD_TARGET -p; \ |
diff --git a/tools/testing/selftests/android/ion/config b/tools/testing/selftests/android/config index b4ad748a9dd9..b4ad748a9dd9 100644 --- a/tools/testing/selftests/android/ion/config +++ b/tools/testing/selftests/android/config | |||
diff --git a/tools/testing/selftests/android/ion/Makefile b/tools/testing/selftests/android/ion/Makefile index e03695287f76..88cfe88e466f 100644 --- a/tools/testing/selftests/android/ion/Makefile +++ b/tools/testing/selftests/android/ion/Makefile | |||
| @@ -10,6 +10,8 @@ $(TEST_GEN_FILES): ipcsocket.c ionutils.c | |||
| 10 | 10 | ||
| 11 | TEST_PROGS := ion_test.sh | 11 | TEST_PROGS := ion_test.sh |
| 12 | 12 | ||
| 13 | KSFT_KHDR_INSTALL := 1 | ||
| 14 | top_srcdir = ../../../../.. | ||
| 13 | include ../../lib.mk | 15 | include ../../lib.mk |
| 14 | 16 | ||
| 15 | $(OUTPUT)/ionapp_export: ionapp_export.c ipcsocket.c ionutils.c | 17 | $(OUTPUT)/ionapp_export: ionapp_export.c ipcsocket.c ionutils.c |
diff --git a/tools/testing/selftests/cgroup/.gitignore b/tools/testing/selftests/cgroup/.gitignore index 95eb3a53c381..adacda50a4b2 100644 --- a/tools/testing/selftests/cgroup/.gitignore +++ b/tools/testing/selftests/cgroup/.gitignore | |||
| @@ -1 +1,2 @@ | |||
| 1 | test_memcontrol | 1 | test_memcontrol |
| 2 | test_core | ||
diff --git a/tools/testing/selftests/cgroup/cgroup_util.c b/tools/testing/selftests/cgroup/cgroup_util.c index 1c5d2b2a583b..14c9fe284806 100644 --- a/tools/testing/selftests/cgroup/cgroup_util.c +++ b/tools/testing/selftests/cgroup/cgroup_util.c | |||
| @@ -89,17 +89,28 @@ int cg_read(const char *cgroup, const char *control, char *buf, size_t len) | |||
| 89 | int cg_read_strcmp(const char *cgroup, const char *control, | 89 | int cg_read_strcmp(const char *cgroup, const char *control, |
| 90 | const char *expected) | 90 | const char *expected) |
| 91 | { | 91 | { |
| 92 | size_t size = strlen(expected) + 1; | 92 | size_t size; |
| 93 | char *buf; | 93 | char *buf; |
| 94 | int ret; | ||
| 95 | |||
| 96 | /* Handle the case of comparing against empty string */ | ||
| 97 | if (!expected) | ||
| 98 | size = 32; | ||
| 99 | else | ||
| 100 | size = strlen(expected) + 1; | ||
| 94 | 101 | ||
| 95 | buf = malloc(size); | 102 | buf = malloc(size); |
| 96 | if (!buf) | 103 | if (!buf) |
| 97 | return -1; | 104 | return -1; |
| 98 | 105 | ||
| 99 | if (cg_read(cgroup, control, buf, size)) | 106 | if (cg_read(cgroup, control, buf, size)) { |
| 107 | free(buf); | ||
| 100 | return -1; | 108 | return -1; |
| 109 | } | ||
| 101 | 110 | ||
| 102 | return strcmp(expected, buf); | 111 | ret = strcmp(expected, buf); |
| 112 | free(buf); | ||
| 113 | return ret; | ||
| 103 | } | 114 | } |
| 104 | 115 | ||
| 105 | int cg_read_strstr(const char *cgroup, const char *control, const char *needle) | 116 | int cg_read_strstr(const char *cgroup, const char *control, const char *needle) |
| @@ -337,3 +348,24 @@ int is_swap_enabled(void) | |||
| 337 | 348 | ||
| 338 | return cnt > 1; | 349 | return cnt > 1; |
| 339 | } | 350 | } |
| 351 | |||
| 352 | int set_oom_adj_score(int pid, int score) | ||
| 353 | { | ||
| 354 | char path[PATH_MAX]; | ||
| 355 | int fd, len; | ||
| 356 | |||
| 357 | sprintf(path, "/proc/%d/oom_score_adj", pid); | ||
| 358 | |||
| 359 | fd = open(path, O_WRONLY | O_APPEND); | ||
| 360 | if (fd < 0) | ||
| 361 | return fd; | ||
| 362 | |||
| 363 | len = dprintf(fd, "%d", score); | ||
| 364 | if (len < 0) { | ||
| 365 | close(fd); | ||
| 366 | return len; | ||
| 367 | } | ||
| 368 | |||
| 369 | close(fd); | ||
| 370 | return 0; | ||
| 371 | } | ||
diff --git a/tools/testing/selftests/cgroup/cgroup_util.h b/tools/testing/selftests/cgroup/cgroup_util.h index 1ff6f9f1abdc..9ac8b7958f83 100644 --- a/tools/testing/selftests/cgroup/cgroup_util.h +++ b/tools/testing/selftests/cgroup/cgroup_util.h | |||
| @@ -40,3 +40,4 @@ extern int get_temp_fd(void); | |||
| 40 | extern int alloc_pagecache(int fd, size_t size); | 40 | extern int alloc_pagecache(int fd, size_t size); |
| 41 | extern int alloc_anon(const char *cgroup, void *arg); | 41 | extern int alloc_anon(const char *cgroup, void *arg); |
| 42 | extern int is_swap_enabled(void); | 42 | extern int is_swap_enabled(void); |
| 43 | extern int set_oom_adj_score(int pid, int score); | ||
diff --git a/tools/testing/selftests/cgroup/test_memcontrol.c b/tools/testing/selftests/cgroup/test_memcontrol.c index cf0bddc9d271..28d321ba311b 100644 --- a/tools/testing/selftests/cgroup/test_memcontrol.c +++ b/tools/testing/selftests/cgroup/test_memcontrol.c | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | #define _GNU_SOURCE | 2 | #define _GNU_SOURCE |
| 3 | 3 | ||
| 4 | #include <linux/limits.h> | 4 | #include <linux/limits.h> |
| 5 | #include <linux/oom.h> | ||
| 5 | #include <fcntl.h> | 6 | #include <fcntl.h> |
| 6 | #include <stdio.h> | 7 | #include <stdio.h> |
| 7 | #include <stdlib.h> | 8 | #include <stdlib.h> |
| @@ -202,6 +203,36 @@ static int alloc_pagecache_50M_noexit(const char *cgroup, void *arg) | |||
| 202 | return 0; | 203 | return 0; |
| 203 | } | 204 | } |
| 204 | 205 | ||
| 206 | static int alloc_anon_noexit(const char *cgroup, void *arg) | ||
| 207 | { | ||
| 208 | int ppid = getppid(); | ||
| 209 | |||
| 210 | if (alloc_anon(cgroup, arg)) | ||
| 211 | return -1; | ||
| 212 | |||
| 213 | while (getppid() == ppid) | ||
| 214 | sleep(1); | ||
| 215 | |||
| 216 | return 0; | ||
| 217 | } | ||
| 218 | |||
| 219 | /* | ||
| 220 | * Wait until processes are killed asynchronously by the OOM killer | ||
| 221 | * If we exceed a timeout, fail. | ||
| 222 | */ | ||
| 223 | static int cg_test_proc_killed(const char *cgroup) | ||
| 224 | { | ||
| 225 | int limit; | ||
| 226 | |||
| 227 | for (limit = 10; limit > 0; limit--) { | ||
| 228 | if (cg_read_strcmp(cgroup, "cgroup.procs", "") == 0) | ||
| 229 | return 0; | ||
| 230 | |||
| 231 | usleep(100000); | ||
| 232 | } | ||
| 233 | return -1; | ||
| 234 | } | ||
| 235 | |||
| 205 | /* | 236 | /* |
| 206 | * First, this test creates the following hierarchy: | 237 | * First, this test creates the following hierarchy: |
| 207 | * A memory.min = 50M, memory.max = 200M | 238 | * A memory.min = 50M, memory.max = 200M |
| @@ -964,6 +995,177 @@ cleanup: | |||
| 964 | return ret; | 995 | return ret; |
| 965 | } | 996 | } |
| 966 | 997 | ||
| 998 | /* | ||
| 999 | * This test disables swapping and tries to allocate anonymous memory | ||
| 1000 | * up to OOM with memory.group.oom set. Then it checks that all | ||
| 1001 | * processes in the leaf (but not the parent) were killed. | ||
| 1002 | */ | ||
| 1003 | static int test_memcg_oom_group_leaf_events(const char *root) | ||
| 1004 | { | ||
| 1005 | int ret = KSFT_FAIL; | ||
| 1006 | char *parent, *child; | ||
| 1007 | |||
| 1008 | parent = cg_name(root, "memcg_test_0"); | ||
| 1009 | child = cg_name(root, "memcg_test_0/memcg_test_1"); | ||
| 1010 | |||
| 1011 | if (!parent || !child) | ||
| 1012 | goto cleanup; | ||
| 1013 | |||
| 1014 | if (cg_create(parent)) | ||
| 1015 | goto cleanup; | ||
| 1016 | |||
| 1017 | if (cg_create(child)) | ||
| 1018 | goto cleanup; | ||
| 1019 | |||
| 1020 | if (cg_write(parent, "cgroup.subtree_control", "+memory")) | ||
| 1021 | goto cleanup; | ||
| 1022 | |||
| 1023 | if (cg_write(child, "memory.max", "50M")) | ||
| 1024 | goto cleanup; | ||
| 1025 | |||
| 1026 | if (cg_write(child, "memory.swap.max", "0")) | ||
| 1027 | goto cleanup; | ||
| 1028 | |||
| 1029 | if (cg_write(child, "memory.oom.group", "1")) | ||
| 1030 | goto cleanup; | ||
| 1031 | |||
| 1032 | cg_run_nowait(parent, alloc_anon_noexit, (void *) MB(60)); | ||
| 1033 | cg_run_nowait(child, alloc_anon_noexit, (void *) MB(1)); | ||
| 1034 | cg_run_nowait(child, alloc_anon_noexit, (void *) MB(1)); | ||
| 1035 | if (!cg_run(child, alloc_anon, (void *)MB(100))) | ||
| 1036 | goto cleanup; | ||
| 1037 | |||
| 1038 | if (cg_test_proc_killed(child)) | ||
| 1039 | goto cleanup; | ||
| 1040 | |||
| 1041 | if (cg_read_key_long(child, "memory.events", "oom_kill ") <= 0) | ||
| 1042 | goto cleanup; | ||
| 1043 | |||
| 1044 | if (cg_read_key_long(parent, "memory.events", "oom_kill ") != 0) | ||
| 1045 | goto cleanup; | ||
| 1046 | |||
| 1047 | ret = KSFT_PASS; | ||
| 1048 | |||
| 1049 | cleanup: | ||
| 1050 | if (child) | ||
| 1051 | cg_destroy(child); | ||
| 1052 | if (parent) | ||
| 1053 | cg_destroy(parent); | ||
| 1054 | free(child); | ||
| 1055 | free(parent); | ||
| 1056 | |||
| 1057 | return ret; | ||
| 1058 | } | ||
| 1059 | |||
| 1060 | /* | ||
| 1061 | * This test disables swapping and tries to allocate anonymous memory | ||
| 1062 | * up to OOM with memory.group.oom set. Then it checks that all | ||
| 1063 | * processes in the parent and leaf were killed. | ||
| 1064 | */ | ||
| 1065 | static int test_memcg_oom_group_parent_events(const char *root) | ||
| 1066 | { | ||
| 1067 | int ret = KSFT_FAIL; | ||
| 1068 | char *parent, *child; | ||
| 1069 | |||
| 1070 | parent = cg_name(root, "memcg_test_0"); | ||
| 1071 | child = cg_name(root, "memcg_test_0/memcg_test_1"); | ||
| 1072 | |||
| 1073 | if (!parent || !child) | ||
| 1074 | goto cleanup; | ||
| 1075 | |||
| 1076 | if (cg_create(parent)) | ||
| 1077 | goto cleanup; | ||
| 1078 | |||
| 1079 | if (cg_create(child)) | ||
| 1080 | goto cleanup; | ||
| 1081 | |||
| 1082 | if (cg_write(parent, "memory.max", "80M")) | ||
| 1083 | goto cleanup; | ||
| 1084 | |||
| 1085 | if (cg_write(parent, "memory.swap.max", "0")) | ||
| 1086 | goto cleanup; | ||
| 1087 | |||
| 1088 | if (cg_write(parent, "memory.oom.group", "1")) | ||
| 1089 | goto cleanup; | ||
| 1090 | |||
| 1091 | cg_run_nowait(parent, alloc_anon_noexit, (void *) MB(60)); | ||
| 1092 | cg_run_nowait(child, alloc_anon_noexit, (void *) MB(1)); | ||
| 1093 | cg_run_nowait(child, alloc_anon_noexit, (void *) MB(1)); | ||
| 1094 | |||
| 1095 | if (!cg_run(child, alloc_anon, (void *)MB(100))) | ||
| 1096 | goto cleanup; | ||
| 1097 | |||
| 1098 | if (cg_test_proc_killed(child)) | ||
| 1099 | goto cleanup; | ||
| 1100 | if (cg_test_proc_killed(parent)) | ||
| 1101 | goto cleanup; | ||
| 1102 | |||
| 1103 | ret = KSFT_PASS; | ||
| 1104 | |||
| 1105 | cleanup: | ||
| 1106 | if (child) | ||
| 1107 | cg_destroy(child); | ||
| 1108 | if (parent) | ||
| 1109 | cg_destroy(parent); | ||
| 1110 | free(child); | ||
| 1111 | free(parent); | ||
| 1112 | |||
| 1113 | return ret; | ||
| 1114 | } | ||
| 1115 | |||
| 1116 | /* | ||
| 1117 | * This test disables swapping and tries to allocate anonymous memory | ||
| 1118 | * up to OOM with memory.group.oom set. Then it checks that all | ||
| 1119 | * processes were killed except those set with OOM_SCORE_ADJ_MIN | ||
| 1120 | */ | ||
| 1121 | static int test_memcg_oom_group_score_events(const char *root) | ||
| 1122 | { | ||
| 1123 | int ret = KSFT_FAIL; | ||
| 1124 | char *memcg; | ||
| 1125 | int safe_pid; | ||
| 1126 | |||
| 1127 | memcg = cg_name(root, "memcg_test_0"); | ||
| 1128 | |||
| 1129 | if (!memcg) | ||
| 1130 | goto cleanup; | ||
| 1131 | |||
| 1132 | if (cg_create(memcg)) | ||
| 1133 | goto cleanup; | ||
| 1134 | |||
| 1135 | if (cg_write(memcg, "memory.max", "50M")) | ||
| 1136 | goto cleanup; | ||
| 1137 | |||
| 1138 | if (cg_write(memcg, "memory.swap.max", "0")) | ||
| 1139 | goto cleanup; | ||
| 1140 | |||
| 1141 | if (cg_write(memcg, "memory.oom.group", "1")) | ||
| 1142 | goto cleanup; | ||
| 1143 | |||
| 1144 | safe_pid = cg_run_nowait(memcg, alloc_anon_noexit, (void *) MB(1)); | ||
| 1145 | if (set_oom_adj_score(safe_pid, OOM_SCORE_ADJ_MIN)) | ||
| 1146 | goto cleanup; | ||
| 1147 | |||
| 1148 | cg_run_nowait(memcg, alloc_anon_noexit, (void *) MB(1)); | ||
| 1149 | if (!cg_run(memcg, alloc_anon, (void *)MB(100))) | ||
| 1150 | goto cleanup; | ||
| 1151 | |||
| 1152 | if (cg_read_key_long(memcg, "memory.events", "oom_kill ") != 3) | ||
| 1153 | goto cleanup; | ||
| 1154 | |||
| 1155 | if (kill(safe_pid, SIGKILL)) | ||
| 1156 | goto cleanup; | ||
| 1157 | |||
| 1158 | ret = KSFT_PASS; | ||
| 1159 | |||
| 1160 | cleanup: | ||
| 1161 | if (memcg) | ||
| 1162 | cg_destroy(memcg); | ||
| 1163 | free(memcg); | ||
| 1164 | |||
| 1165 | return ret; | ||
| 1166 | } | ||
| 1167 | |||
| 1168 | |||
| 967 | #define T(x) { x, #x } | 1169 | #define T(x) { x, #x } |
| 968 | struct memcg_test { | 1170 | struct memcg_test { |
| 969 | int (*fn)(const char *root); | 1171 | int (*fn)(const char *root); |
| @@ -978,6 +1180,9 @@ struct memcg_test { | |||
| 978 | T(test_memcg_oom_events), | 1180 | T(test_memcg_oom_events), |
| 979 | T(test_memcg_swap_max), | 1181 | T(test_memcg_swap_max), |
| 980 | T(test_memcg_sock), | 1182 | T(test_memcg_sock), |
| 1183 | T(test_memcg_oom_group_leaf_events), | ||
| 1184 | T(test_memcg_oom_group_parent_events), | ||
| 1185 | T(test_memcg_oom_group_score_events), | ||
| 981 | }; | 1186 | }; |
| 982 | #undef T | 1187 | #undef T |
| 983 | 1188 | ||
diff --git a/tools/testing/selftests/efivarfs/config b/tools/testing/selftests/efivarfs/config new file mode 100644 index 000000000000..4e151f1005b2 --- /dev/null +++ b/tools/testing/selftests/efivarfs/config | |||
| @@ -0,0 +1 @@ | |||
| CONFIG_EFIVAR_FS=y | |||
diff --git a/tools/testing/selftests/futex/functional/Makefile b/tools/testing/selftests/futex/functional/Makefile index ff8feca49746..ad1eeb14fda7 100644 --- a/tools/testing/selftests/futex/functional/Makefile +++ b/tools/testing/selftests/futex/functional/Makefile | |||
| @@ -18,6 +18,7 @@ TEST_GEN_FILES := \ | |||
| 18 | 18 | ||
| 19 | TEST_PROGS := run.sh | 19 | TEST_PROGS := run.sh |
| 20 | 20 | ||
| 21 | top_srcdir = ../../../../.. | ||
| 21 | include ../../lib.mk | 22 | include ../../lib.mk |
| 22 | 23 | ||
| 23 | $(TEST_GEN_FILES): $(HEADERS) | 24 | $(TEST_GEN_FILES): $(HEADERS) |
diff --git a/tools/testing/selftests/gpio/Makefile b/tools/testing/selftests/gpio/Makefile index 1bbb47565c55..4665cdbf1a8d 100644 --- a/tools/testing/selftests/gpio/Makefile +++ b/tools/testing/selftests/gpio/Makefile | |||
| @@ -21,11 +21,8 @@ endef | |||
| 21 | CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/ | 21 | CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/ |
| 22 | LDLIBS += -lmount -I/usr/include/libmount | 22 | LDLIBS += -lmount -I/usr/include/libmount |
| 23 | 23 | ||
| 24 | $(BINARIES): ../../../gpio/gpio-utils.o ../../../../usr/include/linux/gpio.h | 24 | $(BINARIES):| khdr |
| 25 | $(BINARIES): ../../../gpio/gpio-utils.o | ||
| 25 | 26 | ||
| 26 | ../../../gpio/gpio-utils.o: | 27 | ../../../gpio/gpio-utils.o: |
| 27 | make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C ../../../gpio | 28 | make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C ../../../gpio |
| 28 | |||
| 29 | ../../../../usr/include/linux/gpio.h: | ||
| 30 | make -C ../../../.. headers_install INSTALL_HDR_PATH=$(shell pwd)/../../../../usr/ | ||
| 31 | |||
diff --git a/tools/testing/selftests/kselftest.h b/tools/testing/selftests/kselftest.h index 15e6b75fc3a5..a3edb2c8e43d 100644 --- a/tools/testing/selftests/kselftest.h +++ b/tools/testing/selftests/kselftest.h | |||
| @@ -19,7 +19,6 @@ | |||
| 19 | #define KSFT_FAIL 1 | 19 | #define KSFT_FAIL 1 |
| 20 | #define KSFT_XFAIL 2 | 20 | #define KSFT_XFAIL 2 |
| 21 | #define KSFT_XPASS 3 | 21 | #define KSFT_XPASS 3 |
| 22 | /* Treat skip as pass */ | ||
| 23 | #define KSFT_SKIP 4 | 22 | #define KSFT_SKIP 4 |
| 24 | 23 | ||
| 25 | /* counters */ | 24 | /* counters */ |
diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile index 03b0f551bedf..87d1a8488af8 100644 --- a/tools/testing/selftests/kvm/Makefile +++ b/tools/testing/selftests/kvm/Makefile | |||
| @@ -37,9 +37,6 @@ $(LIBKVM_OBJ): $(OUTPUT)/%.o: %.c | |||
| 37 | $(OUTPUT)/libkvm.a: $(LIBKVM_OBJ) | 37 | $(OUTPUT)/libkvm.a: $(LIBKVM_OBJ) |
| 38 | $(AR) crs $@ $^ | 38 | $(AR) crs $@ $^ |
| 39 | 39 | ||
| 40 | $(LINUX_HDR_PATH): | 40 | all: $(STATIC_LIBS) |
| 41 | make -C $(top_srcdir) headers_install | ||
| 42 | |||
| 43 | all: $(STATIC_LIBS) $(LINUX_HDR_PATH) | ||
| 44 | $(TEST_GEN_PROGS): $(STATIC_LIBS) | 41 | $(TEST_GEN_PROGS): $(STATIC_LIBS) |
| 45 | $(TEST_GEN_PROGS) $(LIBKVM_OBJ): | $(LINUX_HDR_PATH) | 42 | $(STATIC_LIBS):| khdr |
diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk index 17ab36605a8e..0a8e75886224 100644 --- a/tools/testing/selftests/lib.mk +++ b/tools/testing/selftests/lib.mk | |||
| @@ -16,8 +16,20 @@ TEST_GEN_PROGS := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS)) | |||
| 16 | TEST_GEN_PROGS_EXTENDED := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS_EXTENDED)) | 16 | TEST_GEN_PROGS_EXTENDED := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS_EXTENDED)) |
| 17 | TEST_GEN_FILES := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_FILES)) | 17 | TEST_GEN_FILES := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_FILES)) |
| 18 | 18 | ||
| 19 | top_srcdir ?= ../../../.. | ||
| 20 | include $(top_srcdir)/scripts/subarch.include | ||
| 21 | ARCH ?= $(SUBARCH) | ||
| 22 | |||
| 19 | all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) | 23 | all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) |
| 20 | 24 | ||
| 25 | .PHONY: khdr | ||
| 26 | khdr: | ||
| 27 | make ARCH=$(ARCH) -C $(top_srcdir) headers_install | ||
| 28 | |||
| 29 | ifdef KSFT_KHDR_INSTALL | ||
| 30 | $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES):| khdr | ||
| 31 | endif | ||
| 32 | |||
| 21 | .ONESHELL: | 33 | .ONESHELL: |
| 22 | define RUN_TEST_PRINT_RESULT | 34 | define RUN_TEST_PRINT_RESULT |
| 23 | TEST_HDR_MSG="selftests: "`basename $$PWD`:" $$BASENAME_TEST"; \ | 35 | TEST_HDR_MSG="selftests: "`basename $$PWD`:" $$BASENAME_TEST"; \ |
diff --git a/tools/testing/selftests/memory-hotplug/config b/tools/testing/selftests/memory-hotplug/config index 2fde30191a47..a7e8cd5bb265 100644 --- a/tools/testing/selftests/memory-hotplug/config +++ b/tools/testing/selftests/memory-hotplug/config | |||
| @@ -2,3 +2,4 @@ CONFIG_MEMORY_HOTPLUG=y | |||
| 2 | CONFIG_MEMORY_HOTPLUG_SPARSE=y | 2 | CONFIG_MEMORY_HOTPLUG_SPARSE=y |
| 3 | CONFIG_NOTIFIER_ERROR_INJECTION=y | 3 | CONFIG_NOTIFIER_ERROR_INJECTION=y |
| 4 | CONFIG_MEMORY_NOTIFIER_ERROR_INJECT=m | 4 | CONFIG_MEMORY_NOTIFIER_ERROR_INJECT=m |
| 5 | CONFIG_MEMORY_HOTREMOVE=y | ||
diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile index 9cca68e440a0..919aa2ac00af 100644 --- a/tools/testing/selftests/net/Makefile +++ b/tools/testing/selftests/net/Makefile | |||
| @@ -15,6 +15,7 @@ TEST_GEN_FILES += udpgso udpgso_bench_tx udpgso_bench_rx | |||
| 15 | TEST_GEN_PROGS = reuseport_bpf reuseport_bpf_cpu reuseport_bpf_numa | 15 | TEST_GEN_PROGS = reuseport_bpf reuseport_bpf_cpu reuseport_bpf_numa |
| 16 | TEST_GEN_PROGS += reuseport_dualstack reuseaddr_conflict tls | 16 | TEST_GEN_PROGS += reuseport_dualstack reuseaddr_conflict tls |
| 17 | 17 | ||
| 18 | KSFT_KHDR_INSTALL := 1 | ||
| 18 | include ../lib.mk | 19 | include ../lib.mk |
| 19 | 20 | ||
| 20 | $(OUTPUT)/reuseport_bpf_numa: LDFLAGS += -lnuma | 21 | $(OUTPUT)/reuseport_bpf_numa: LDFLAGS += -lnuma |
diff --git a/tools/testing/selftests/networking/timestamping/Makefile b/tools/testing/selftests/networking/timestamping/Makefile index a728040edbe1..14cfcf006936 100644 --- a/tools/testing/selftests/networking/timestamping/Makefile +++ b/tools/testing/selftests/networking/timestamping/Makefile | |||
| @@ -5,6 +5,7 @@ TEST_PROGS := hwtstamp_config rxtimestamp timestamping txtimestamp | |||
| 5 | 5 | ||
| 6 | all: $(TEST_PROGS) | 6 | all: $(TEST_PROGS) |
| 7 | 7 | ||
| 8 | top_srcdir = ../../../../.. | ||
| 8 | include ../../lib.mk | 9 | include ../../lib.mk |
| 9 | 10 | ||
| 10 | clean: | 11 | clean: |
diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile index 9881876d2aa0..e94b7b14bcb2 100644 --- a/tools/testing/selftests/vm/Makefile +++ b/tools/testing/selftests/vm/Makefile | |||
| @@ -26,10 +26,6 @@ TEST_PROGS := run_vmtests | |||
| 26 | 26 | ||
| 27 | include ../lib.mk | 27 | include ../lib.mk |
| 28 | 28 | ||
| 29 | $(OUTPUT)/userfaultfd: ../../../../usr/include/linux/kernel.h | ||
| 30 | $(OUTPUT)/userfaultfd: LDLIBS += -lpthread | 29 | $(OUTPUT)/userfaultfd: LDLIBS += -lpthread |
| 31 | 30 | ||
| 32 | $(OUTPUT)/mlock-random-test: LDLIBS += -lcap | 31 | $(OUTPUT)/mlock-random-test: LDLIBS += -lcap |
| 33 | |||
| 34 | ../../../../usr/include/linux/kernel.h: | ||
| 35 | make -C ../../../.. headers_install | ||
