aboutsummaryrefslogtreecommitdiff
path: root/lava_android_test/test_definitions/android-0xbenchmark
diff options
context:
space:
mode:
Diffstat (limited to 'lava_android_test/test_definitions/android-0xbenchmark')
-rw-r--r--lava_android_test/test_definitions/android-0xbenchmark/ZeroxBench_Preference.xml5
-rwxr-xr-xlava_android_test/test_definitions/android-0xbenchmark/android_0xbenchmark_kill.py69
-rw-r--r--lava_android_test/test_definitions/android-0xbenchmark/android_0xbenchmark_modify_path.py121
-rwxr-xr-xlava_android_test/test_definitions/android-0xbenchmark/android_0xbenchmark_wait.py54
4 files changed, 249 insertions, 0 deletions
diff --git a/lava_android_test/test_definitions/android-0xbenchmark/ZeroxBench_Preference.xml b/lava_android_test/test_definitions/android-0xbenchmark/ZeroxBench_Preference.xml
new file mode 100644
index 0000000..6f07a12
--- /dev/null
+++ b/lava_android_test/test_definitions/android-0xbenchmark/ZeroxBench_Preference.xml
@@ -0,0 +1,5 @@
+<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
+<map>
+<string name="KEY_RESULT_CUSTOM_DIR">/data/data/org.zeroxlab.zeroxbenchmark/files</string>
+<int name="KEY_RESULT_SELECTION" value="1" />
+</map>
diff --git a/lava_android_test/test_definitions/android-0xbenchmark/android_0xbenchmark_kill.py b/lava_android_test/test_definitions/android-0xbenchmark/android_0xbenchmark_kill.py
new file mode 100755
index 0000000..17a4fd7
--- /dev/null
+++ b/lava_android_test/test_definitions/android-0xbenchmark/android_0xbenchmark_kill.py
@@ -0,0 +1,69 @@
+#!/usr/bin/python
+
+# Copyright (c) 2011 Linaro
+
+# Author: Linaro Validation Team <linaro-dev@lists.linaro.org>
+#
+# This file is part of LAVA Android Test.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import re
+import sys
+import time
+from commands import getstatusoutput
+
+if len(sys.argv) == 1:
+ adb_cmd = "adb"
+else:
+ adb_cmd = "adb -s %s" % (sys.argv[1])
+
+
+def back():
+ back_cmd = '%s shell input keyevent 4' % (adb_cmd)
+ rc, output = getstatusoutput(back_cmd)
+ if rc != 0:
+ print 'Failed to execute command %s:%s' % (back_cmd, output)
+ sys.exit(1)
+back()
+back()
+back()
+
+##app_76 861 80 165896 28848 ffffffff afd0eb18 S
+## org.zeroxlab.zeroxbenchmark
+pattern = re.compile(
+ '^\S+\s+(?P<pid>\d+?)\s+.*org\.zeroxlab\.zeroxbenchmark\s*$')
+while True:
+ pscmd = '%s shell ps' % (adb_cmd)
+ rc, output = getstatusoutput(pscmd)
+ if rc != 0:
+ print ("Failed to get process information about "
+ "org.zeroxlab.zeroxbenchmark:%s") % output
+ sys.exit(1)
+ pid = None
+ for line in output.splitlines():
+ match = pattern.match(line)
+ if match:
+ pid = match.group('pid')
+ break
+
+ if pid is None:
+ sys.exit(0)
+
+ killcmd = '%s shell kill %s' % (adb_cmd, pid)
+ rc, output = getstatusoutput(killcmd)
+ if rc != 0:
+ print 'Failed to kill process(%s):%s' % (pid, output)
+ sys.exit(1)
+ time.sleep(2)
diff --git a/lava_android_test/test_definitions/android-0xbenchmark/android_0xbenchmark_modify_path.py b/lava_android_test/test_definitions/android-0xbenchmark/android_0xbenchmark_modify_path.py
new file mode 100644
index 0000000..0b0d309
--- /dev/null
+++ b/lava_android_test/test_definitions/android-0xbenchmark/android_0xbenchmark_modify_path.py
@@ -0,0 +1,121 @@
+#!/usr/bin/python
+
+# Copyright (c) 2011 Linaro
+
+# Author: Linaro Validation Team <linaro-dev@lists.linaro.org>
+#
+# This file is part of LAVA Android Test.
+#
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+import sys
+import re
+import os
+from commands import getstatusoutput
+
+curdir = os.path.realpath(os.path.dirname(__file__))
+source = '%s/ZeroxBench_Preference.xml' % curdir
+target = ("/data/data/org.zeroxlab.zeroxbenchmark/shared_prefs/"
+ "ZeroxBench_Preference.xml")
+
+if len(sys.argv) == 1:
+ adbcmd = 'adb'
+else:
+ adbcmd = 'adb -s %s' % (sys.argv[1])
+
+target_dir = '/data/data'
+lscmd = '%s shell ls -l %s' % (adbcmd, target_dir)
+rc, output = getstatusoutput(lscmd)
+if rc != 0:
+ print 'Failed to get group and owner of directory(%s) : %s' % (target_dir,
+ output)
+ sys.exit(1)
+group = None
+owner = None
+##drwxr-x--x app_76 app_76 2011-10-21 14:40
+## org.zeroxlab.zeroxbenchmark
+pattern = re.compile(
+ ("^d\S+\s+(?P<group>\S+?)\s+(?P<owner>\S+?)\s+"
+ "\S+\s+\S+\s+org\.zeroxlab\.zeroxbenchmark\s*$"))
+for line in output.splitlines():
+ match = pattern.match(line)
+ if match:
+ group, owner = match.groups()
+ break
+if (group is None) or (owner is None):
+ print 'Failed to get group and owner of directory(%s): %s' % (target_dir,
+ output)
+ sys.exit(1)
+
+target_dir = '/data/data/org.zeroxlab.zeroxbenchmark/shared_prefs'
+mkdircmd = '%s shell mkdir %s' % (adbcmd, target_dir)
+rc, output = getstatusoutput(mkdircmd)
+if rc != 0:
+ print 'Failed to create directory(%s): %s' % (source, target, output)
+ sys.exit(1)
+
+chowncmd = '%s shell chown %s.%s %s' % (adbcmd, owner, group, target_dir)
+rc, output = getstatusoutput(chowncmd)
+if rc != 0:
+ print 'Failed to change group(%s) and owner(%s) of file(%s): %s' % (group,
+ owner, target_dir, output)
+ sys.exit(1)
+
+chmodcmd = '%s shell chmod 771 %s' % (adbcmd, target_dir)
+rc, output = getstatusoutput(chmodcmd)
+if rc != 0:
+ print 'Failed to change chmod to 771 for file(%s): %s' % (target_dir,
+ output)
+ sys.exit(1)
+
+pushcmd = '%s push %s %s' % (adbcmd, source, target)
+rc, output = getstatusoutput(pushcmd)
+if rc != 0:
+ print 'Failed to push file(%s) to file(%s): %s' % (source, target,
+ output)
+ sys.exit(1)
+
+chowncmd = '%s shell chown %s.%s %s' % (adbcmd, owner, group, target)
+rc, output = getstatusoutput(chowncmd)
+if rc != 0:
+ print 'Failed to change group(%s) and owner(%s) of file(%s): %s' % (group,
+ owner, target, output)
+ sys.exit(1)
+
+chmodcmd = '%s shell chmod 660 %s' % (adbcmd, target)
+rc, output = getstatusoutput(chmodcmd)
+if rc != 0:
+ print 'Failed to change chmod to 771 for file(%s): %s' % (target, output)
+ sys.exit(1)
+
+target_dir = '/data/data/org.zeroxlab.zeroxbenchmark/files'
+mkdircmd = '%s shell mkdir %s' % (adbcmd, target_dir)
+rc, output = getstatusoutput(mkdircmd)
+if rc != 0:
+ print 'Failed to create directory(%s): %s' % (target_dir, output)
+ sys.exit(1)
+
+chowncmd = '%s shell chown %s.%s %s' % (adbcmd, owner, group, target_dir)
+rc, output = getstatusoutput(chowncmd)
+if rc != 0:
+ print 'Failed to change group(%s) and owner(%s) of file(%s): %s' % (group,
+ owner, target_dir, output)
+ sys.exit(1)
+
+chmodcmd = '%s shell chmod 771 %s' % (adbcmd, target_dir)
+rc, output = getstatusoutput(chmodcmd)
+if rc != 0:
+ print 'Failed to change chmod to 771 for file(%s): %s' % (target_dir,
+ output)
+ sys.exit(1)
diff --git a/lava_android_test/test_definitions/android-0xbenchmark/android_0xbenchmark_wait.py b/lava_android_test/test_definitions/android-0xbenchmark/android_0xbenchmark_wait.py
new file mode 100755
index 0000000..dcfdbfc
--- /dev/null
+++ b/lava_android_test/test_definitions/android-0xbenchmark/android_0xbenchmark_wait.py
@@ -0,0 +1,54 @@
+#!/usr/bin/python
+
+# Copyright (c) 2011 Linaro
+
+# Author: Linaro Validation Team <linaro-dev@lists.linaro.org>
+#
+# This file is part of LAVA Android Test.
+#
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+import sys
+import time
+
+from lava_android_test.utils import stop_at_pattern
+
+adb_cmd = "adb"
+# here assumes that there is no serial number will start with '-'
+# and the options passed are start with '-' as first option
+if len(sys.argv) > 1 and (not sys.argv[1].startswith('-')):
+ adb_cmd = "adb -s %s" % (sys.argv[1])
+
+timeout = 2400
+for index in range(1, len(sys.argv)):
+ arg = sys.argv[index]
+ if arg == '-timeout' and \
+ (index + 1 < len(sys.argv)) and \
+ sys.argv[index + 1]:
+ try:
+ timeout = int(sys.argv[index + 1])
+ except ValueError:
+ pass
+ finally:
+ break
+
+logcat_cmd = '%s logcat' % (adb_cmd)
+pattern = "Displayed org.zeroxlab.zeroxbenchmark/.Report"
+
+if not stop_at_pattern(command=logcat_cmd, pattern=pattern, timeout=timeout):
+ print "0xbench Test: TIMEOUT Fail"
+ sys.exit(1)
+
+time.sleep(3)
+sys.exit(0)