Deflake BpfBasicTest::TestCgroupMounted on x86_64 cuttlefish
Test: builds, atest
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ifb4e037ef3a38d2f9e2df91f76ba5a360e1032c6
diff --git a/tests/bpf_base_test.cpp b/tests/bpf_base_test.cpp
index fa0a589..9f806d6 100644
--- a/tests/bpf_base_test.cpp
+++ b/tests/bpf_base_test.cpp
@@ -68,7 +68,15 @@
SKIP_IF_BPF_NOT_SUPPORTED;
std::string cg2_path;
+#if 0
+ // This is the correct way to fetch cg2_path, but it occasionally hits ASAN
+ // problems due to memory allocated in non ASAN code being freed later by us
ASSERT_EQ(true, CgroupGetControllerPath(CGROUPV2_CONTROLLER_NAME, &cg2_path));
+#else
+ ASSERT_EQ(true, CgroupGetControllerPath(CGROUPV2_CONTROLLER_NAME, nullptr));
+ // Constant derived from //system/core/libprocessgroup/profiles/cgroups.json
+ cg2_path = "/dev/cg2_bpf";
+#endif
ASSERT_EQ(0, access(cg2_path.c_str(), R_OK));
ASSERT_EQ(0, access((cg2_path + "/cgroup.controllers").c_str(), R_OK));
}