---------- Forwarded message ----------
From: Kejun Zhou <kejun.zhou@linaro.org>
Date: 11 June 2012 15:57
Subject: A question about Android build system.
To: Mathieu Poirier <mathieu.poirier@linaro.org>, Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>
Cc: Zach Pfeffer <zach.pfeffer@linaro.org>


Hi,
I have a question about adding pm-qa into Android. Could you give me some help?
There are many scripts in pm-qa. Each script is independent test case.

My question is how to make the Android build the pm-qa automatically without a modification of target/product/core.mk.

Take the cpuidle which is one of pm-qa test modules.
(1) There are cpuidle_01.sh, cpuidle_02.sh, cpuidle_03.sh and cpuidle_killer.c in pm-qa/cpuidle/ folder.


(2) The Android.mk lists cpuidle_01.sh, cpuidle_02.sh, cpuidle_03.sh and cpuidle_killer as independent modules.
~~~~~cpuidle Android.mk~~~~~~~~~
include $(call all-subdir-makefiles)
LOCAL_PATH:= $(call my-dir)

module_name = cpuidle

define $(module_name)_add_executable
    include $(CLEAR_VARS)
    LOCAL_MODULE_TAGS := optional
    LOCAL_MODULE_CLASS := tests
    LOCAL_MODULE := $1.sh
    LOCAL_SRC_FILES := $1.sh
    LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)/pm-qa/$(module_name)
    include $(BUILD_PREBUILT)
endef

test_num := 01 02 03
$(foreach item,$(test_num),$(eval $(call $(module_name)_add_executable, $(module_name)_$(item))))

include $(CLEAR_VARS)
LOCAL_MODULE := cpuidle_killer
LOCAL_SRC_FILES:= cpuidle_killer.c
LOCAL_STATIC_LIBRARIES := libcutils libc
LOCAL_MODULE_TAGS := tests
LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)/pm-qa/$(module_name)
include $(BUILD_EXECUTABLE)
 
(3) Is it possible only add the pm-qa/cpuide folder under (Android_platform)/external/pm-qa, and the Android build system will build the pm-qa/cpuidle automatically?
   

BRs,
Kejun