Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d1ac78ab authored by Alexander Potapenko's avatar Alexander Potapenko
Browse files

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: default avatarAlexander Potapenko <glider@google.com>
parent 62772abf
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -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);
+8 −2
Original line number Diff line number Diff line
@@ -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;
}