summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/cgroup_helpers.c
diff options
context:
space:
mode:
authorYucong Sun <sunyucong@gmail.com>2021-10-06 21:56:09 +0300
committerAndrii Nakryiko <andrii@kernel.org>2021-10-09 00:45:18 +0300
commite87c3434f81ae566693cfdc22370dc938b2989dd (patch)
tree6acab3a4dce1f6a2422ca2c5cf95172965055fd1 /tools/testing/selftests/bpf/cgroup_helpers.c
parent6587ff58cea4a7f252b8bbc4031a1bf4ec3781d8 (diff)
downloadlinux-e87c3434f81ae566693cfdc22370dc938b2989dd.tar.xz
selftests/bpf: Add per worker cgroup suffix
This patch make each worker use a unique cgroup base directory, thus allowing tests that uses cgroups to run concurrently. Signed-off-by: Yucong Sun <sunyucong@gmail.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20211006185619.364369-5-fallentree@fb.com
Diffstat (limited to 'tools/testing/selftests/bpf/cgroup_helpers.c')
-rw-r--r--tools/testing/selftests/bpf/cgroup_helpers.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/testing/selftests/bpf/cgroup_helpers.c b/tools/testing/selftests/bpf/cgroup_helpers.c
index f3daa44a8266..8fcd44841bb2 100644
--- a/tools/testing/selftests/bpf/cgroup_helpers.c
+++ b/tools/testing/selftests/bpf/cgroup_helpers.c
@@ -11,6 +11,7 @@
#include <fcntl.h>
#include <unistd.h>
#include <ftw.h>
+#include <unistd.h>
#include "cgroup_helpers.h"
@@ -33,10 +34,9 @@
#define CGROUP_MOUNT_DFLT "/sys/fs/cgroup"
#define NETCLS_MOUNT_PATH CGROUP_MOUNT_DFLT "/net_cls"
#define CGROUP_WORK_DIR "/cgroup-test-work-dir"
-
#define format_cgroup_path(buf, path) \
- snprintf(buf, sizeof(buf), "%s%s%s", CGROUP_MOUNT_PATH, \
- CGROUP_WORK_DIR, path)
+ snprintf(buf, sizeof(buf), "%s%s%d%s", CGROUP_MOUNT_PATH, \
+ CGROUP_WORK_DIR, getpid(), path)
#define format_classid_path(buf) \
snprintf(buf, sizeof(buf), "%s%s", NETCLS_MOUNT_PATH, \