Remove hardcoded cgroup v2 path

Replace hardcoded cgroup v2 root path with new libprocessgroup API calls.

Bug: 111307099
Test: adb shell dumpsys netd trafficcontroller

Change-Id: I833f42410508ddb6ed7f50cd2ff5e26b3dedc4a8
Merged-In: I833f42410508ddb6ed7f50cd2ff5e26b3dedc4a8
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
diff --git a/tests/bpf_base_test.cpp b/tests/bpf_base_test.cpp
index d950af9..20b6340 100644
--- a/tests/bpf_base_test.cpp
+++ b/tests/bpf_base_test.cpp
@@ -29,6 +29,7 @@
 #include <gtest/gtest.h>
 
 #include <cutils/qtaguid.h>
+#include <processgroup/processgroup.h>
 
 #include <android-base/stringprintf.h>
 #include <android-base/strings.h>
@@ -57,8 +58,10 @@
 TEST_F(BpfBasicTest, TestCgroupMounted) {
     SKIP_IF_BPF_NOT_SUPPORTED;
 
-    ASSERT_EQ(0, access(CGROUP_ROOT_PATH, R_OK));
-    ASSERT_EQ(0, access("/dev/cg2_bpf/cgroup.controllers", R_OK));
+    std::string cg2_path;
+    ASSERT_EQ(true, CgroupGetControllerPath(CGROUPV2_CONTROLLER_NAME, &cg2_path));
+    ASSERT_EQ(0, access(cg2_path.c_str(), R_OK));
+    ASSERT_EQ(0, access((cg2_path + "/cgroup.controllers").c_str(), R_OK));
 }
 
 TEST_F(BpfBasicTest, TestTrafficControllerSetUp) {