File: test_native.py

package info (click to toggle)
opencv 2.4.9.1%2Bdfsg-1%2Bdeb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 126,800 kB
  • ctags: 62,729
  • sloc: xml: 509,055; cpp: 490,794; lisp: 23,208; python: 21,174; java: 19,317; ansic: 1,038; sh: 128; makefile: 72
file content (36 lines) | stat: -rwxr-xr-x 1,233 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/python

import os
import sys

DEVICE_NAME = ""
DEVICE_STR = ""
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 + "_" + 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 \"%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))

    RunTestApp("OpenCVEngineTestApp")