summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'llkd/tests/llkd_test.cpp')
-rw-r--r--llkd/tests/llkd_test.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/llkd/tests/llkd_test.cpp b/llkd/tests/llkd_test.cpp
index 2de18205c..3a15ff1e3 100644
--- a/llkd/tests/llkd_test.cpp
+++ b/llkd/tests/llkd_test.cpp
@@ -154,6 +154,27 @@ inline void waitForPid(pid_t child_pid) {
154 ASSERT_EQ(WTERMSIG(wstatus), SIGKILL); 154 ASSERT_EQ(WTERMSIG(wstatus), SIGKILL);
155} 155}
156 156
157bool checkKill(const char* reason) {
158 if (android::base::GetBoolProperty(LLK_KILLTEST_PROPERTY, LLK_KILLTEST_DEFAULT)) {
159 return false;
160 }
161 auto bootreason = android::base::GetProperty("sys.boot.reason", "nothing");
162 if (bootreason == reason) {
163 GTEST_LOG_INFO << "Expected test result confirmed " << reason << "\n";
164 return true;
165 }
166 GTEST_LOG_WARNING << "Expected test result is " << reason << "\n";
167
168 // apct adjustment if needed (set LLK_KILLTEST_PROPERTY to "off" to allow test)
169 //
170 // if (android::base::GetProperty(LLK_KILLTEST_PROPERTY, "") == "false") {
171 // GTEST_LOG_WARNING << "Bypassing test\n";
172 // return true;
173 // }
174
175 return false;
176}
177
157} // namespace 178} // namespace
158 179
159// The tests that use this helper are to simulate processes stuck in 'D' 180// The tests that use this helper are to simulate processes stuck in 'D'
@@ -221,6 +242,10 @@ TEST(llkd, driver_ABA_glacial) {
221// is that llkd will perform kill mitigation and not progress to kernel_panic. 242// is that llkd will perform kill mitigation and not progress to kernel_panic.
222 243
223TEST(llkd, zombie) { 244TEST(llkd, zombie) {
245 if (checkKill("kernel_panic,sysrq,livelock,zombie")) {
246 return;
247 }
248
224 const auto period = llkdSleepPeriod('Z'); 249 const auto period = llkdSleepPeriod('Z');
225 250
226 /* Create a Persistent Zombie Process */ 251 /* Create a Persistent Zombie Process */
@@ -241,6 +266,10 @@ TEST(llkd, zombie) {
241} 266}
242 267
243TEST(llkd, driver) { 268TEST(llkd, driver) {
269 if (checkKill("kernel_panic,sysrq,livelock,driver")) {
270 return;
271 }
272
244 const auto period = llkdSleepPeriod('D'); 273 const auto period = llkdSleepPeriod('D');
245 274
246 /* Create a Persistent Device Process */ 275 /* Create a Persistent Device Process */