ANDROID: make memory initialization tests panic on failure
This is a patch specific to android-common-4.14 where lib/test_meminit.c
and lib/test_stackinit.c are built into the kernel.
Call panic() to make the test failures more visible.
Bug: 144999193
Change-Id: Iaa9459f4bf63753c5ac1cf51c9691bf62b3924e9
Signed-off-by: Alexander Potapenko <glider@google.com>
diff --git a/lib/test_stackinit.c b/lib/test_stackinit.c
index 1e45a73..7c5f9fb 100644
--- a/lib/test_stackinit.c
+++ b/lib/test_stackinit.c
@@ -371,10 +371,16 @@ static int __init test_stackinit_init(void)
/* STRUCTLEAK will only cover this. */
failures += test_user();
- if (failures == 0)
+ if (failures == 0) {
pr_info("all tests passed!\n");
- else
+ } else {
pr_err("failures: %u\n", failures);
+ /*
+ * Android 4.14 only: if this test is built as part of the
+ * kernel, make the failure visible.
+ */
+ panic("Test failed!\n");
+ }
return failures ? -EINVAL : 0;
}