diff options
author | Botao Sun <botao.sun@linaro.org> | 2014-08-19 13:04:20 +1000 |
---|---|---|
committer | Milosz Wasilewski <milosz.wasilewski@linaro.org> | 2014-08-20 14:12:59 +0000 |
commit | 34ce942e37fd9a1f6b44612360af932bff0e0c8e (patch) | |
tree | 17d52fd774a0638f42bc22683f4eac868fdbb720 | |
parent | e8a82721fbab8606fce7c306039118b20990ab6c (diff) |
Add Native Gallery Test for Linaro Android
Signed-off by: Botao Sun <botao.sun@linaro.org>
Change-Id: I09bb83739eb0d143c8808cde16f991bcbe9884c0
-rwxr-xr-x | gallery/execute.sh | 12 | ||||
-rwxr-xr-x | gallery/vc.py | 31 |
2 files changed, 43 insertions, 0 deletions
diff --git a/gallery/execute.sh b/gallery/execute.sh new file mode 100755 index 0000000..f0619df --- /dev/null +++ b/gallery/execute.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# need to be defined for different benchmark apks +activity="com.android.gallery3d/.app.GalleryActivity" +apk_file_name="" +test_method="python vc.py" +apk_package="com.android.gallery3d" + +# following should no need to modify +parent_dir=`dirname ${0}` +source "${parent_dir}/../common/common.sh" +main "$@" diff --git a/gallery/vc.py b/gallery/vc.py new file mode 100755 index 0000000..45bcd30 --- /dev/null +++ b/gallery/vc.py @@ -0,0 +1,31 @@ +# Author: Botao Sun <botao.sun@linaro.org> +import sys +import time +import commands +from subprocess import call +from com.dtmilano.android.viewclient import ViewClient, ViewNotFoundException + +package = "com.android.gallery3d" +testcase = "gallery" +target_view = "gl_root_view" + +def collect_score(testcase, run_result): + call(['lava-test-case', testcase, '--result', run_result]) + +device, serialno = ViewClient.connectToDeviceOrExit() + +vc = ViewClient(device, serialno) + +try: + vc.findViewByIdOrRaise(package + ":id/" + target_view) + run_result = "pass" + print target_view + " found!" + print testcase + " Test PASSED!" + collect_score(testcase, run_result) + sys.exit(0) +except ViewNotFoundException: + run_result = "fail" + print target_view + " can not be found! Fatal!" + print testcase + " Test FAILED!" + collect_score(testcase, run_result) + sys.exit(1) |