On 8/29/23 3:18 AM, Daan De Meyer wrote:
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@xxxxxxxxx>
---
tools/testing/selftests/bpf/cgroup_helpers.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tools/testing/selftests/bpf/cgroup_helpers.c b/tools/testing/selftests/bpf/cgroup_helpers.c
index 2caee8423ee0..860043d473fd 100644
--- a/tools/testing/selftests/bpf/cgroup_helpers.c
+++ b/tools/testing/selftests/bpf/cgroup_helpers.c
@@ -195,6 +195,11 @@ int setup_cgroup_environment(void)
format_cgroup_path(cgroup_workdir, "");
+ if (mkdir(CGROUP_MOUNT_PATH, 0777)) {
+ log_err("mkdir mount");
It fails when the path does exist. This failed a lot of cgroup tests:
create_netns:PASS:create netns 0 nsec
(cgroup_helpers.c:199: errno: File exists) mkdir mount
#11 bind_perm: Failed to setup cgroup environment
+ return 1;
+ }
+
if (unshare(CLONE_NEWNS)) {
log_err("unshare");
return 1;