Merge lp:~le-chi-thu/lava-test/peacekeeper_test_suite into lp:lava-test/0.0

Proposed by Le Chi Thu
Status: Merged
Merged at revision: 67
Proposed branch: lp:~le-chi-thu/lava-test/peacekeeper_test_suite
Merge into: lp:lava-test/0.0
Diff against target: 119 lines (+108/-0)
2 files modified
abrek/test_definitions/peacekeeper.py (+41/-0)
abrek/test_definitions/peacekeeper/peacekeeper.py (+67/-0)
To merge this branch: bzr merge lp:~le-chi-thu/lava-test/peacekeeper_test_suite
Reviewer Review Type Date Requested Status
Linaro Validation Team Pending
Review via email: mp+60041@code.launchpad.net

Description of the change

Added browser benchmark test case : peacekeeper - http://clients.futuremark.com/peacekeeper/index.action

The test case is used the firefox browser to perform the test.

To post a comment you must log in.
67. By Le Chi Thu <email address hidden> <email address hidden>

Added browser benchmark test case - peacekeeper

Revision history for this message
Paul Larson (pwlars) wrote :

Have you tested this? I suspect this would cause confusion about whether you were referring to the peacekeeper directory for abrek to import or the module by itself. It may make sense to store the code for the actual testsuite somewhere else. I'll give it a try later today.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'abrek/test_definitions/peacekeeper'
2=== added file 'abrek/test_definitions/peacekeeper.py'
3--- abrek/test_definitions/peacekeeper.py 1970-01-01 00:00:00 +0000
4+++ abrek/test_definitions/peacekeeper.py 2011-05-05 11:13:26 +0000
5@@ -0,0 +1,41 @@
6+# Copyright (c) 2010 Linaro
7+#
8+# This program is free software: you can redistribute it and/or modify
9+# it under the terms of the GNU General Public License as published by
10+# the Free Software Foundation, either version 3 of the License, or
11+# (at your option) any later version.
12+#
13+# This program is distributed in the hope that it will be useful,
14+# but WITHOUT ANY WARRANTY; without even the implied warranty of
15+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+# GNU General Public License for more details.
17+#
18+# You should have received a copy of the GNU General Public License
19+# along with this program. If not, see <http://www.gnu.org/licenses/>.
20+
21+"""
22+ This script automates the automate installation, execution, and
23+ results parsing for the Peacekeeper browser benchmark.
24+
25+ http://clients.futuremark.com/peacekeeper/index.action
26+"""
27+
28+import abrek.testdef
29+import os
30+
31+curdir = os.path.realpath(os.path.dirname(__file__))
32+
33+INSTALLSTEPS = ['cp -rf %s/peacekeeper/* .'%curdir]
34+RUNSTEPS = ['python peacekeeper.py firefox']
35+DEPS = ['python-ldtp','firefox']
36+
37+my_installer = abrek.testdef.AbrekTestInstaller(INSTALLSTEPS, deps=DEPS)
38+my_runner = abrek.testdef.AbrekTestRunner(RUNSTEPS)
39+
40+PATTERN = "^(?P<result>\w+): Score = (?P<measurement>\d+)"
41+
42+my_parser = abrek.testdef.AbrekTestParser(PATTERN,
43+ appendall={'units':'point'})
44+
45+testobj = abrek.testdef.AbrekTest(testname="peacekeeper", installer=my_installer,
46+ runner=my_runner, parser=my_parser)
47
48=== added file 'abrek/test_definitions/peacekeeper/peacekeeper.py'
49--- abrek/test_definitions/peacekeeper/peacekeeper.py 1970-01-01 00:00:00 +0000
50+++ abrek/test_definitions/peacekeeper/peacekeeper.py 2011-05-05 11:13:26 +0000
51@@ -0,0 +1,67 @@
52+#!/usr/bin/python
53+
54+import re
55+import sys
56+import time
57+from optparse import OptionParser
58+from ldtp import *
59+from urllib import urlopen
60+
61+chromium_data = {
62+ "cmd":"chromium-browser",
63+ "title":"*Chromium",
64+ "urlfield":"txt0"
65+}
66+
67+firefox_data = {
68+ "cmd":"firefox",
69+ "title":"*Firefox",
70+ "urlfield":"txtGotoaWebSite"
71+}
72+
73+browser_data = {
74+ "firefox":firefox_data,
75+ "chromium":chromium_data
76+}
77+
78+site = "http://service.futuremark.com/peacekeeper/run.action"
79+
80+try:
81+ browser = browser_data[sys.argv[1]]
82+except:
83+ print "Usage: %s [%s]" % (sys.argv[0], '|'.join(browser_data.keys()))
84+ sys.exit(1)
85+
86+closewindow(browser["title"])
87+
88+launchapp(browser["cmd"], [site])
89+
90+if not waittillguiexist(browser["title"], guiTimeOut = 60):
91+ print "Error: Program never started"
92+ sys.exit(-1)
93+
94+result_url = gettextvalue(browser["title"], browser["urlfield"])
95+wait_loop = 60 # 60 * 30 seconds = 15 minutes
96+time.sleep(10)
97+
98+while not re.search('results.action', result_url) and wait_loop > 0:
99+ result_url = gettextvalue(browser["title"], browser["urlfield"])
100+ print "waiting..."
101+ time.sleep(30)
102+ wait_loop = wait_loop-1
103+
104+closewindow(browser["title"])
105+
106+print result_url
107+
108+if wait_loop > 0:
109+ fd = urlopen(result_url)
110+ data = fd.read()
111+ fd.close()
112+
113+ scoreline = re.search('<div class="score">(\d+)</div>', data)
114+ if scoreline:
115+ score = scoreline.group(1)
116+ print "pass: Score = %s" % score
117+else:
118+ print "fail: Score = 0"
119\ No newline at end of file

Subscribers

People subscribed via source and target branches