HasUnexpectedOutput() is evaluated two times for each test run.

This fix removes the redundant call to allow heavy text comparisons through overwriting of that method.

R=jkummerow@chromium.org

Review URL: https://codereview.chromium.org/17089003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15162 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
machenbach@chromium.org 2013-06-14 14:57:14 +00:00
parent de71923b20
commit 6a6790be37
4 changed files with 18 additions and 16 deletions

View File

@ -138,14 +138,15 @@ class Runner(object):
self.indicator.AboutToRun(test)
test.output = result[1]
test.duration = result[2]
if test.suite.HasUnexpectedOutput(test):
has_unexpected_output = test.suite.HasUnexpectedOutput(test)
if has_unexpected_output:
self.failed.append(test)
if test.output.HasCrashed():
self.crashed += 1
else:
self.succeeded += 1
self.remaining -= 1
self.indicator.HasRun(test)
self.indicator.HasRun(test, has_unexpected_output)
except KeyboardInterrupt:
pool.terminate()
pool.join()

View File

@ -57,7 +57,7 @@ class ProgressIndicator(object):
def AboutToRun(self, test):
pass
def HasRun(self, test):
def HasRun(self, test, has_unexpected_output):
pass
def PrintFailureHeader(self, test):
@ -111,8 +111,8 @@ class VerboseProgressIndicator(SimpleProgressIndicator):
print 'Starting %s...' % test.GetLabel()
sys.stdout.flush()
def HasRun(self, test):
if test.suite.HasUnexpectedOutput(test):
def HasRun(self, test, has_unexpected_output):
if has_unexpected_output:
if test.output.HasCrashed():
outcome = 'CRASH'
else:
@ -124,11 +124,11 @@ class VerboseProgressIndicator(SimpleProgressIndicator):
class DotsProgressIndicator(SimpleProgressIndicator):
def HasRun(self, test):
def HasRun(self, test, has_unexpected_output):
total = self.runner.succeeded + len(self.runner.failed)
if (total > 1) and (total % 50 == 1):
sys.stdout.write('\n')
if test.suite.HasUnexpectedOutput(test):
if has_unexpected_output:
if test.output.HasCrashed():
sys.stdout.write('C')
sys.stdout.flush()
@ -159,8 +159,8 @@ class CompactProgressIndicator(ProgressIndicator):
def AboutToRun(self, test):
self.PrintProgress(test.GetLabel())
def HasRun(self, test):
if test.suite.HasUnexpectedOutput(test):
def HasRun(self, test, has_unexpected_output):
if has_unexpected_output:
self.ClearLine(self.last_status_length)
self.PrintFailureHeader(test)
stdout = test.output.stdout.strip()
@ -255,10 +255,10 @@ class JUnitTestProgressIndicator(ProgressIndicator):
def AboutToRun(self, test):
self.progress_indicator.AboutToRun(test)
def HasRun(self, test):
self.progress_indicator.HasRun(test)
def HasRun(self, test, has_unexpected_output):
self.progress_indicator.HasRun(test, has_unexpected_output)
fail_text = ""
if test.suite.HasUnexpectedOutput(test):
if has_unexpected_output:
stdout = test.output.stdout.strip()
if len(stdout):
fail_text += "stdout:\n%s\n" % stdout

View File

@ -50,7 +50,7 @@ class EndpointProgress(progress.ProgressIndicator):
self.senderthread = threading.Thread(target=self._SenderThread)
self.senderthread.start()
def HasRun(self, test):
def HasRun(self, test, has_unexpected_output):
# The runners that call this have a lock anyway, so this is safe.
self.results_queue.append(test)
@ -119,6 +119,6 @@ def Execute(workspace, ctx, tests, sock, server):
else:
message = "%s" % e
compression.Send([[-1, message]], sock)
progress_indicator.HasRun(None) # Sentinel to signal the end.
progress_indicator.HasRun(None, None) # Sentinel to signal the end.
progress_indicator.sender_lock.acquire() # Released when sending is done.
progress_indicator.sender_lock.release()

View File

@ -204,14 +204,15 @@ class NetworkedRunner(execution.Runner):
self.context.arch, self.context.mode],
self.local_socket)
self.indicator.AboutToRun(test)
if test.suite.HasUnexpectedOutput(test):
has_unexpected_output = test.suite.HasUnexpectedOutput(test)
if has_unexpected_output:
self.failed.append(test)
if test.output.HasCrashed():
self.crashed += 1
else:
self.succeeded += 1
self.remaining -= 1
self.indicator.HasRun(test)
self.indicator.HasRun(test, has_unexpected_output)
rec.Advance()
peer.runtime = time.time() - start_time
except KeyboardInterrupt: