From 93ac3b81eb3208fb3ee5e18f261253bd1c7d4704 Mon Sep 17 00:00:00 2001 From: bohu Date: Fri, 22 Dec 2017 08:50:03 -0800 Subject: [PATCH] emulator: add check_emu_boot.mk, again "make check_emu_boot" will boot up emulator and check whether it boots up or timed out. On boot success, it will emit a file BOOT_SUCCESS.txt in dist_dir; On timed out, it will emit a file BOOT_FAIL.txt in dist_dir original cl breaks some build, and this fixes it by incorporating the following cl https://android-review.googlesource.com/c/platform/build/+/576282 Test: choosecombo 1 aosp_arm64_ab userdebug m -j checkbuild tests Test: make check_emu_boot Change-Id: I09cba4f8fde672f9ea685dee1c0c108f2c457e2a --- core/tasks/check_emu_boot.mk | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 core/tasks/check_emu_boot.mk diff --git a/core/tasks/check_emu_boot.mk b/core/tasks/check_emu_boot.mk new file mode 100644 index 0000000000..487067738e --- /dev/null +++ b/core/tasks/check_emu_boot.mk @@ -0,0 +1,23 @@ +check_emu_boot0 := $(DIST_DIR)/$(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)-emulator-boot-test-result.txt +$(check_emu_boot0) : PRIVATE_PREFIX := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) +$(check_emu_boot0) : PRIVATE_EMULATOR_BOOT_TEST_SH := device/generic/goldfish/tools/emulator_boot_test.sh +$(check_emu_boot0) : PRIVATE_BOOT_COMPLETE_STRING := "emulator: INFO: boot completed" +$(check_emu_boot0) : PRIVATE_BOOT_FAIL_STRING := "emulator: ERROR: fail to boot after" +$(check_emu_boot0) : PRIVATE_SUCCESS_FILE := $(DIST_DIR)/$(PRIVATE_PREFIX)-BOOT-SUCCESS.txt +$(check_emu_boot0) : PRIVATE_FAIL_FILE := $(DIST_DIR)/$(PRIVATE_PREFIX)-BOOT-FAIL.txt +$(check_emu_boot0) : $(INSTALLED_QEMU_SYSTEMIMAGE) $(INSTALLED_QEMU_VENDORIMAGE) \ + $(if $(BOARD_USERDATAIMAGE_PARTITION_SIZE),$(PRODUCT_OUT)/userdata.img) \ + $(PRODUCT_OUT)/ramdisk.img device/generic/goldfish/tools/emulator_boot_test.sh + @mkdir -p $(dir $(check_emu_boot0)) + $(hide) rm -f $(check_emu_boot0) + $(hide) rm -f $(PRIVATE_SUCCESS_FILE) + $(hide) rm -f $(PRIVATE_FAIL_FILE) + (export ANDROID_PRODUCT_OUT=$$(cd $(PRODUCT_OUT);pwd);\ + export ANDROID_BUILD_TOP=$$(pwd);\ + $(PRIVATE_EMULATOR_BOOT_TEST_SH) > $(check_emu_boot0)) + (if grep -q $(PRIVATE_BOOT_COMPLETE_STRING) $(check_emu_boot0);\ + then echo boot_succeeded > $(PRIVATE_SUCCESS_FILE); fi) + (if grep -q $(PRIVATE_BOOT_FAIL_STRING) $(check_emu_boot0);\ + then echo boot_failed > $(PRIVATE_FAIL_FILE); fi) +.PHONY: check_emu_boot +check_emu_boot: $(check_emu_boot0)