OSDN Git Service

Add a build target for bootloader tests
authorJed Estep <jestep@google.com>
Sat, 4 Feb 2017 02:37:06 +0000 (18:37 -0800)
committerJed Estep <jestep@google.com>
Tue, 14 Feb 2017 23:57:49 +0000 (15:57 -0800)
Since the .py files don't need to be built, they can be packaged
as-is. We can use a PHONY_PACKAGE with the source files set as
the target's LOCAL_PICKUP_FILES to make them accessible to
packaging targets like google_tests.

Test: make bootloader_unit_test
Bug: 33559158
Change-Id: I4a4453481d25a7dacb5bd8e8680328350d95f553

tests/bootloader/Android.mk [new file with mode: 0644]

diff --git a/tests/bootloader/Android.mk b/tests/bootloader/Android.mk
new file mode 100644 (file)
index 0000000..21905e9
--- /dev/null
@@ -0,0 +1,26 @@
+LOCAL_PATH := $(call my-dir)
+
+# Build a module that has all of the python files as its LOCAL_PICKUP_FILES.
+# Since no action needs to be taken to compile the python source, just
+# use BUILD_PHONY_PACKAGE to give us a target to execute.
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := bootloader_unit_test
+LOCAL_MODULE_TAGS := optional
+
+bootloader_py_files := $(call find-subdir-files, *.py)
+
+bootloader_zip_prefix := $(TARGET_OUT_DATA)/py_bootloader
+bootloader_zip_path := $(bootloader_zip_prefix)/nativetest/py_bootloader
+
+GEN := $(addprefix $(bootloader_zip_path)/, $(bootloader_py_files))
+$(GEN) : PRIVATE_PATH := $(LOCAL_PATH)
+$(GEN) : PRIVATE_CUSTOM_TOOL = cp $< $@
+$(GEN) : $(bootloader_zip_path)/% : $(LOCAL_PATH)/%
+       $(transform-generated-source)
+
+LOCAL_PICKUP_FILES := $(bootloader_zip_prefix)/nativetest
+
+bootloader_unit_test: $(GEN)
+
+include $(BUILD_PHONY_PACKAGE)