Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(346)

Side by Side Diff: tools/testrunner/local/execution.py

Issue 1696713002: [test runner] Handle missing files gracefully. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2012 the V8 project authors. All rights reserved. 1 # Copyright 2012 the V8 project authors. All rights reserved.
2 # Redistribution and use in source and binary forms, with or without 2 # Redistribution and use in source and binary forms, with or without
3 # modification, are permitted provided that the following conditions are 3 # modification, are permitted provided that the following conditions are
4 # met: 4 # met:
5 # 5 #
6 # * Redistributions of source code must retain the above copyright 6 # * Redistributions of source code must retain the above copyright
7 # notice, this list of conditions and the following disclaimer. 7 # notice, this list of conditions and the following disclaimer.
8 # * Redistributions in binary form must reproduce the above 8 # * Redistributions in binary form must reproduce the above
9 # copyright notice, this list of conditions and the following 9 # copyright notice, this list of conditions and the following
10 # disclaimer in the documentation and/or other materials provided 10 # disclaimer in the documentation and/or other materials provided
(...skipping 10 matching lines...) Expand all
21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 28
29 import collections 29 import collections
30 import os 30 import os
31 import re
31 import shutil 32 import shutil
32 import sys 33 import sys
33 import time 34 import time
34 35
35 from pool import Pool 36 from pool import Pool
36 from . import commands 37 from . import commands
37 from . import perfdata 38 from . import perfdata
38 from . import statusfile 39 from . import statusfile
39 from . import testsuite 40 from . import testsuite
40 from . import utils 41 from . import utils
42 from ..objects import output
41 43
42 44
43 # Base dir of the v8 checkout. 45 # Base dir of the v8 checkout.
44 BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname( 46 BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(
45 os.path.abspath(__file__))))) 47 os.path.abspath(__file__)))))
46 TEST_DIR = os.path.join(BASE_DIR, "test") 48 TEST_DIR = os.path.join(BASE_DIR, "test")
47 49
48 50
49 class Instructions(object): 51 class Instructions(object):
50 def __init__(self, command, dep_command, test_id, timeout, verbose): 52 def __init__(self, command, dep_command, test_id, timeout, verbose):
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 def Run(self, process_context): 129 def Run(self, process_context):
128 """Executes the job. 130 """Executes the job.
129 131
130 Args: 132 Args:
131 process_context: Process-local information that is initialized by the 133 process_context: Process-local information that is initialized by the
132 executing worker. 134 executing worker.
133 """ 135 """
134 raise NotImplementedError() 136 raise NotImplementedError()
135 137
136 138
139 def SetupProblem(exception, test):
140 stderr = ">>> EXCEPTION: %s\n" % exception
141 match = re.match(r"^.*No such file or directory: '(.*)'$", str(exception))
142 if match:
143 # Extra debuging information when files are claimed missing.
144 f = match.group(1)
145 stderr += ">>> File %s exists? -> %s\n" % (f, os.path.exists(f))
146 return test.id, output.Output(1, False, "", stderr), 0
147
148
137 class TestJob(Job): 149 class TestJob(Job):
138 def __init__(self, test): 150 def __init__(self, test):
139 self.test = test 151 self.test = test
140 152
141 def Run(self, process_context): 153 def Run(self, process_context):
142 # Retrieve a new suite object on the worker-process side. The original 154 try:
143 # suite object isn't pickled. 155 # Retrieve a new suite object on the worker-process side. The original
144 self.test.SetSuiteObject(process_context.suites) 156 # suite object isn't pickled.
145 instr = _GetInstructions(self.test, process_context.context) 157 self.test.SetSuiteObject(process_context.suites)
158 instr = _GetInstructions(self.test, process_context.context)
159 except Exception, e:
160 return SetupProblem(e, self.test)
146 161
147 start_time = time.time() 162 start_time = time.time()
148 if instr.dep_command is not None: 163 if instr.dep_command is not None:
149 dep_output = commands.Execute( 164 dep_output = commands.Execute(
150 instr.dep_command, instr.verbose, instr.timeout) 165 instr.dep_command, instr.verbose, instr.timeout)
151 # TODO(jkummerow): We approximate the test suite specific function 166 # TODO(jkummerow): We approximate the test suite specific function
152 # IsFailureOutput() by just checking the exit code here. Currently 167 # IsFailureOutput() by just checking the exit code here. Currently
153 # only cctests define dependencies, for which this simplification is 168 # only cctests define dependencies, for which this simplification is
154 # correct. 169 # correct.
155 if dep_output.exit_code != 0: 170 if dep_output.exit_code != 0:
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 if self.context.verbose: 379 if self.context.verbose:
365 print text 380 print text
366 sys.stdout.flush() 381 sys.stdout.flush()
367 382
368 383
369 class BreakNowException(Exception): 384 class BreakNowException(Exception):
370 def __init__(self, value): 385 def __init__(self, value):
371 self.value = value 386 self.value = value
372 def __str__(self): 387 def __str__(self):
373 return repr(self.value) 388 return repr(self.value)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698