diff --git a/lib/test_meminit.c b/lib/test_meminit.c index e4f706a404b3..61d55b74d835 100644 --- a/lib/test_meminit.c +++ b/lib/test_meminit.c @@ -397,11 +397,16 @@ static int __init test_meminit_init(void) num_tests += test_kmemcache(&failures); num_tests += test_rcu_persistent(&failures); - if (failures == 0) + if (failures == 0) { pr_info("all %d tests passed!\n", num_tests); - else + } else { pr_info("failures: %d out of %d\n", failures, num_tests); - + /* + * 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; } module_init(test_meminit_init); diff --git a/lib/test_stackinit.c b/lib/test_stackinit.c index 1e45a735961e..7c5f9fb49e58 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; }