Mercurial > hg > graal-jvmci-8
comparison mx/sanitycheck.py @ 4225:339cf8d4904d
Made mx.run work properly when stderr is redirected to stdout.
Made outputparser redirect stderr to stdout.
Added copyright headers to outputparser.py and sanitycheck.py.
Reverted class path construction in mx.build() to use includeSelf=True to fix regression when running 'mx build -c'.
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 05 Jan 2012 11:31:46 +0100 |
parents | 47f7d91d34cf |
children | e872562f95f8 |
comparison
equal
deleted
inserted
replaced
4224:26336f60ec7a | 4225:339cf8d4904d |
---|---|
1 # ---------------------------------------------------------------------------------------------------- | |
2 # | |
3 # Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. | |
4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
5 # | |
6 # This code is free software; you can redistribute it and/or modify it | |
7 # under the terms of the GNU General Public License version 2 only, as | |
8 # published by the Free Software Foundation. | |
9 # | |
10 # This code is distributed in the hope that it will be useful, but WITHOUT | |
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
13 # version 2 for more details (a copy is included in the LICENSE file that | |
14 # accompanied this code). | |
15 # | |
16 # You should have received a copy of the GNU General Public License version | |
17 # 2 along with this work; if not, write to the Free Software Foundation, | |
18 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
19 # | |
20 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
21 # or visit www.oracle.com if you need additional information or have any | |
22 # questions. | |
23 # | |
24 # ---------------------------------------------------------------------------------------------------- | |
25 | |
1 from outputparser import OutputParser, Matcher | 26 from outputparser import OutputParser, Matcher |
2 import re | 27 import re |
3 import mx | 28 import mx |
4 import os | 29 import os |
5 import commands | 30 import commands |
60 tests = [] | 85 tests = [] |
61 tests.append(Test("Bootstrap", "Bootstrap", ['-version'], succesREs=[time], scoreMatchers=[scoreMatcher])) | 86 tests.append(Test("Bootstrap", "Bootstrap", ['-version'], succesREs=[time], scoreMatchers=[scoreMatcher])) |
62 tests.append(Test("Bootstrap", "Bootstrap-bigHeap", ['-version'], succesREs=[time], scoreMatchers=[scoreMatcher], vmOpts=['-Xms2g'])) | 87 tests.append(Test("Bootstrap", "Bootstrap-bigHeap", ['-version'], succesREs=[time], scoreMatchers=[scoreMatcher], vmOpts=['-Xms2g'])) |
63 return tests | 88 return tests |
64 | 89 |
90 """ | |
91 Encapsulates a single program that is a sanity test and/or a benchmark. | |
92 """ | |
65 class Test: | 93 class Test: |
66 def __init__(self, name, group, cmd, succesREs=[], failureREs=[], scoreMatchers=[], vmOpts=[]): | 94 def __init__(self, name, group, cmd, successREs=[], failureREs=[], scoreMatchers=[], vmOpts=[]): |
67 self.name = name | 95 self.name = name |
68 self.group = group | 96 self.group = group |
69 self.succesREs = succesREs | 97 self.successREs = successREs |
70 self.failureREs = failureREs | 98 self.failureREs = failureREs |
71 self.scoreMatchers = scoreMatchers | 99 self.scoreMatchers = scoreMatchers |
72 self.vmOpts = vmOpts | 100 self.vmOpts = vmOpts |
73 self.cmd = cmd | 101 self.cmd = cmd |
74 | 102 |
75 def test(self, vm, cwd=None, opts=[], vmbuild=None): | 103 def test(self, vm, cwd=None, opts=[], vmbuild=None): |
104 """ | |
105 Run this program as a sanity test. | |
106 """ | |
76 parser = OutputParser(nonZeroIsFatal = False) | 107 parser = OutputParser(nonZeroIsFatal = False) |
77 jvmError = re.compile(r"(?P<jvmerror>([A-Z]:|/).*[/\\]hs_err_pid[0-9]+\.log)") | 108 jvmError = re.compile(r"(?P<jvmerror>([A-Z]:|/).*[/\\]hs_err_pid[0-9]+\.log)") |
78 parser.addMatcher(Matcher(jvmError, {'const:jvmError' : 'jvmerror'})) | 109 parser.addMatcher(Matcher(jvmError, {'const:jvmError' : 'jvmerror'})) |
79 | 110 |
80 for succesRE in self.succesREs: | 111 for successRE in self.successREs: |
81 parser.addMatcher(Matcher(succesRE, {'const:passed' : 'const:1'})) | 112 parser.addMatcher(Matcher(successRE, {'const:passed' : 'const:1'})) |
82 for failureRE in self.failureREs: | 113 for failureRE in self.failureREs: |
83 parser.addMatcher(Matcher(failureRE, {'const:failed' : 'const:1'})) | 114 parser.addMatcher(Matcher(failureRE, {'const:failed' : 'const:1'})) |
84 | 115 |
85 result = parser.parse(vm, self.vmOpts + opts + self.cmd, cwd, vmbuild) | 116 result = parser.parse(vm, self.vmOpts + opts + self.cmd, cwd, vmbuild) |
86 | 117 |
102 return False | 133 return False |
103 | 134 |
104 return result['retcode'] is 0 and parsed.has_key('passed') and parsed['passed'] is '1' | 135 return result['retcode'] is 0 and parsed.has_key('passed') and parsed['passed'] is '1' |
105 | 136 |
106 def bench(self, vm, cwd=None, opts=[], vmbuild=None): | 137 def bench(self, vm, cwd=None, opts=[], vmbuild=None): |
138 """ | |
139 Run this program as a benchmark. | |
140 """ | |
107 parser = OutputParser(nonZeroIsFatal = False) | 141 parser = OutputParser(nonZeroIsFatal = False) |
108 | 142 |
109 for scoreMatcher in self.scoreMatchers: | 143 for scoreMatcher in self.scoreMatchers: |
110 parser.addMatcher(scoreMatcher) | 144 parser.addMatcher(scoreMatcher) |
111 | 145 |