aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2023-10-11 20:51:10 +0200
committerMartin KaFai Lau <martin.lau@kernel.org>2023-10-11 17:27:55 -0700
commitaf2752ed450e71fc0bd596d0b4b9b805a64ae2c1 (patch)
tree4bf1a4389986554336461f4c19d057bd791d6ecf /tools/testing
parentdocumentation/bpf: Document cgroup unix socket address hooks (diff)
downloadlinux-af2752ed450e71fc0bd596d0b4b9b805a64ae2c1.tar.gz
linux-af2752ed450e71fc0bd596d0b4b9b805a64ae2c1.zip
selftests/bpf: Make sure mount directory exists
The mount directory for the selftests cgroup tree might not exist so let's make sure it does exist by creating it ourselves if it doesn't exist. Signed-off-by: Daan De Meyer <daan.j.demeyer@gmail.com> Link: https://lore.kernel.org/r/20231011185113.140426-9-daan.j.demeyer@gmail.com Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Diffstat (limited to 'tools/testing')
-rw-r--r--tools/testing/selftests/bpf/cgroup_helpers.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/cgroup_helpers.c b/tools/testing/selftests/bpf/cgroup_helpers.c
index 24ba56d42f2d..5b1da2a32ea7 100644
--- a/tools/testing/selftests/bpf/cgroup_helpers.c
+++ b/tools/testing/selftests/bpf/cgroup_helpers.c
@@ -199,6 +199,11 @@ int setup_cgroup_environment(void)
format_cgroup_path(cgroup_workdir, "");
+ if (mkdir(CGROUP_MOUNT_PATH, 0777) && errno != EEXIST) {
+ log_err("mkdir mount");
+ return 1;
+ }
+
if (unshare(CLONE_NEWNS)) {
log_err("unshare");
return 1;