app: aboot: fastboot continue failing for secure device

fastboot continue is failing on secure devices on 8937 because
test code path is getting executed. Modify test code so that it is
enabled only at the time of executing the tests.

Change-Id: Iaecc389889ef730f62e813f09166893a51275389
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index 5ef7764..beb8181 100644
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -1151,7 +1151,7 @@
 	 * We would never reach this point if device is in fastboot mode, even if we did
 	 * that means we are in test mode, so execute kernel authentication part for the
 	 * tests */
-	if((target_use_signed_kernel() && (!device.is_unlocked)) || boot_into_fastboot)
+	if((target_use_signed_kernel() && (!device.is_unlocked)) || is_test_mode_enabled())
 	{
 		offset = imagesize_actual;
 		if (check_aboot_addr_range_overlap((uint32_t)image_addr + offset, page_size))
@@ -1169,7 +1169,7 @@
 
 		verify_signed_bootimg((uint32_t)image_addr, imagesize_actual);
 		/* The purpose of our test is done here */
-		if (boot_into_fastboot && auth_kernel_img)
+		if(is_test_mode_enabled() && auth_kernel_img)
 			return 0;
 	} else {
 		second_actual  = ROUND_TO_PAGE(hdr->second_size,  page_mask);
diff --git a/app/aboot/fastboot_test.c b/app/aboot/fastboot_test.c
index 5cad0b5..7941f61 100644
--- a/app/aboot/fastboot_test.c
+++ b/app/aboot/fastboot_test.c
@@ -45,11 +45,17 @@
 extern int ufs_get_boot_lun();
 extern int ufs_set_boot_lun(uint32_t bootlunid);
 extern int fastboot_init();
+static bool enable_test_mode = false;
+
+bool is_test_mode_enabled(void)
+{
+	return enable_test_mode;
+}
 
 void cmd_oem_runtests()
 {
 	dprintf(INFO, "Running LK tests ... \n");
-
+	enable_test_mode = true;
 	// Test boot lun enable for UFS
 	if (!platform_boot_dev_isemmc())
 	{
@@ -118,4 +124,5 @@
 	printf_tests();
 
 	fastboot_okay("");
+	enable_test_mode = false;
 }
diff --git a/app/aboot/fastboot_test.h b/app/aboot/fastboot_test.h
index 005bfa7..d20c01b 100644
--- a/app/aboot/fastboot_test.h
+++ b/app/aboot/fastboot_test.h
@@ -32,5 +32,14 @@
 #include <sys/types.h>
 extern void ramdump_table_map();
 void cmd_oem_runtests();
+
+#if UNITTEST_FW_SUPPORT
+bool is_test_mode_enabled();
+#else
+bool is_test_mode_enabled()
+{
+	return false;
+}
+#endif
 extern int boot_linux_from_mmc();
 #endif