From 9d91e898317fe19051d486fb76271a89603b5de8 Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Fri, 30 Mar 2018 20:43:45 -0700 Subject: tests: Pick up testdata with LOCAL_TEST_DATA. Also push the testdata in AndroidTest.xml for `atest`. LOCAL_TEST_DATA was added in commit [1], which ships testdata next to native tests. With this CL, 1) manually sync-ing via `adb sync` and running tests with `adb shell` keep working. 2) both of 32- and 64-bit recovery_{unit,component}_test now work in APCT continuous tests. Note that 64-bit tests were failing previously in APCT, due to missing testdata. 3) `atest recovery_unit_test` works, as the testdata gets pushed to /data/local/tmp. [1] commit d07ba4e2a625a8f000d042c1953adb612bccbbe2 in https://android-review.googlesource.com/c/platform/build/+/312567. Bug: 77320514 Test: Build recovery_{unit,component,manual}_test. Setup the test via `adb sync data`. Run both of 32- and 64-bit versions on device. Test: Build and run recovery_host_test on host, for both of 32- and 64-bit versions. Test: `atest recovery_component_test` Change-Id: Ie54037726043a3a659a80030b83db1f8c1de318d --- tests/Android.mk | 50 ++++++++------------------------------------------ 1 file changed, 8 insertions(+), 42 deletions(-) (limited to 'tests/Android.mk') diff --git a/tests/Android.mk b/tests/Android.mk index 9a71371fa..58cefd226 100644 --- a/tests/Android.mk +++ b/tests/Android.mk @@ -45,6 +45,8 @@ LOCAL_SRC_FILES := \ LOCAL_C_INCLUDES := bootable/recovery LOCAL_SHARED_LIBRARIES := liblog +LOCAL_TEST_DATA := \ + $(call find-test-data-in-subdirs, $(LOCAL_PATH), "*", testdata) include $(BUILD_NATIVE_TEST) # Manual tests @@ -61,25 +63,8 @@ LOCAL_SHARED_LIBRARIES := \ liblog \ libpng -resource_files := $(call find-files-in-subdirs, bootable/recovery, \ - "*_text.png", \ - res-mdpi/images \ - res-hdpi/images \ - res-xhdpi/images \ - res-xxhdpi/images \ - res-xxxhdpi/images \ - ) - -# The resource image files that will go to $OUT/data/nativetest/recovery. -testimage_out_path := $(TARGET_OUT_DATA)/nativetest/recovery -GEN := $(addprefix $(testimage_out_path)/, $(resource_files)) - -$(GEN): PRIVATE_PATH := $(LOCAL_PATH) -$(GEN): PRIVATE_CUSTOM_TOOL = cp $< $@ -$(GEN): $(testimage_out_path)/% : bootable/recovery/% - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) - +LOCAL_TEST_DATA := \ + $(call find-test-data-in-subdirs, bootable/recovery, "*_text.png", res-*) include $(BUILD_NATIVE_TEST) # Component tests @@ -171,29 +156,8 @@ LOCAL_STATIC_LIBRARIES := \ libBionicGtestMain \ $(tune2fs_static_libraries) -testdata_files := $(call find-subdir-files, testdata/*) - -# The testdata files that will go to $OUT/data/nativetest/recovery. -testdata_out_path := $(TARGET_OUT_DATA)/nativetest/recovery -GEN := $(addprefix $(testdata_out_path)/, $(testdata_files)) -$(GEN): PRIVATE_PATH := $(LOCAL_PATH) -$(GEN): PRIVATE_CUSTOM_TOOL = cp $< $@ -$(GEN): $(testdata_out_path)/% : $(LOCAL_PATH)/% - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) - -# A copy of the testdata to be packed into continuous_native_tests.zip. -testdata_continuous_zip_prefix := \ - $(call intermediates-dir-for,PACKAGING,recovery_component_test)/DATA -testdata_continuous_zip_path := $(testdata_continuous_zip_prefix)/nativetest/recovery -GEN := $(addprefix $(testdata_continuous_zip_path)/, $(testdata_files)) -$(GEN): PRIVATE_PATH := $(LOCAL_PATH) -$(GEN): PRIVATE_CUSTOM_TOOL = cp $< $@ -$(GEN): $(testdata_continuous_zip_path)/% : $(LOCAL_PATH)/% - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) -LOCAL_PICKUP_FILES := $(testdata_continuous_zip_prefix) - +LOCAL_TEST_DATA := \ + $(call find-test-data-in-subdirs, $(LOCAL_PATH), "*", testdata) include $(BUILD_NATIVE_TEST) # Host tests @@ -222,4 +186,6 @@ LOCAL_STATIC_LIBRARIES := \ libBionicGtestMain LOCAL_SHARED_LIBRARIES := \ liblog +LOCAL_TEST_DATA := \ + $(call find-test-data-in-subdirs, $(LOCAL_PATH), "*", testdata) include $(BUILD_HOST_NATIVE_TEST) -- cgit v1.2.3