Automation for build and test OpenCV Manager on several devices added.

This commit is contained in:
Alexander Smorkalov 2012-10-02 14:59:00 +04:00
parent d64d76086e
commit ad58e96581
4 changed files with 67 additions and 10 deletions

43
android/service/all.py Executable file
View File

@ -0,0 +1,43 @@
#!/usr/bin/python
import os
import sys
import shutil
LOCAL_LOG_PATH = os.path.join(os.getcwd(), "logs")
if (__name__ == "__main__"):
if (not os.path.exists(LOCAL_LOG_PATH)):
os.makedirs(LOCAL_LOG_PATH)
print("Building native part of OpenCV Manager...")
HomeDir = os.getcwd()
os.chdir(os.path.join(HomeDir, "engine"))
shutil.rmtree(os.path.join(HomeDir, "engine", "libs"), ignore_errors=True)
shutil.rmtree(os.path.join(HomeDir, "engine", "obj"), ignore_errors=True)
BuildCommand = "ndk-build V=1 > \"%s\" 2>&1" % os.path.join(LOCAL_LOG_PATH, "build.log")
#print(BuildCommand)
res = os.system(BuildCommand)
if (0 == res):
print("Build\t[OK]")
else:
print("Build\t[FAILED]")
sys.exit(-1)
os.chdir(HomeDir)
ConfFile = open("device.conf", "rt")
for s in ConfFile.readlines():
keys = s.split(";")
if (len(keys) < 2):
print("Error: invalid config line: \"%s\"" % s)
continue
Arch = keys[0]
Name = keys[1]
print("testing \"%s\" arch" % Arch)
print("Pushing to device \"%s\"" % Name)
PushCommand = "%s \"%s\" \"%s\" 2>&1" % (os.path.join(HomeDir, "push_native.py"), Arch, Name)
os.system(PushCommand)
print("Testing on device \"%s\"" % Name)
TestCommand = "%s \"%s\" \"%s\" 2>&1" % (os.path.join(HomeDir, "test_native.py"), Arch, Name)
os.system(TestCommand)

View File

@ -0,0 +1,3 @@
armeabi;15c000000581404;
x86;0123456789ABCDEF;
mips;Novo7 Basic;

View File

@ -1,16 +1,22 @@
#!/usr/bin/python
import os
import sys
TARGET_DEVICE_PATH = "/data/data/EngineTest"
DEVICE_NAME = ""
DEVICE_STR = ""
DEVICE_ARCH = "armeabi"
if (DEVICE_NAME != ""):
DEVICE_STR = "-s " + DEVICE_NAME
if (__name__ == "__main__"):
print("Waiting for device ...")
if (len(sys.argv) >= 3):
DEVICE_ARCH = sys.argv[1]
DEVICE_NAME = sys.argv[2]
if (DEVICE_NAME != ""):
DEVICE_STR = "-s \"" + DEVICE_NAME + "\""
print("Waiting for device \"%s\" with arch \"%s\" ..." % (DEVICE_NAME, DEVICE_ARCH))
os.system("adb %s wait-for-device" % DEVICE_STR)
os.system("adb %s shell mkdir -p %s" % (DEVICE_STR, TARGET_DEVICE_PATH))
os.system("adb %s push ./engine/libs/%s/libOpenCVEngine.so %s" % (DEVICE_STR, DEVICE_ARCH, TARGET_DEVICE_PATH))

View File

@ -5,26 +5,31 @@ import sys
DEVICE_NAME = ""
DEVICE_STR = ""
if (DEVICE_NAME != ""):
DEVICE_STR = "-s " + DEVICE_NAME
DEVICE_ARCH = "armeabi"
LOCAL_LOG_PATH = os.path.join(os.getcwd(), "logs")
DEVICE_LOG_PATH = "/sdcard/OpenCVEngineLogs"
DEVICE_BIN_PATH = "/data/data/EngineTest"
def RunTestApp(AppName):
TestLog = os.path.join(DEVICE_LOG_PATH, AppName + ".xml")
TestLog = os.path.join(DEVICE_LOG_PATH, AppName + "_" + DEVICE_ARCH + ".xml")
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__"):
if (3 == len(sys.argv)):
DEVICE_ARCH = sys.argv[1]
DEVICE_NAME = sys.argv[2]
if (DEVICE_NAME != ""):
DEVICE_STR = "-s \"" + DEVICE_NAME + "\""
if (not os.path.exists(LOCAL_LOG_PATH)):
os.makedirs(LOCAL_LOG_PATH)
print("Waiting for device ...")
print("Waiting for device \"%s\" with arch \"%s\" ..." % (DEVICE_NAME, DEVICE_ARCH))
os.system("adb %s wait-for-device" % DEVICE_STR)
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))