Merge lp:~le-chi-thu/lava-test/override-test-options into lp:lava-test/0.0
- override-test-options
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 102 |
Proposed branch: | lp:~le-chi-thu/lava-test/override-test-options |
Merge into: | lp:lava-test/0.0 |
Diff against target: |
518 lines (+88/-55) 20 files modified
lava_test/api/delegates.py (+4/-2) lava_test/commands.py (+10/-1) lava_test/core/runners.py (+14/-5) lava_test/core/tests.py (+5/-3) lava_test/test_definitions/bootchart.py (+3/-2) lava_test/test_definitions/firefox.py (+3/-3) lava_test/test_definitions/glmemperf.py (+3/-3) lava_test/test_definitions/gmpbench.py (+3/-2) lava_test/test_definitions/gtkperf.py (+3/-3) lava_test/test_definitions/ltp.py (+3/-2) lava_test/test_definitions/peacekeeper.py (+3/-2) lava_test/test_definitions/peacekeeper/peacekeeper_runner.py (+7/-3) lava_test/test_definitions/posixtestsuite.py (+3/-2) lava_test/test_definitions/pwrmgmt.py (+3/-3) lava_test/test_definitions/pybench.py (+5/-7) lava_test/test_definitions/smem.py (+4/-3) lava_test/test_definitions/stream.py (+3/-2) lava_test/test_definitions/tiobench.py (+3/-3) lava_test/test_definitions/x11perf.py (+3/-2) lava_test/test_definitions/xrestop.py (+3/-2) |
To merge this branch: | bzr merge lp:~le-chi-thu/lava-test/override-test-options |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Paul Larson (community) | Approve | ||
Le Chi Thu (community) | Needs Resubmitting | ||
Review via email: mp+79251@code.launchpad.net |
Commit message
Description of the change
Implemented the blueprint https:/
See the updated test definition peacekeeper.py how to use this feature.
from the peacekeeper.py :
RUNSTEPS = ['python peacekeeper_
The $(OPTIONS) in the run steps will be replaced with 'firefox' when issuing the command "lava-test run peacekeeper firefox"
- 102. By Le Chi Thu <email address hidden> <email address hidden>
-
Make testoptions as option parameter in run command.
Le Chi Thu (le-chi-thu) wrote : | # |
I updated the lava-test override-
lava-test run [-h] [-q] [-Q] [-S] [-H] [--trusted-time] [-o FILE] [-A] test_id [test_options]
Spring Zhang (qzhang) wrote : | # |
182 +if result_
is it started with "http"?
+ "Example of multiple options : lava-test run foo_test 'arg1 arg2")
lost a single-quote
Paul Larson (pwlars) wrote : | # |
> I updated the lava-test override-
> before but the test options is an optional parameter.
>
> lava-test run [-h] [-q] [-Q] [-S] [-H] [--trusted-time] [-o FILE] [-A] test_id
> [test_options]
Indeed, it should be optional, however please see my previous comments. I think if we used something like --test-options "-a foo -b bar" instead, it would be better. Rational is explained in previous comment.
- 103. By Le Chi Thu <email address hidden> <email address hidden>
-
make the test_options an option instead of argument.
- 104. By Le Chi Thu <email address hidden> <email address hidden>
-
made the test_options as a option to the run command
- 105. By Le Chi Thu <email address hidden> <email address hidden>
-
Renamed --test_options to --test-options
Le Chi Thu (le-chi-thu) wrote : | # |
Now it is an option instead of a argument.
lava-test run [-h] [-q] [-Q] [-S] [-H] [--trusted-time] [-o FILE] [-A]
positional arguments:
test_id Test or test suite identifier
optional arguments:
-h, --help show this help message and exit
-q, --quiet Be less verbose about undertaken actions
-Q, --quiet-subcommands
-t TEST_OPTIONS, --test-options TEST_OPTIONS
Paul Larson (pwlars) wrote : | # |
The change still needs to be made to allow all tests to allow options sent to them, not just peacekeeper.
- 106. By Le Chi Thu <email address hidden> <email address hidden>
-
Updated all test definitions with
Paul Larson (pwlars) wrote : | # |
I haven't tested all of them, but I spot checked a few and they seemed to run ok. I also fixed the unit tests. The change in number of args to ...
67 - def _run_lava_
68 + def _run_lava_
...broke things a bit.
Also, it seems that there's still no way to see information on the test from the command line about what the default args will be. I'd really like to have that and it should be pretty simple. I'd like to move this along though, so I'll just add a bug for it.
Preview Diff
1 | === modified file 'lava_test/api/delegates.py' |
2 | --- lava_test/api/delegates.py 2011-09-27 20:07:52 +0000 |
3 | +++ lava_test/api/delegates.py 2011-10-20 12:16:24 +0000 |
4 | @@ -65,7 +65,7 @@ |
5 | """ |
6 | |
7 | @abstractmethod |
8 | - def run(self, artifacts, observer): |
9 | + def run(self, artifacts, observer, test_options): |
10 | """ |
11 | Run the test and create artifacts (typically log files). |
12 | |
13 | @@ -78,7 +78,9 @@ |
14 | :param observer: |
15 | Observer object that makes it possible to monitor the actions |
16 | performed by the test runner. |
17 | - :type observer: :class:`~lava_test.api.observers.ITestRunnerObserver` |
18 | + :type observer: :class:`~lava_test.api.observers.ITestRunnerObserver` |
19 | + :param test_options: |
20 | + A string with space separated options to pass to the test. |
21 | |
22 | :return true if any test step return none-zero return code |
23 | .. versionadded:: 0.2 |
24 | |
25 | === modified file 'lava_test/commands.py' |
26 | --- lava_test/commands.py 2011-10-05 21:57:34 +0000 |
27 | +++ lava_test/commands.py 2011-10-20 12:16:24 +0000 |
28 | @@ -221,11 +221,20 @@ |
29 | " is not affected as it never stores any" |
30 | " attachments.")) |
31 | |
32 | + parser.add_argument("-t", "--test-options", |
33 | + default=None, |
34 | + help="Override the default test options. " |
35 | + "The $(OPTIONS) in the run steps will be replaced by the options." |
36 | + "See peacekeeper.py as example how to use this feature." |
37 | + "To provide multiple options, use quote character." |
38 | + "Example : lava-test run peacekeeper -t firefox. " |
39 | + "Example of multiple options : lava-test run foo_test -t 'arg1 arg2'") |
40 | + |
41 | def invoke_with_test(self, test): |
42 | if not test.is_installed: |
43 | raise LavaCommandError("The specified test is not installed") |
44 | try: |
45 | - artifacts, run_fail = test.run(self) |
46 | + artifacts, run_fail = test.run(self, test_options=self.args.test_options) |
47 | except subprocess.CalledProcessError as ex: |
48 | if ex.returncode is None: |
49 | raise LavaCommandError("Command %r was aborted" % ex.cmd) |
50 | |
51 | === modified file 'lava_test/core/runners.py' |
52 | --- lava_test/core/runners.py 2011-10-05 21:57:34 +0000 |
53 | +++ lava_test/core/runners.py 2011-10-20 12:16:24 +0000 |
54 | @@ -32,14 +32,14 @@ |
55 | :ivar steps: |
56 | list of shell commands to execute |
57 | """ |
58 | - def __init__(self, steps=None): |
59 | + def __init__(self, steps=None, default_options=None): |
60 | self.steps = steps or [] |
61 | - self.testoutput = [] # XXX: is this still used? |
62 | + self.default_options = default_options |
63 | |
64 | def __repr__(self): |
65 | return "<%s steps=%r>" % (self.__class__.__name__, self.steps) |
66 | |
67 | - def _run_lava_test_steps(self, artifacts, observer): |
68 | + def _run_lava_test_steps(self, artifacts, observer, test_options): |
69 | stdout = open(artifacts.stdout_pathname, 'at') |
70 | stderr = open(artifacts.stderr_pathname, 'at') |
71 | delegate = DisplayDelegate(stdout, stderr, observer) |
72 | @@ -47,6 +47,15 @@ |
73 | run_failed = False |
74 | try: |
75 | for cmd in self.steps: |
76 | + # should override the test options in the step ? |
77 | + if cmd.find("$(OPTIONS)") > 0: |
78 | + # check if test options is provided or use default options |
79 | + if not test_options and self.default_options == None: |
80 | + raise RuntimeError("Test options is missing. No default value is provided.") |
81 | + if not test_options: |
82 | + test_options = self.default_options |
83 | + cmd = cmd.replace("$(OPTIONS)",test_options) |
84 | + |
85 | if observer: observer.about_to_run_shell_command(cmd) |
86 | returncode = extcmd.call(cmd, shell=True) |
87 | if observer: observer.did_run_shell_command(cmd, returncode) |
88 | @@ -56,7 +65,7 @@ |
89 | stderr.close() |
90 | return run_failed |
91 | |
92 | - def run(self, artifacts, observer=None): |
93 | + def run(self, artifacts, observer=None, test_options = None): |
94 | """ |
95 | Run the test program by executing steps in sequence. |
96 | |
97 | @@ -65,6 +74,6 @@ |
98 | :meth:`~lava_test.api.delegates.TestRunner.run` |
99 | """ |
100 | self.starttime = datetime.datetime.utcnow() |
101 | - run_failed = self._run_lava_test_steps(artifacts, observer) |
102 | + run_failed = self._run_lava_test_steps(artifacts, observer, test_options) |
103 | self.endtime = datetime.datetime.utcnow() |
104 | return run_failed |
105 | |
106 | === modified file 'lava_test/core/tests.py' |
107 | --- lava_test/core/tests.py 2011-10-05 21:57:34 +0000 |
108 | +++ lava_test/core/tests.py 2011-10-20 12:16:24 +0000 |
109 | @@ -52,13 +52,15 @@ |
110 | """ |
111 | |
112 | def __init__(self, test_id, test_version=None, |
113 | - installer=None, runner=None, parser=None): |
114 | + installer=None, runner=None, parser=None, default_options=None): |
115 | self._test_id = test_id |
116 | self._test_version = test_version |
117 | # Delegate objects |
118 | self.installer = installer |
119 | self.runner = runner |
120 | self.parser = parser |
121 | + self.default_options = default_options |
122 | + |
123 | # Config instance |
124 | self._config = get_config() |
125 | |
126 | @@ -117,7 +119,7 @@ |
127 | if os.path.exists(self.install_dir): |
128 | shutil.rmtree(self.install_dir) |
129 | |
130 | - def run(self, observer=None): |
131 | + def run(self, observer=None, test_options=None): |
132 | if not self.runner: |
133 | raise RuntimeError( |
134 | "no test runner defined for '%s'" % self.test_id) |
135 | @@ -126,7 +128,7 @@ |
136 | logging.debug( |
137 | "Invoking %r.run_and_store_artifacts(...)", |
138 | self.runner, observer) |
139 | - run_fail = self.runner.run(artifacts, observer) |
140 | + run_fail = self.runner.run(artifacts, observer, test_options) |
141 | |
142 | return artifacts, run_fail |
143 | |
144 | |
145 | === modified file 'lava_test/test_definitions/bootchart.py' |
146 | --- lava_test/test_definitions/bootchart.py 2011-09-23 08:10:25 +0000 |
147 | +++ lava_test/test_definitions/bootchart.py 2011-10-20 12:16:24 +0000 |
148 | @@ -18,13 +18,14 @@ |
149 | from lava_test.core.runners import TestRunner |
150 | from lava_test.core.tests import Test |
151 | |
152 | +DEFAULT_OPTIONS = "" |
153 | INSTALLSTEPS = ['bzr branch lp:~linaro-foundations/lava-test/bootchartscript'] |
154 | DEPS = ['bootchart', 'pybootchartgui', 'bzr'] |
155 | -RUNSTEPS = ['./bootchartscript/bootchartscript.sh'] |
156 | +RUNSTEPS = ['./bootchartscript/bootchartscript.sh $(OPTIONS)'] |
157 | PATTERN = "^(?P<test_case_id>\w+):\W+(?P<measurement>\d+\.\d+)" |
158 | |
159 | bootchartinst = TestInstaller(INSTALLSTEPS, deps=DEPS) |
160 | -bootchartrun = TestRunner(RUNSTEPS) |
161 | +bootchartrun = TestRunner(RUNSTEPS, default_options=DEFAULT_OPTIONS) |
162 | bootchartparser = TestParser(PATTERN, |
163 | appendall={'units':'sec', 'result':'pass'}) |
164 | testobj = Test(test_id="bootchart", installer=bootchartinst, |
165 | |
166 | === modified file 'lava_test/test_definitions/firefox.py' |
167 | --- lava_test/test_definitions/firefox.py 2011-09-12 09:19:10 +0000 |
168 | +++ lava_test/test_definitions/firefox.py 2011-10-20 12:16:24 +0000 |
169 | @@ -19,14 +19,14 @@ |
170 | from lava_test.core.runners import TestRunner |
171 | from lava_test.core.tests import Test |
172 | |
173 | - |
174 | +DEFAULT_OPTIONS = "" |
175 | INSTALLSTEPS = ['git clone git://github.com/janimo/firefox-startup-timing.git'] |
176 | DEPS = ['firefox', 'git-core', 'gcalctool'] |
177 | -RUNSTEPS = ['cd firefox-startup-timing; ./firefox_startup_timing.sh'] |
178 | +RUNSTEPS = ['cd firefox-startup-timing; ./firefox_startup_timing.sh $(OPTIONS)'] |
179 | PATTERN = "^(?P<test_case_id>\w+):(?P<measurement>\d+)" |
180 | |
181 | firefoxinst = TestInstaller(INSTALLSTEPS, deps=DEPS) |
182 | -firefoxrun = TestRunner(RUNSTEPS) |
183 | +firefoxrun = TestRunner(RUNSTEPS, default_options=DEFAULT_OPTIONS) |
184 | firefoxparser = TestParser(PATTERN, |
185 | appendall={'units':'ms', 'result':'pass'}) |
186 | testobj = Test(test_id="firefox", installer=firefoxinst, |
187 | |
188 | === modified file 'lava_test/test_definitions/glmemperf.py' |
189 | --- lava_test/test_definitions/glmemperf.py 2011-09-12 09:19:10 +0000 |
190 | +++ lava_test/test_definitions/glmemperf.py 2011-10-20 12:16:24 +0000 |
191 | @@ -19,12 +19,12 @@ |
192 | from lava_test.core.runners import TestRunner |
193 | from lava_test.core.tests import Test |
194 | |
195 | - |
196 | -RUNSTEPS = ["glmemperf -e shmimage"] |
197 | +DEFAULT_OPTIONS = "-e shmimage" |
198 | +RUNSTEPS = ["glmemperf $(OPTIONS)"] |
199 | PATTERN = "^(?P<test_case_id>\w+):\W+(?P<measurement>\d+) fps" |
200 | |
201 | inst = TestInstaller(deps=["glmemperf"]) |
202 | -run = TestRunner(RUNSTEPS) |
203 | +run = TestRunner(RUNSTEPS, default_options=DEFAULT_OPTIONS) |
204 | parse = TestParser(PATTERN, |
205 | appendall={'units':'fps', |
206 | 'result':'pass'}) |
207 | |
208 | === modified file 'lava_test/test_definitions/gmpbench.py' |
209 | --- lava_test/test_definitions/gmpbench.py 2011-09-12 09:19:10 +0000 |
210 | +++ lava_test/test_definitions/gmpbench.py 2011-10-20 12:16:24 +0000 |
211 | @@ -33,17 +33,18 @@ |
212 | URL_gexpr="http://www.gmplib.org/gexpr.c" |
213 | DEPS = ['gcc', 'libgmp3-dev', 'wget', 'bzip2'] |
214 | |
215 | +DEFAULT_OPTIONS = "" |
216 | INSTALLSTEPS = ['tar -xjf gmpbench-0.2.tar.bz2', |
217 | 'wget -c %s' %(URL_gexpr), |
218 | 'mv gexpr.c gmpbench-0.2', |
219 | 'cd gmpbench-0.2 && gcc -o gexpr gexpr.c -static -lm'] |
220 | -RUNSTEPS = ['cd gmpbench-0.2 && PATH=$PATH:. ./runbench '] |
221 | +RUNSTEPS = ['cd gmpbench-0.2 && PATH=$PATH:. ./runbench $(OPTIONS)'] |
222 | PATTERN = "\s*(?P<test_case_id>GMPbench\.*\w*\.*\w*):?\s*"\ |
223 | "(?P<measurement>\d+.\d+)" |
224 | |
225 | gmpbenchinst = TestInstaller(INSTALLSTEPS, deps=DEPS, |
226 | url=URL) |
227 | -gmpbenchrun = TestRunner(RUNSTEPS) |
228 | +gmpbenchrun = TestRunner(RUNSTEPS,default_options=DEFAULT_OPTIONS) |
229 | gmpbenchparser = TestParser(PATTERN, |
230 | appendall={'units':'operations/s', 'result':'pass'}) |
231 | testobj = Test(test_id="gmpbench", installer=gmpbenchinst, |
232 | |
233 | === modified file 'lava_test/test_definitions/gtkperf.py' |
234 | --- lava_test/test_definitions/gtkperf.py 2011-09-23 08:56:22 +0000 |
235 | +++ lava_test/test_definitions/gtkperf.py 2011-10-20 12:16:24 +0000 |
236 | @@ -22,9 +22,9 @@ |
237 | |
238 | |
239 | # Run tests automatically, 500 repetitions each |
240 | -gtkperf_options = "-a -c 500" |
241 | +DEFAULT_OPTIONS = "-a -c 500" |
242 | |
243 | -RUNSTEPS = ["LANG=C gtkperf %s" % gtkperf_options] |
244 | +RUNSTEPS = ["LANG=C gtkperf $(OPTIONS)"] |
245 | |
246 | class GtkTestParser(TestParser): |
247 | def parse(self, artifacts): |
248 | @@ -58,7 +58,7 @@ |
249 | |
250 | parse = GtkTestParser(appendall={'units':'seconds', 'result':'pass'}) |
251 | inst = TestInstaller(deps=["gtkperf"]) |
252 | -run = TestRunner(RUNSTEPS) |
253 | +run = TestRunner(RUNSTEPS, default_options=DEFAULT_OPTIONS) |
254 | |
255 | testobj = Test(test_id="gtkperf", installer=inst, |
256 | runner=run, parser=parse) |
257 | |
258 | === modified file 'lava_test/test_definitions/ltp.py' |
259 | --- lava_test/test_definitions/ltp.py 2011-09-12 09:19:10 +0000 |
260 | +++ lava_test/test_definitions/ltp.py 2011-10-20 12:16:24 +0000 |
261 | @@ -35,11 +35,12 @@ |
262 | make all |
263 | SKIP_IDCHECK=1 make install |
264 | """ |
265 | +DEFAULT_OPTIONS = "-f syscalls -p -q" |
266 | |
267 | INSTALLSTEPS = ["echo '%s' > installltp.sh" % SCRIPT, |
268 | 'chmod +x installltp.sh', |
269 | './installltp.sh'] |
270 | -RUNSTEPS = ['cd build && sudo ./runltp -f syscalls -p -q'] |
271 | +RUNSTEPS = ['cd build && sudo ./runltp $(OPTIONS)'] |
272 | PATTERN = "^(?P<test_case_id>\S+) (?P<subid>\d+) (?P<result>\w+) : (?P<message>.+)" |
273 | FIXUPS = {"TBROK":"fail", |
274 | "TCONF":"skip", |
275 | @@ -74,7 +75,7 @@ |
276 | |
277 | ltpinst = TestInstaller(INSTALLSTEPS, deps=DEPS, url=URL, |
278 | md5=MD5) |
279 | -ltprun = TestRunner(RUNSTEPS) |
280 | +ltprun = TestRunner(RUNSTEPS,default_options = DEFAULT_OPTIONS) |
281 | ltpparser = LTPParser(PATTERN, fixupdict = FIXUPS) |
282 | testobj = Test(test_id="ltp", test_version=VERSION, |
283 | installer=ltpinst, runner=ltprun, |
284 | |
285 | === modified file 'lava_test/test_definitions/peacekeeper.py' |
286 | --- lava_test/test_definitions/peacekeeper.py 2011-09-12 09:19:10 +0000 |
287 | +++ lava_test/test_definitions/peacekeeper.py 2011-10-20 12:16:24 +0000 |
288 | @@ -30,12 +30,13 @@ |
289 | |
290 | curdir = os.path.realpath(os.path.dirname(__file__)) |
291 | |
292 | +DEFAULT_OPTIONS = "firefox" |
293 | INSTALLSTEPS = ['cp -rf %s/peacekeeper/* .'%curdir] |
294 | -RUNSTEPS = ['python peacekeeper_runner.py firefox'] |
295 | +RUNSTEPS = ['python peacekeeper_runner.py $(OPTIONS)'] |
296 | DEPS = ['python-ldtp','firefox'] |
297 | |
298 | my_installer = TestInstaller(INSTALLSTEPS, deps=DEPS) |
299 | -my_runner = TestRunner(RUNSTEPS) |
300 | +my_runner = TestRunner(RUNSTEPS, default_options=DEFAULT_OPTIONS) |
301 | |
302 | PATTERN = "^(?P<result>\w+): Score = (?P<measurement>\d+)" |
303 | |
304 | |
305 | === modified file 'lava_test/test_definitions/peacekeeper/peacekeeper_runner.py' |
306 | --- lava_test/test_definitions/peacekeeper/peacekeeper_runner.py 2011-06-08 12:38:38 +0000 |
307 | +++ lava_test/test_definitions/peacekeeper/peacekeeper_runner.py 2011-10-20 12:16:24 +0000 |
308 | @@ -25,7 +25,6 @@ |
309 | } |
310 | |
311 | site = "http://service.futuremark.com/peacekeeper/run.action" |
312 | -#site = "http://service.futuremark.com/peacekeeper/results.action?key=5sdG" |
313 | |
314 | try: |
315 | browser = browser_data[sys.argv[1]] |
316 | @@ -53,8 +52,13 @@ |
317 | |
318 | closewindow(browser["title"]) |
319 | |
320 | -print result_url |
321 | - |
322 | +print "result_url = %s" %result_url |
323 | + |
324 | +# if the url not start with http ? append http to it. |
325 | + |
326 | +if result_url.find("http") != 0: |
327 | + result_url = "http://" + result_url |
328 | + |
329 | if wait_loop > 0: |
330 | fd = urlopen(result_url) |
331 | data = fd.read() |
332 | |
333 | === modified file 'lava_test/test_definitions/posixtestsuite.py' |
334 | --- lava_test/test_definitions/posixtestsuite.py 2011-09-23 08:56:22 +0000 |
335 | +++ lava_test/test_definitions/posixtestsuite.py 2011-10-20 12:16:24 +0000 |
336 | @@ -34,9 +34,10 @@ |
337 | URL= "http://downloads.sourceforge.net/project/ltp/LTP Source/ltp-%s/"\ |
338 | "ltp-full-%s.bz2" % (VERSION, VERSION) |
339 | MD5="6982c72429a62f3917c13b2d529ad1ce" |
340 | +DEFAULT_OPTIONS = "" |
341 | INSTALLSTEPS = ['tar -xjf ltp-full-20100831.bz2'] |
342 | DEPS = ['gcc', 'bzip2'] |
343 | -RUNSTEPS = ['cd ltp-full-20100831/testcases/open_posix_testsuite/ && make'] |
344 | +RUNSTEPS = ['cd ltp-full-20100831/testcases/open_posix_testsuite/ && make $(OPTIONS)'] |
345 | |
346 | PATTERN = "((?P<test_case_id>\A(\w+[/]+)+\w+[-]*\w*[-]*\w*) .*? (?P<result>\w+))" |
347 | FIXUPS = { |
348 | @@ -69,7 +70,7 @@ |
349 | |
350 | posix_inst = TestInstaller(INSTALLSTEPS, deps=DEPS, |
351 | url=URL, md5=MD5) |
352 | -posix_run = TestRunner(RUNSTEPS) |
353 | +posix_run = TestRunner(RUNSTEPS, default_options=DEFAULT_OPTIONS) |
354 | posixparser = PosixParser(PATTERN, fixupdict = FIXUPS) |
355 | testobj = Test(test_id="posixtestsuite", test_version=VERSION, |
356 | installer=posix_inst, runner=posix_run, |
357 | |
358 | === modified file 'lava_test/test_definitions/pwrmgmt.py' |
359 | --- lava_test/test_definitions/pwrmgmt.py 2011-10-05 22:10:55 +0000 |
360 | +++ lava_test/test_definitions/pwrmgmt.py 2011-10-20 12:16:24 +0000 |
361 | @@ -19,15 +19,15 @@ |
362 | from lava_test.core.runners import TestRunner |
363 | from lava_test.core.tests import Test |
364 | |
365 | - |
366 | +DEFAULT_OPTIONS = "" |
367 | |
368 | INSTALLSTEPS = ['git clone git://git.linaro.org/tools/pm-qa.git', |
369 | 'cd pm-qa && make clean && make all'] |
370 | -RUNSTEPS = ['cd pm-qa && make check'] |
371 | +RUNSTEPS = ['cd pm-qa && make check $(OPTIONS)'] |
372 | DEPS = ['git-core', 'make', 'linux-libc-dev', 'util-linux'] |
373 | |
374 | pwrmgmtinst = TestInstaller(INSTALLSTEPS, deps=DEPS) |
375 | -pwrmgmtrun = TestRunner(RUNSTEPS) |
376 | +pwrmgmtrun = TestRunner(RUNSTEPS, default_options=DEFAULT_OPTIONS) |
377 | |
378 | # test case name is before ":" , the test log is between ":" and "...", |
379 | # the result is after "..." |
380 | |
381 | === modified file 'lava_test/test_definitions/pybench.py' |
382 | --- lava_test/test_definitions/pybench.py 2011-09-12 09:19:10 +0000 |
383 | +++ lava_test/test_definitions/pybench.py 2011-10-20 12:16:24 +0000 |
384 | @@ -29,13 +29,13 @@ |
385 | |
386 | VERSION='r27' |
387 | URL="http://svn.python.org/projects/python/tags/%s/Tools/pybench/" %(VERSION) |
388 | - |
389 | +DEFAULT_OPTIONS = "" |
390 | INSTALLSTEPS = ["svn export %s" %(URL)] |
391 | -RUNSTEPS = ['python pybench/pybench.py'] |
392 | +RUNSTEPS = ['python pybench/pybench.py $(OPTIONS)'] |
393 | DEPS = ['subversion'] |
394 | |
395 | my_installer = TestInstaller(INSTALLSTEPS, deps=DEPS) |
396 | -my_runner = TestRunner(RUNSTEPS) |
397 | +my_runner = TestRunner(RUNSTEPS,default_options=DEFAULT_OPTIONS) |
398 | |
399 | # test case name is first column and measurement is average column |
400 | # |
401 | @@ -45,9 +45,7 @@ |
402 | |
403 | PATTERN = "^\s+(?P<test_case_id>\w+):\s+(\d+)ms\s+(?P<measurement>\d+)ms" |
404 | |
405 | -my_parser = TestParser(PATTERN, |
406 | - appendall={'units':'ms', |
407 | - 'result':'pass'}) |
408 | +my_parser = TestParser(PATTERN, appendall={'units':'ms','result':'pass'}) |
409 | |
410 | testobj = Test(test_id="pybench", installer=my_installer, |
411 | - runner=my_runner, parser=my_parser) |
412 | + runner=my_runner, parser=my_parser) |
413 | |
414 | === modified file 'lava_test/test_definitions/smem.py' |
415 | --- lava_test/test_definitions/smem.py 2011-09-23 08:10:25 +0000 |
416 | +++ lava_test/test_definitions/smem.py 2011-10-20 12:16:24 +0000 |
417 | @@ -18,13 +18,14 @@ |
418 | from lava_test.core.runners import TestRunner |
419 | from lava_test.core.tests import Test |
420 | |
421 | - |
422 | -RUNSTEPS = ['smem -w | tail -n 3'] |
423 | +DEFAULT_OPTIONS = "" |
424 | +RUNSTEPS = ['smem -w $(OPTIONS) | tail -n 3'] |
425 | PATTERN = "^(?P<test_case_id>(\w+\s)+)\s\s+(?P<measurement>\d+)" |
426 | DEPS = ['smem'] |
427 | |
428 | + |
429 | smeminst = TestInstaller(deps=DEPS) |
430 | -smemrun = TestRunner(RUNSTEPS) |
431 | +smemrun = TestRunner(RUNSTEPS,default_options=DEFAULT_OPTIONS) |
432 | smemparser = TestParser(PATTERN, |
433 | appendall={'units':'KB', 'result':'pass'}) |
434 | testobj = Test(test_id="smem", installer=smeminst, |
435 | |
436 | === modified file 'lava_test/test_definitions/stream.py' |
437 | --- lava_test/test_definitions/stream.py 2011-09-12 09:19:10 +0000 |
438 | +++ lava_test/test_definitions/stream.py 2011-10-20 12:16:24 +0000 |
439 | @@ -21,11 +21,12 @@ |
440 | URL="http://www.cs.virginia.edu/stream/FTP/Code/stream.c" |
441 | INSTALLSTEPS = ['cc stream.c -O2 -fopenmp -o stream'] |
442 | DEPS = ['gcc', 'build-essential'] |
443 | -RUNSTEPS = ['./stream'] |
444 | +DEFAULT_OPTIONS = "" |
445 | +RUNSTEPS = ['./stream $(OPTIONS)'] |
446 | PATTERN = "^(?P<test_case_id>\w+):\W+(?P<measurement>\d+\.\d+)" |
447 | |
448 | streaminst = TestInstaller(INSTALLSTEPS, deps=DEPS, url=URL) |
449 | -streamrun = TestRunner(RUNSTEPS) |
450 | +streamrun = TestRunner(RUNSTEPS,default_options=DEFAULT_OPTIONS) |
451 | streamparser = TestParser(PATTERN, |
452 | appendall={'units':'MB/s', 'result':'pass'}) |
453 | testobj = Test(test_id="stream", installer=streaminst, |
454 | |
455 | === modified file 'lava_test/test_definitions/tiobench.py' |
456 | --- lava_test/test_definitions/tiobench.py 2011-09-12 09:19:10 +0000 |
457 | +++ lava_test/test_definitions/tiobench.py 2011-10-20 12:16:24 +0000 |
458 | @@ -31,11 +31,11 @@ |
459 | VERSION="0.3.3" |
460 | URL="http://prdownloads.sourceforge.net/tiobench/tiobench-%s.tar.gz" %(VERSION) |
461 | MD5="bf485bf820e693c79e6bd2a38702a128" |
462 | +DEFAULT_OPTIONS = "--block=4096 --block=8192 --threads=2 --numruns=2" |
463 | INSTALLSTEPS = ['tar -zxvf tiobench-%s.tar.gz' % VERSION, |
464 | 'cd tiobench-%s && make' % VERSION] |
465 | RUNSTEPS = ["cd tiobench-%s && "\ |
466 | - "./tiobench.pl --block=4096 --block=8192 --threads=2 "\ |
467 | - "--numruns=2" % (VERSION)] |
468 | + "./tiobench.pl $(OPTIONS)" % (VERSION)] |
469 | |
470 | |
471 | class TIObenchTestParser(TestParser): |
472 | @@ -70,7 +70,7 @@ |
473 | |
474 | tiobench_inst = TestInstaller(INSTALLSTEPS, url=URL, |
475 | md5=MD5) |
476 | -tiobench_run = TestRunner(RUNSTEPS) |
477 | +tiobench_run = TestRunner(RUNSTEPS,default_options=DEFAULT_OPTIONS) |
478 | parse = TIObenchTestParser(appendall={'units':'MB/s', 'result':'pass'}) |
479 | testobj = Test(test_id="tiobench", test_version=VERSION, |
480 | installer=tiobench_inst, runner=tiobench_run, parser=parse) |
481 | |
482 | === modified file 'lava_test/test_definitions/x11perf.py' |
483 | --- lava_test/test_definitions/x11perf.py 2011-09-12 09:19:10 +0000 |
484 | +++ lava_test/test_definitions/x11perf.py 2011-10-20 12:16:24 +0000 |
485 | @@ -46,11 +46,12 @@ |
486 | "-scroll500", |
487 | ] |
488 | |
489 | -RUNSTEPS = ["x11perf %s %s" % (x11perf_options, " ".join(x11perf_tests))] |
490 | +DEFAULT_OPTIONS = "%s %s" % (x11perf_options, " ".join(x11perf_tests)) |
491 | +RUNSTEPS = ["x11perf $(OPTIONS)"] |
492 | PATTERN = "trep @.*\(\W*(?P<measurement>\d+.\d+)/sec\):\W+(?P<test_case_id>.+)" |
493 | |
494 | inst = TestInstaller(deps=["x11-apps"]) |
495 | -run = TestRunner(RUNSTEPS) |
496 | +run = TestRunner(RUNSTEPS,default_options=DEFAULT_OPTIONS) |
497 | parse = TestParser(PATTERN, |
498 | appendall={'units':'reps/s', |
499 | 'result':'pass'}) |
500 | |
501 | === modified file 'lava_test/test_definitions/xrestop.py' |
502 | --- lava_test/test_definitions/xrestop.py 2011-09-23 08:10:25 +0000 |
503 | +++ lava_test/test_definitions/xrestop.py 2011-10-20 12:16:24 +0000 |
504 | @@ -19,11 +19,12 @@ |
505 | from lava_test.core.tests import Test |
506 | |
507 | INSTALLSTEPS = ['bzr branch lp:~linaro-foundations/lava-test/xrestopscript'] |
508 | -RUNSTEPS = ["./xrestopscript/xrestop.sh"] |
509 | +RUNSTEPS = ["./xrestopscript/xrestop.sh $(OPTIONS)"] |
510 | PATTERN = "^(?P<test_case_id>\w+):\W+(?P<measurement>\d+)" |
511 | +DEFAULT_OPTIONS = "" |
512 | |
513 | xrestopinst = TestInstaller(INSTALLSTEPS, deps=["xrestop"]) |
514 | -xrestoprun = TestRunner(RUNSTEPS) |
515 | +xrestoprun = TestRunner(RUNSTEPS,default_options=DEFAULT_OPTIONS) |
516 | xrestopparser = TestParser(PATTERN, |
517 | appendall={'units':'KB', 'result':'pass'}) |
518 | testobj = Test(test_id="xrestop", installer=xrestopinst, |
This will require modifications to all of those tests of course, not just peacekeeper... so I'm assuming this is just an example and not meant to be ready yet right? Also, there will of course need to be a dispatcher change to make use of this.
32 + parser. add_argument( "test_options" ,
33 + help="Override the default test options by this test options. \n"
34 + "Example : lava-test run peacekeeper firefox")
35 +
I think we should specify a -/-- option name for this rather than taking all the extra args off the command line. It makes it more clear with passing other options to the lava-test run command.
Also, we could use either that option with no arguments if it makes sense, or add another option for displaying the default commandline use with that test.