Merge lp:~roadmr/checkbox/1400769-piglit-pythonpath into lp:checkbox

Proposed by Daniel Manrique
Status: Merged
Approved by: Sylvain Pineau
Approved revision: 3488
Merged at revision: 3489
Proposed branch: lp:~roadmr/checkbox/1400769-piglit-pythonpath
Merge into: lp:checkbox
Diff against target: 58 lines (+13/-7)
1 file modified
providers/plainbox-provider-checkbox/bin/piglit_test (+13/-7)
To merge this branch: bzr merge lp:~roadmr/checkbox/1400769-piglit-pythonpath
Reviewer Review Type Date Requested Status
Sylvain Pineau (community) Approve
Review via email: mp+244188@code.launchpad.net

Description of the change

Set PYTHONPATH when invoking piglit tests (LP: #1400769)

To post a comment you must log in.
Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

That's indeed the best we can do. +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'providers/plainbox-provider-checkbox/bin/piglit_test'
2--- providers/plainbox-provider-checkbox/bin/piglit_test 2014-03-20 14:01:58 +0000
3+++ providers/plainbox-provider-checkbox/bin/piglit_test 2014-12-09 17:40:09 +0000
4@@ -3,7 +3,7 @@
5 import os
6 import sys
7
8-from argparse import ArgumentParser, FileType
9+from argparse import ArgumentParser
10 from subprocess import check_output, STDOUT
11
12
13@@ -16,9 +16,9 @@
14
15 def run(self):
16 piglit_output = ''
17-
18+
19 log_path = os.path.join(os.environ.get('CHECKBOX_DATA', '.'),
20- 'piglit-results', self._name)
21+ 'piglit-results', self._name)
22
23 run_command = ["piglit-run.py"]
24
25@@ -27,14 +27,20 @@
26
27 run_command.extend(['/usr/share/piglit/tests/all.tests', log_path])
28
29+ piglit_env = dict(os.environ)
30+ if os.path.isdir("/usr/share/piglit"):
31+ piglit_env['PYTHONPATH'] = "/usr/share/piglit"
32+
33 piglit_output = check_output(run_command,
34 universal_newlines=True,
35- stderr=STDOUT)
36+ stderr=STDOUT,
37+ env=piglit_env)
38+
39 # TODO: Capture stderr instead?
40 for line in piglit_output.split('\n'):
41 if ' :: ' in line:
42 self._results[line.split(' :: ')[-1].strip()] = \
43- line.split(' :: ')[-2].strip()
44+ line.split(' :: ')[-2].strip()
45
46 def get_tests_by_status(self, status):
47 """
48@@ -50,8 +56,8 @@
49
50 def main():
51 parser = ArgumentParser("A wrapper script for the Piglit graphics test "
52- "framework which runs the tests and parses the "
53- "results.")
54+ "framework which runs the tests and parses the "
55+ "results.")
56 parser.add_argument("--test", "-t",
57 required=True,
58 action='append',

Subscribers

People subscribed via source and target branches