lmkd_test: remove memcg creation on non-AndroidGo devices
Memory cgroups are disabled on non-AndroidGo devices. Change the test
not to fail due to missing in-kernel memory cgroup support.
Bug: 172296409
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I35d724c23c22e97458976c1cad45fe9d993326f9
diff --git a/tests/lmkd_test.cpp b/tests/lmkd_test.cpp
index b1957bc..07d91bb 100644
--- a/tests/lmkd_test.cpp
+++ b/tests/lmkd_test.cpp
@@ -27,6 +27,7 @@
#include <android-base/properties.h>
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
+#include <cutils/properties.h>
#include <gtest/gtest.h>
#include <lmkd.h>
#include <liblmkd_utils.h>
@@ -274,8 +275,10 @@
<< data->oomadj;
data->allocated = 0;
data->finished = false;
- ASSERT_FALSE(create_memcg(uid, pid) != 0)
- << "Child [pid=" << pid << "] failed to create a cgroup";
+ if (property_get_bool("ro.config.low_ram", false)) {
+ ASSERT_FALSE(create_memcg(uid, pid) != 0)
+ << "Child [pid=" << pid << "] failed to create a cgroup";
+ }
signal_state(ssync, STATE_CHILD_READY);
wait_for_state(ssync, STATE_PARENT_READY);
add_pressure(data);