2012-06-21 22:50:05 +08:00
|
|
|
#!/usr/bin/python
|
|
|
|
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
|
|
|
DEVICE_NAME = ""
|
|
|
|
DEVICE_STR = ""
|
2012-10-02 18:59:00 +08:00
|
|
|
DEVICE_ARCH = "armeabi"
|
2012-06-21 22:50:05 +08:00
|
|
|
|
|
|
|
LOCAL_LOG_PATH = os.path.join(os.getcwd(), "logs")
|
|
|
|
DEVICE_LOG_PATH = "/sdcard/OpenCVEngineLogs"
|
|
|
|
DEVICE_BIN_PATH = "/data/data/EngineTest"
|
|
|
|
|
|
|
|
def RunTestApp(AppName):
|
2012-10-02 18:59:00 +08:00
|
|
|
TestLog = os.path.join(DEVICE_LOG_PATH, AppName + "_" + DEVICE_ARCH + ".xml")
|
2012-06-21 22:50:05 +08:00
|
|
|
os.system("adb %s shell \"LD_LIBRARY_PATH=%s:$LD_LIBRARY_PATH;%s --gtest_output=\"xml:%s\"\"" % (DEVICE_STR, DEVICE_BIN_PATH, os.path.join(DEVICE_BIN_PATH, AppName), TestLog))
|
|
|
|
os.system("adb %s pull \"%s\" \"%s\"" % (DEVICE_STR, TestLog, LOCAL_LOG_PATH))
|
|
|
|
|
|
|
|
if (__name__ == "__main__"):
|
2012-10-02 18:59:00 +08:00
|
|
|
if (3 == len(sys.argv)):
|
2012-10-24 16:46:36 +08:00
|
|
|
DEVICE_ARCH = sys.argv[1]
|
|
|
|
DEVICE_NAME = sys.argv[2]
|
2012-10-02 18:59:00 +08:00
|
|
|
|
2012-10-17 07:18:30 +08:00
|
|
|
if (DEVICE_NAME != ""):
|
|
|
|
DEVICE_STR = "-s \"" + DEVICE_NAME + "\""
|
2012-10-02 18:59:00 +08:00
|
|
|
|
2012-06-21 22:50:05 +08:00
|
|
|
if (not os.path.exists(LOCAL_LOG_PATH)):
|
2012-10-24 16:46:36 +08:00
|
|
|
os.makedirs(LOCAL_LOG_PATH)
|
2012-10-02 18:59:00 +08:00
|
|
|
|
|
|
|
print("Waiting for device \"%s\" with arch \"%s\" ..." % (DEVICE_NAME, DEVICE_ARCH))
|
2012-06-21 22:50:05 +08:00
|
|
|
os.system("adb %s wait-for-device" % DEVICE_STR)
|
2012-10-02 18:59:00 +08:00
|
|
|
|
2012-06-21 22:50:05 +08:00
|
|
|
os.system("adb %s shell rm -r \"%s\"" % (DEVICE_STR, DEVICE_LOG_PATH))
|
|
|
|
os.system("adb %s shell mkdir -p \"%s\"" % (DEVICE_STR, DEVICE_LOG_PATH))
|
|
|
|
|
|
|
|
RunTestApp("OpenCVEngineTestApp")
|