3 # Permission is hereby granted, free of charge, to any person
4 # obtaining a copy of this software and associated documentation
5 # files (the "Software"), to deal in the Software without
6 # restriction, including without limitation the rights to use,
7 # copy, modify, merge, publish, distribute, sublicense, and/or
8 # sell copies of the Software, and to permit persons to whom the
9 # Software is furnished to do so, subject to the following
12 # This permission notice shall be included in all copies or
13 # substantial portions of the Software.
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
16 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
17 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
18 # PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR(S) BE
19 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20 # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
21 # OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 # DEALINGS IN THE SOFTWARE.
27 from core
import checkDir
, testBinDir
, Test
, TestResult
29 #############################################################################
30 ##### GleanTest: Execute a sub-test of Glean
31 #############################################################################
32 def gleanExecutable():
33 return testBinDir
+ 'glean'
36 return os
.path
.join('.', 'results', 'glean')
38 class GleanTest(Test
):
41 def __init__(self
, name
):
47 results
= TestResult()
49 fullenv
= os
.environ
.copy()
51 fullenv
[e
] = str(self
.env
[e
])
53 checkDir(os
.path
.join(gleanResultDir(), self
.name
), False)
55 glean
= subprocess
.Popen(
56 [gleanExecutable(), "-r", os
.path
.join(gleanResultDir(), self
.name
),
59 "-t", "+"+self
.name
] + GleanTest
.globalParams
,
60 stdout
=subprocess
.PIPE
,
61 stderr
=subprocess
.PIPE
,
63 universal_newlines
=True
66 out
, err
= glean
.communicate()
68 results
['result'] = 'pass'
69 if glean
.returncode
!= 0 or out
.find('FAIL') >= 0:
70 results
['result'] = 'fail'
72 results
['returncode'] = glean
.returncode
74 self
.handleErr(results
, err
)
76 results
['info'] = "@@@Returncode: %d\n\nErrors:\n%s\n\nOutput:\n%s" % (glean
.returncode
, err
, out
)