OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2008 the V8 project authors. All rights reserved. | 3 # Copyright 2008 the V8 project authors. All rights reserved. |
4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
6 # met: | 6 # met: |
7 # | 7 # |
8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 for failed in self.failed: | 156 for failed in self.failed: |
157 self.PrintFailureHeader(failed.test) | 157 self.PrintFailureHeader(failed.test) |
158 if failed.output.stderr: | 158 if failed.output.stderr: |
159 print "--- stderr ---" | 159 print "--- stderr ---" |
160 print failed.output.stderr.strip() | 160 print failed.output.stderr.strip() |
161 if failed.output.stdout: | 161 if failed.output.stdout: |
162 print "--- stdout ---" | 162 print "--- stdout ---" |
163 print failed.output.stdout.strip() | 163 print failed.output.stdout.strip() |
164 print "Command: %s" % EscapeCommand(failed.command) | 164 print "Command: %s" % EscapeCommand(failed.command) |
165 if failed.HasCrashed(): | 165 if failed.HasCrashed(): |
166 print "--- CRASHED ---" | 166 print "--- CRASHED ---" |
167 if len(self.failed) == 0: | 167 if len(self.failed) == 0: |
168 print "===" | 168 print "===" |
169 print "=== All tests succeeded" | 169 print "=== All tests succeeded" |
170 print "===" | 170 print "===" |
171 else: | 171 else: |
172 print | 172 print |
173 print "===" | 173 print "===" |
174 print "=== %i tests failed" % len(self.failed) | 174 print "=== %i tests failed" % len(self.failed) |
175 if self.crashed > 0: | 175 if self.crashed > 0: |
176 print "=== %i tests CRASHED" % self.crashed | 176 print "=== %i tests CRASHED" % self.crashed |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 self.ClearLine(self.last_status_length) | 237 self.ClearLine(self.last_status_length) |
238 self.PrintFailureHeader(output.test) | 238 self.PrintFailureHeader(output.test) |
239 stdout = output.output.stdout.strip() | 239 stdout = output.output.stdout.strip() |
240 if len(stdout): | 240 if len(stdout): |
241 print self.templates['stdout'] % stdout | 241 print self.templates['stdout'] % stdout |
242 stderr = output.output.stderr.strip() | 242 stderr = output.output.stderr.strip() |
243 if len(stderr): | 243 if len(stderr): |
244 print self.templates['stderr'] % stderr | 244 print self.templates['stderr'] % stderr |
245 print "Command: %s" % EscapeCommand(output.command) | 245 print "Command: %s" % EscapeCommand(output.command) |
246 if output.HasCrashed(): | 246 if output.HasCrashed(): |
247 print "--- CRASHED ---" | 247 print "--- CRASHED ---" |
248 | 248 |
249 def Truncate(self, str, length): | 249 def Truncate(self, str, length): |
250 if length and (len(str) > (length - 3)): | 250 if length and (len(str) > (length - 3)): |
251 return str[:(length-3)] + "..." | 251 return str[:(length-3)] + "..." |
252 else: | 252 else: |
253 return str | 253 return str |
254 | 254 |
255 def PrintProgress(self, name): | 255 def PrintProgress(self, name): |
256 self.ClearLine(self.last_status_length) | 256 self.ClearLine(self.last_status_length) |
257 elapsed = time.time() - self.start_time | 257 elapsed = time.time() - self.start_time |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 def DidFail(self, output): | 338 def DidFail(self, output): |
339 if self.failed is None: | 339 if self.failed is None: |
340 self.failed = self.IsFailureOutput(output) | 340 self.failed = self.IsFailureOutput(output) |
341 return self.failed | 341 return self.failed |
342 | 342 |
343 def IsFailureOutput(self, output): | 343 def IsFailureOutput(self, output): |
344 return output.exit_code != 0 | 344 return output.exit_code != 0 |
345 | 345 |
346 def GetSource(self): | 346 def GetSource(self): |
347 return "(no source available)" | 347 return "(no source available)" |
348 | 348 |
349 def RunCommand(self, command): | 349 def RunCommand(self, command): |
350 full_command = self.context.processor(command) | 350 full_command = self.context.processor(command) |
351 output = Execute(full_command, self.context, self.context.timeout) | 351 output = Execute(full_command, self.context, self.context.timeout) |
352 return TestOutput(self, full_command, output) | 352 return TestOutput(self, full_command, output) |
353 | 353 |
354 def Run(self): | 354 def Run(self): |
355 return self.RunCommand(self.GetCommand()) | 355 return self.RunCommand(self.GetCommand()) |
356 | 356 |
357 | 357 |
358 class TestOutput(object): | 358 class TestOutput(object): |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 SEM_NOGPFAULTERRORBOX = 0x0002 # Microsoft Platform SDK WinBase.h | 404 SEM_NOGPFAULTERRORBOX = 0x0002 # Microsoft Platform SDK WinBase.h |
405 | 405 |
406 def Win32SetErrorMode(mode): | 406 def Win32SetErrorMode(mode): |
407 prev_error_mode = SEM_INVALID_VALUE | 407 prev_error_mode = SEM_INVALID_VALUE |
408 try: | 408 try: |
409 import ctypes | 409 import ctypes |
410 prev_error_mode = ctypes.windll.kernel32.SetErrorMode(mode); | 410 prev_error_mode = ctypes.windll.kernel32.SetErrorMode(mode); |
411 except ImportError: | 411 except ImportError: |
412 pass | 412 pass |
413 return prev_error_mode | 413 return prev_error_mode |
414 | 414 |
415 def RunProcess(context, timeout, args, **rest): | 415 def RunProcess(context, timeout, args, **rest): |
416 if context.verbose: print "#", " ".join(args) | 416 if context.verbose: print "#", " ".join(args) |
417 popen_args = args | 417 popen_args = args |
418 prev_error_mode = SEM_INVALID_VALUE; | 418 prev_error_mode = SEM_INVALID_VALUE; |
419 if utils.IsWindows(): | 419 if utils.IsWindows(): |
420 popen_args = '"' + subprocess.list2cmdline(args) + '"' | 420 popen_args = '"' + subprocess.list2cmdline(args) + '"' |
421 if context.suppress_dialogs: | 421 if context.suppress_dialogs: |
422 # Try to change the error mode to avoid dialogs on fatal errors. Don't | 422 # Try to change the error mode to avoid dialogs on fatal errors. Don't |
423 # touch any existing error mode flags by merging the existing error mode. | 423 # touch any existing error mode flags by merging the existing error mode. |
424 # See http://blogs.msdn.com/oldnewthing/archive/2004/07/27/198410.aspx. | 424 # See http://blogs.msdn.com/oldnewthing/archive/2004/07/27/198410.aspx. |
(...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1319 for entry in timed_tests[:20]: | 1319 for entry in timed_tests[:20]: |
1320 t = FormatTime(entry.duration) | 1320 t = FormatTime(entry.duration) |
1321 sys.stderr.write("%4i (%s) %s\n" % (index, t, entry.GetLabel())) | 1321 sys.stderr.write("%4i (%s) %s\n" % (index, t, entry.GetLabel())) |
1322 index += 1 | 1322 index += 1 |
1323 | 1323 |
1324 return result | 1324 return result |
1325 | 1325 |
1326 | 1326 |
1327 if __name__ == '__main__': | 1327 if __name__ == '__main__': |
1328 sys.exit(Main()) | 1328 sys.exit(Main()) |
OLD | NEW |