projects/linux·commit ca95bf62

Merge tag 'linux-kselftest-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest

ca95bf62 · Linus Torvalds <[email protected]> · 2018-06-06 13:11:51 -07:00

Pull Kselftest update from Shuah Khan:

 - Work to restructure timers test suite to move PIE out of rtctest from
   Alexandre Belloni.

 - Several minor spelling and bug fixes.

 - New cgroup tests from Roman Gushchin and Mike Rapoport.

 - Kselftest framework changes to handle and report skipped tests
   correctly.

   Prior to these changes, framework treated all non-zero return codes
   from tests as failures. When tests are skipped with non-zero return
   code, due to unmet dependencies and/or unsupported configuration,
   reporting them as failed lead to false negatives on the tests that
   couldn't be run.

 - Fixes to test Makefiles to remove unnecessary RUN_TESTS and
   EMIT_TESTS overrides and use common defines from lib.mk.

 - Fixes to several tests to return correct Kselftest skip code.

 - Changes to improve test output.

* tag 'linux-kselftest-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: (55 commits)
  selftests: lib: fix prime_numbers module search and skip logic
  selftests: intel_pstate: notification about privilege required to run intel_pstate testing script
  selftests: cgroup/memcontrol: add basic test for socket accounting
  selftest: intel_pstate: debug support message from aperf.c and return value
  kselftest/cgroup: fix variable dereferenced before check warning
  selftests/intel_pstate: Enhance table printing
  selftests/intel_pstate: Improve test, minor fixes
  selftests: cgroup/memcontrol: add basic test for swap controls
  selftests: cgroup: add memory controller self-tests
  selftests: memfd: split regular and hugetlbfs tests
  selftests: net: return Kselftest Skip code for skipped tests
  selftests: mqueue: return Kselftest Skip code for skipped tests
  selftests: memory-hotplug: return Kselftest Skip code for skipped tests
  selftests: memfd: return Kselftest Skip code for skipped tests
  selftests: membarrier: return Kselftest Skip code for skipped tests
  selftests: media_tests: return Kselftest Skip code for skipped tests
  selftests: locking: return Kselftest Skip code for skipped tests
  selftests: locking: add Makefile for locking test
  selftests: lib: return Kselftest Skip code for skipped tests
  selftests: lib: add prime_numbers.sh test to Makefile
  ...
Commit
ca95bf62fcf528a0d8069731d39303ba43fb9af4
Parents
0ad39cb3 · fa321569

Merge commit. Changes below are compared with the first parent: 0ad39cb3.

Changes

63 files changed · +2113 −615

FileStatusAddDelContent
MAINTAINERSmodified+1−1View file
tools/testing/selftests/Makefilemodified+4−1View file
tools/testing/selftests/android/Makefilemodified+0−8View file
tools/testing/selftests/android/ion/ion_test.shmodified+5−2View file
tools/testing/selftests/breakpoints/step_after_suspend_test.cmodified+5−1View file
tools/testing/selftests/cgroup/Makefileadded+10−0View file
tools/testing/selftests/cgroup/cgroup_util.cadded+331−0View file
tools/testing/selftests/cgroup/cgroup_util.hadded+41−0View file
tools/testing/selftests/cgroup/test_memcontrol.cadded+1015−0View file
tools/testing/selftests/cpu-hotplug/cpu-on-off-test.shmodified+8−6View file
tools/testing/selftests/cpufreq/main.shmodified+4−1View file
tools/testing/selftests/efivarfs/efivarfs.shmodified+5−2View file
tools/testing/selftests/exec/execveat.cmodified+4−2View file
tools/testing/selftests/filesystems/Makefilemodified+1−0View file
tools/testing/selftests/filesystems/devpts_pts.cmodified+9−6View file
tools/testing/selftests/firmware/fw_fallback.shmodified+2−2View file
tools/testing/selftests/firmware/fw_filesystem.shmodified+3−1View file
tools/testing/selftests/firmware/fw_lib.shmodified+5−2View file
tools/testing/selftests/futex/Makefilemodified+0−12View file
tools/testing/selftests/gpio/gpio-mockup.shmodified+8−4View file
tools/testing/selftests/intel_pstate/aperf.cmodified+4−2View file
tools/testing/selftests/intel_pstate/run.shmodified+31−16View file
tools/testing/selftests/ipc/msgque.cmodified+3−4View file
tools/testing/selftests/kmod/kmod.shmodified+8−5View file
tools/testing/selftests/kselftest.hmodified+1−1View file
tools/testing/selftests/kvm/.gitignoreadded+3−0View file
tools/testing/selftests/kvm/lib/assert.cmodified+7−2View file
tools/testing/selftests/kvm/vmx_tsc_adjust_test.cmodified+2−0View file
tools/testing/selftests/lib.mkmodified+41−14View file
tools/testing/selftests/lib/Makefilemodified+1−1View file
tools/testing/selftests/lib/bitmap.shmodified+6−2View file
tools/testing/selftests/lib/prime_numbers.shmodified+6−3View file
tools/testing/selftests/lib/printf.shmodified+6−2View file
tools/testing/selftests/locking/Makefileadded+10−0View file
tools/testing/selftests/locking/ww_mutex.shmodified+8−0View file
tools/testing/selftests/media_tests/Makefilemodified+2−1View file
tools/testing/selftests/media_tests/media_device_open.cmodified+4−4View file
tools/testing/selftests/media_tests/media_device_test.cmodified+5−5View file
tools/testing/selftests/membarrier/membarrier_test.cmodified+3−4View file
tools/testing/selftests/memfd/Makefilemodified+3−3View file
tools/testing/selftests/memfd/run_tests.sh → tools/testing/selftests/memfd/run_hugetlbfs_test.shrenamed+8−10View file
tools/testing/selftests/memory-hotplug/Makefilemodified+1−4View file
tools/testing/selftests/memory-hotplug/mem-on-off-test.shmodified+9−5View file
tools/testing/selftests/mount/Makefilemodified+2−10View file
tools/testing/selftests/mount/run_tests.shadded+12−0View file
tools/testing/selftests/mqueue/Makefilemodified+1−11View file
tools/testing/selftests/mqueue/mq_open_tests.cmodified+19−18View file
tools/testing/selftests/mqueue/mq_perf_tests.cmodified+4−4View file
tools/testing/selftests/net/fib_tests.shmodified+5−3View file
tools/testing/selftests/net/netdevice.shmodified+10−6View file
tools/testing/selftests/net/pmtu.shmodified+4−1View file
tools/testing/selftests/net/psock_tpacket.cmodified+3−1View file
tools/testing/selftests/net/rtnetlink.shmodified+17−14View file
tools/testing/selftests/rtc/.gitignoreadded+2−0View file
tools/testing/selftests/rtc/Makefileadded+9−0View file
tools/testing/selftests/rtc/rtctest.cadded+238−0View file
tools/testing/selftests/timers/rtctest_setdate.c → tools/testing/selftests/rtc/setdate.crenamed+0−0View file
tools/testing/selftests/timers/.gitignoremodified+1−2View file
tools/testing/selftests/timers/Makefilemodified+2−2View file
tools/testing/selftests/timers/rtcpie.cadded+134−0View file
tools/testing/selftests/timers/rtctest.cdeleted+0−403View before deletion
tools/testing/selftests/x86/Makefilemodified+7−1View file
tools/testing/selftests/x86/trivial_program.cadded+10−0View file

Only the first 600 diff lines are shown. Download the complete patch.

MAINTAINERS

View file
diff --git a/MAINTAINERS b/MAINTAINERS
index 66cd131..f446443 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11935,7 +11935,7 @@ F: include/linux/rtc.h
F: include/uapi/linux/rtc.h
F: include/linux/rtc/
F: include/linux/platform_data/rtc-*
-F: tools/testing/selftests/timers/rtctest.c
+F: tools/testing/selftests/rtc/
REALTEK AUDIO CODECS
M: Bard Liao <[email protected]>

tools/testing/selftests/Makefile

View file
diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index 32aafa9..305130d 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -3,6 +3,7 @@ TARGETS = android
TARGETS += bpf
TARGETS += breakpoints
TARGETS += capabilities
+TARGETS += cgroup
TARGETS += cpufreq
TARGETS += cpu-hotplug
TARGETS += efivarfs
@@ -28,6 +29,7 @@ TARGETS += powerpc
TARGETS += proc
TARGETS += pstore
TARGETS += ptrace
+TARGETS += rtc
TARGETS += seccomp
TARGETS += sigaltstack
TARGETS += size
@@ -134,7 +136,8 @@ ifdef INSTALL_PATH
echo "else" >> $(ALL_SCRIPT)
echo " OUTPUT=/dev/stdout" >> $(ALL_SCRIPT)
echo "fi" >> $(ALL_SCRIPT)
- echo "export KSFT_TAP_LEVEL=`echo 1`" >> $(ALL_SCRIPT)
+ echo "export KSFT_TAP_LEVEL=1" >> $(ALL_SCRIPT)
+ echo "export skip=4" >> $(ALL_SCRIPT)
for TARGET in $(TARGETS); do \
BUILD_TARGET=$$BUILD/$$TARGET; \

tools/testing/selftests/android/Makefile

View file
diff --git a/tools/testing/selftests/android/Makefile b/tools/testing/selftests/android/Makefile
index f6304d2..72c25a3 100644
--- a/tools/testing/selftests/android/Makefile
+++ b/tools/testing/selftests/android/Makefile
@@ -18,10 +18,6 @@ all:
fi \
done
-override define RUN_TESTS
- @cd $(OUTPUT); ./run.sh
-endef
-
override define INSTALL_RULE
mkdir -p $(INSTALL_PATH)
install -t $(INSTALL_PATH) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES)
@@ -33,10 +29,6 @@ override define INSTALL_RULE
done;
endef
-override define EMIT_TESTS
- echo "./run.sh"
-endef
-
override define CLEAN
@for DIR in $(SUBDIRS); do \
BUILD_TARGET=$(OUTPUT)/$$DIR; \

tools/testing/selftests/android/ion/ion_test.sh

View file
diff --git a/tools/testing/selftests/android/ion/ion_test.sh b/tools/testing/selftests/android/ion/ion_test.sh
index a1aff50..69e676c 100755
--- a/tools/testing/selftests/android/ion/ion_test.sh
+++ b/tools/testing/selftests/android/ion/ion_test.sh
@@ -4,6 +4,9 @@ heapsize=4096
TCID="ion_test.sh"
errcode=0
+# Kselftest framework requirement - SKIP code is 4.
+ksft_skip=4
+
run_test()
{
heaptype=$1
@@ -25,7 +28,7 @@ check_root()
uid=$(id -u)
if [ $uid -ne 0 ]; then
echo $TCID: must be run as root >&2
- exit 0
+ exit $ksft_skip
fi
}
@@ -35,7 +38,7 @@ check_device()
if [ ! -e $DEVICE ]; then
echo $TCID: No $DEVICE device found >&2
echo $TCID: May be CONFIG_ION is not set >&2
- exit 0
+ exit $ksft_skip
fi
}

tools/testing/selftests/breakpoints/step_after_suspend_test.c

View file
diff --git a/tools/testing/selftests/breakpoints/step_after_suspend_test.c b/tools/testing/selftests/breakpoints/step_after_suspend_test.c
index 3fece06..f82dcc1 100644
--- a/tools/testing/selftests/breakpoints/step_after_suspend_test.c
+++ b/tools/testing/selftests/breakpoints/step_after_suspend_test.c
@@ -143,10 +143,14 @@ void suspend(void)
int err;
struct itimerspec spec = {};
+ if (getuid() != 0)
+ ksft_exit_skip("Please run the test as root - Exiting.\n");
+
power_state_fd = open("/sys/power/state", O_RDWR);
if (power_state_fd < 0)
ksft_exit_fail_msg(
- "open(\"/sys/power/state\") failed (is this test running as root?)\n");
+ "open(\"/sys/power/state\") failed %s)\n",
+ strerror(errno));
timerfd = timerfd_create(CLOCK_BOOTTIME_ALARM, 0);
if (timerfd < 0)

tools/testing/selftests/cgroup/Makefile

View file
diff --git a/tools/testing/selftests/cgroup/Makefile b/tools/testing/selftests/cgroup/Makefile
new file mode 100644
index 0000000..f7a3139
--- /dev/null
+++ b/tools/testing/selftests/cgroup/Makefile
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: GPL-2.0
+CFLAGS += -Wall
+
+all:
+
+TEST_GEN_PROGS = test_memcontrol
+
+include ../lib.mk
+
+$(OUTPUT)/test_memcontrol: cgroup_util.c

tools/testing/selftests/cgroup/cgroup_util.c

View file
diff --git a/tools/testing/selftests/cgroup/cgroup_util.c b/tools/testing/selftests/cgroup/cgroup_util.c
new file mode 100644
index 0000000..b69bdeb
--- /dev/null
+++ b/tools/testing/selftests/cgroup/cgroup_util.c
@@ -0,0 +1,331 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#define _GNU_SOURCE
+
+#include <errno.h>
+#include <fcntl.h>
+#include <linux/limits.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
+
+#include "cgroup_util.h"
+
+static ssize_t read_text(const char *path, char *buf, size_t max_len)
+{
+ ssize_t len;
+ int fd;
+
+ fd = open(path, O_RDONLY);
+ if (fd < 0)
+ return fd;
+
+ len = read(fd, buf, max_len - 1);
+ if (len < 0)
+ goto out;
+
+ buf[len] = 0;
+out:
+ close(fd);
+ return len;
+}
+
+static ssize_t write_text(const char *path, char *buf, size_t len)
+{
+ int fd;
+
+ fd = open(path, O_WRONLY | O_APPEND);
+ if (fd < 0)
+ return fd;
+
+ len = write(fd, buf, len);
+ if (len < 0) {
+ close(fd);
+ return len;
+ }
+
+ close(fd);
+
+ return len;
+}
+
+char *cg_name(const char *root, const char *name)
+{
+ size_t len = strlen(root) + strlen(name) + 2;
+ char *ret = malloc(len);
+
+ snprintf(ret, len, "%s/%s", root, name);
+
+ return ret;
+}
+
+char *cg_name_indexed(const char *root, const char *name, int index)
+{
+ size_t len = strlen(root) + strlen(name) + 10;
+ char *ret = malloc(len);
+
+ snprintf(ret, len, "%s/%s_%d", root, name, index);
+
+ return ret;
+}
+
+int cg_read(const char *cgroup, const char *control, char *buf, size_t len)
+{
+ char path[PATH_MAX];
+
+ snprintf(path, sizeof(path), "%s/%s", cgroup, control);
+
+ if (read_text(path, buf, len) >= 0)
+ return 0;
+
+ return -1;
+}
+
+int cg_read_strcmp(const char *cgroup, const char *control,
+ const char *expected)
+{
+ size_t size = strlen(expected) + 1;
+ char *buf;
+
+ buf = malloc(size);
+ if (!buf)
+ return -1;
+
+ if (cg_read(cgroup, control, buf, size))
+ return -1;
+
+ return strcmp(expected, buf);
+}
+
+int cg_read_strstr(const char *cgroup, const char *control, const char *needle)
+{
+ char buf[PAGE_SIZE];
+
+ if (cg_read(cgroup, control, buf, sizeof(buf)))
+ return -1;
+
+ return strstr(buf, needle) ? 0 : -1;
+}
+
+long cg_read_long(const char *cgroup, const char *control)
+{
+ char buf[128];
+
+ if (cg_read(cgroup, control, buf, sizeof(buf)))
+ return -1;
+
+ return atol(buf);
+}
+
+long cg_read_key_long(const char *cgroup, const char *control, const char *key)
+{
+ char buf[PAGE_SIZE];
+ char *ptr;
+
+ if (cg_read(cgroup, control, buf, sizeof(buf)))
+ return -1;
+
+ ptr = strstr(buf, key);
+ if (!ptr)
+ return -1;
+
+ return atol(ptr + strlen(key));
+}
+
+int cg_write(const char *cgroup, const char *control, char *buf)
+{
+ char path[PATH_MAX];
+ size_t len = strlen(buf);
+
+ snprintf(path, sizeof(path), "%s/%s", cgroup, control);
+
+ if (write_text(path, buf, len) == len)
+ return 0;
+
+ return -1;
+}
+
+int cg_find_unified_root(char *root, size_t len)
+{
+ char buf[10 * PAGE_SIZE];
+ char *fs, *mount, *type;
+ const char delim[] = "\n\t ";
+
+ if (read_text("/proc/self/mounts", buf, sizeof(buf)) <= 0)
+ return -1;
+
+ /*
+ * Example:
+ * cgroup /sys/fs/cgroup cgroup2 rw,seclabel,noexec,relatime 0 0
+ */
+ for (fs = strtok(buf, delim); fs; fs = strtok(NULL, delim)) {
+ mount = strtok(NULL, delim);
+ type = strtok(NULL, delim);
+ strtok(NULL, delim);
+ strtok(NULL, delim);
+ strtok(NULL, delim);
+
+ if (strcmp(fs, "cgroup") == 0 &&
+ strcmp(type, "cgroup2") == 0) {
+ strncpy(root, mount, len);
+ return 0;
+ }
+ }
+
+ return -1;
+}
+
+int cg_create(const char *cgroup)
+{
+ return mkdir(cgroup, 0644);
+}
+
+static int cg_killall(const char *cgroup)
+{
+ char buf[PAGE_SIZE];
+ char *ptr = buf;
+
+ if (cg_read(cgroup, "cgroup.procs", buf, sizeof(buf)))
+ return -1;
+
+ while (ptr < buf + sizeof(buf)) {
+ int pid = strtol(ptr, &ptr, 10);
+
+ if (pid == 0)
+ break;
+ if (*ptr)
+ ptr++;
+ else
+ break;
+ if (kill(pid, SIGKILL))
+ return -1;
+ }
+
+ return 0;
+}
+
+int cg_destroy(const char *cgroup)
+{
+ int ret;
+
+retry:
+ ret = rmdir(cgroup);
+ if (ret && errno == EBUSY) {
+ ret = cg_killall(cgroup);
+ if (ret)
+ return ret;
+ usleep(100);
+ goto retry;
+ }
+
+ if (ret && errno == ENOENT)
+ ret = 0;
+
+ return ret;
+}
+
+int cg_run(const char *cgroup,
+ int (*fn)(const char *cgroup, void *arg),
+ void *arg)
+{
+ int pid, retcode;
+
+ pid = fork();
+ if (pid < 0) {
+ return pid;
+ } else if (pid == 0) {
+ char buf[64];
+
+ snprintf(buf, sizeof(buf), "%d", getpid());
+ if (cg_write(cgroup, "cgroup.procs", buf))
+ exit(EXIT_FAILURE);
+ exit(fn(cgroup, arg));
+ } else {
+ waitpid(pid, &retcode, 0);
+ if (WIFEXITED(retcode))
+ return WEXITSTATUS(retcode);
+ else
+ return -1;
+ }
+}
+
+int cg_run_nowait(const char *cgroup,
+ int (*fn)(const char *cgroup, void *arg),
+ void *arg)
+{
+ int pid;
+
+ pid = fork();
+ if (pid == 0) {
+ char buf[64];
+
+ snprintf(buf, sizeof(buf), "%d", getpid());
+ if (cg_write(cgroup, "cgroup.procs", buf))
+ exit(EXIT_FAILURE);
+ exit(fn(cgroup, arg));
+ }
+
+ return pid;
+}
+
+int get_temp_fd(void)
+{
+ return open(".", O_TMPFILE | O_RDWR | O_EXCL);
+}
+
+int alloc_pagecache(int fd, size_t size)
+{
+ char buf[PAGE_SIZE];
+ struct stat st;
+ int i;
+
+ if (fstat(fd, &st))
+ goto cleanup;
+
+ size += st.st_size;
+
+ if (ftruncate(fd, size))
+ goto cleanup;
+
+ for (i = 0; i < size; i += sizeof(buf))
+ read(fd, buf, sizeof(buf));
+
+ return 0;
+
+cleanup:
+ return -1;
+}
+
+int alloc_anon(const char *cgroup, void *arg)
+{
+ size_t size = (unsigned long)arg;
+ char *buf, *ptr;
+
+ buf = malloc(size);
+ for (ptr = buf; ptr < buf + size; ptr += PAGE_SIZE)
+ *ptr = 0;
+
+ free(buf);
+ return 0;
+}
+
+int is_swap_enabled(void)
+{
+ char buf[PAGE_SIZE];
+ const char delim[] = "\n";
+ int cnt = 0;
+ char *line;
+
+ if (read_text("/proc/swaps", buf, sizeof(buf)) <= 0)
+ return -1;
+
+ for (line = strtok(buf, delim); line; line = strtok(NULL, delim))
+ cnt++;
+
+ return cnt > 1;
+}

tools/testing/selftests/cgroup/cgroup_util.h

View file
diff --git a/tools/testing/selftests/cgroup/cgroup_util.h b/tools/testing/selftests/cgroup/cgroup_util.h
new file mode 100644
index 0000000..fe82a29
--- /dev/null
+++ b/tools/testing/selftests/cgroup/cgroup_util.h
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#include <stdlib.h>
+
+#define PAGE_SIZE 4096
+
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+
+#define MB(x) (x << 20)
+
+/*
+ * Checks if two given values differ by less than err% of their sum.
+ */
+static inline int values_close(long a, long b, int err)
+{
+ return abs(a - b) <= (a + b) / 100 * err;
+}
+
+extern int cg_find_unified_root(char *root, size_t len);
+extern char *cg_name(const char *root, const char *name);
+extern char *cg_name_indexed(const char *root, const char *name, int index);
+extern int cg_create(const char *cgroup);
+extern int cg_destroy(const char *cgroup);
+extern int cg_read(const char *cgroup, const char *control,
+ char *buf, size_t len);
+extern int cg_read_strcmp(const char *cgroup, const char *control,
+ const char *expected);
+extern int cg_read_strstr(const char *cgroup, const char *control,
+ const char *needle);
+extern long cg_read_long(const char *cgroup, const char *control);
+long cg_read_key_long(const char *cgroup, const char *control, const char *key);
+extern int cg_write(const char *cgroup, const char *control, char *buf);
+extern int cg_run(const char *cgroup,
+ int (*fn)(const char *cgroup, void *arg),
+ void *arg);
+extern int cg_run_nowait(const char *cgroup,
+ int (*fn)(const char *cgroup, void *arg),
+ void *arg);
+extern int get_temp_fd(void);
+extern int alloc_pagecache(int fd, size_t size);
+extern int alloc_anon(const char *cgroup, void *arg);
+extern int is_swap_enabled(void);

tools/testing/selftests/cgroup/test_memcontrol.c

View file
diff --git a/tools/testing/selftests/cgroup/test_memcontrol.c b/tools/testing/selftests/cgroup/test_memcontrol.c
new file mode 100644
index 0000000..cf0bddc
--- /dev/null
+++ b/tools/testing/selftests/cgroup/test_memcontrol.c
@@ -0,0 +1,1015 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#define _GNU_SOURCE
+
+#include <linux/limits.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <sys/socket.h>
+#include <sys/wait.h>
+#include <arpa/inet.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <errno.h>
+
+#include "../kselftest.h"
+#include "cgroup_util.h"
+
+/*
+ * This test creates two nested cgroups with and without enabling
+ * the memory controller.
+ */
+static int test_memcg_subtree_control(const char *root)
+{
+ char *parent, *child, *parent2, *child2;
+ int ret = KSFT_FAIL;
+ char buf[PAGE_SIZE];
+
+ /* Create two nested cgroups with the memory controller enabled */
+ parent = cg_name(root, "memcg_test_0");
+ child = cg_name(root, "memcg_test_0/memcg_test_1");
+ if (!parent || !child)
+ goto cleanup;
+
+ if (cg_create(parent))
+ goto cleanup;
+
+ if (cg_write(parent, "cgroup.subtree_control", "+memory"))
+ goto cleanup;
+
+ if (cg_create(child))
+ goto cleanup;
+
+ if (cg_read_strstr(child, "cgroup.controllers", "memory"))
+ goto cleanup;
+
+ /* Create two nested cgroups without enabling memory controller */
+ parent2 = cg_name(root, "memcg_test_1");
+ child2 = cg_name(root, "memcg_test_1/memcg_test_1");
+ if (!parent2 || !child2)
+ goto cleanup;
+
+ if (cg_create(parent2))
+ goto cleanup;
+
+ if (cg_create(child2))
+ goto cleanup;
+
+ if (cg_read(child2, "cgroup.controllers", buf, sizeof(buf)))
+ goto cleanup;
+
+ if (!cg_read_strstr(child2, "cgroup.controllers", "memory"))
+ goto cleanup;
+
+ ret = KSFT_PASS;
+
+cleanup:
+ cg_destroy(child);
+ cg_destroy(parent);
+ free(parent);

This diff is incomplete. Download the complete patch.

tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/cpufreq/main.sh

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/efivarfs/efivarfs.sh

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/exec/execveat.c

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/filesystems/Makefile

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/filesystems/devpts_pts.c

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/firmware/fw_fallback.sh

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/firmware/fw_filesystem.sh

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/firmware/fw_lib.sh

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/futex/Makefile

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/gpio/gpio-mockup.sh

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/intel_pstate/aperf.c

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/intel_pstate/run.sh

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/ipc/msgque.c

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/kmod/kmod.sh

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/kselftest.h

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/kvm/.gitignore

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/kvm/lib/assert.c

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/kvm/vmx_tsc_adjust_test.c

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/lib.mk

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/lib/Makefile

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/lib/bitmap.sh

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/lib/prime_numbers.sh

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/lib/printf.sh

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/locking/Makefile

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/locking/ww_mutex.sh

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/media_tests/Makefile

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/media_tests/media_device_open.c

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/media_tests/media_device_test.c

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/membarrier/membarrier_test.c

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/memfd/Makefile

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/memfd/run_hugetlbfs_test.sh

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/memory-hotplug/Makefile

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/memory-hotplug/mem-on-off-test.sh

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/mount/Makefile

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/mount/run_tests.sh

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/mqueue/Makefile

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/mqueue/mq_open_tests.c

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/mqueue/mq_perf_tests.c

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/net/fib_tests.sh

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/net/netdevice.sh

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/net/pmtu.sh

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/net/psock_tpacket.c

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/net/rtnetlink.sh

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/rtc/.gitignore

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/rtc/Makefile

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/rtc/rtctest.c

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/rtc/setdate.c

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/timers/.gitignore

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/timers/Makefile

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/timers/rtcpie.c

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/timers/rtctest.c

View before deletion

This diff is incomplete. Download the complete patch.

tools/testing/selftests/x86/Makefile

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/x86/trivial_program.c

View file

This diff is incomplete. Download the complete patch.