[test] Fix infinite loop and fail result in the num fuzzer

1. Fix infinite loop caused by time based fuzzing
2. Shallow copy of the result to avoid dropping output
by different processor.

Bug: v8:6917
Change-Id: Icf823e853be9d3cc8dfd46ed2fb954979bf02d2f
Reviewed-on: https://chromium-review.googlesource.com/877761
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: Sergiy Byelozyorov <sergiyb@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50737}
This commit is contained in:
Michal Majewski 2018-01-20 16:58:36 +01:00 committed by Commit Bot
parent 69abb960c9
commit df1b44b63f
2 changed files with 12 additions and 11 deletions

View File

@ -119,7 +119,7 @@ class FuzzerProc(base.TestProcProducer):
return
i = 0
while not self._stop or i < self._count:
while (self._fuzz_duration_sec and not self._stop) or i < self._count:
main_index = self._rng.choice(indexes)
_, main_gen = gens[main_index]

View File

@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import copy
import json
import os
import sys
@ -69,25 +70,25 @@ class SimpleProgressIndicator(ProgressIndicator):
def _on_result_for(self, test, result):
# TODO(majeski): Support for dummy/grouped results
if result.has_unexpected_output:
self._failed.append((test, result))
self._failed.append((test, result.cmd, copy.copy(result.output)))
def finished(self):
crashed = 0
print
for test, result in self._failed:
for test, cmd, output in self._failed:
print_failure_header(test)
if result.output.stderr:
if output.stderr:
print "--- stderr ---"
print result.output.stderr.strip()
if result.output.stdout:
print output.stderr.strip()
if output.stdout:
print "--- stdout ---"
print result.output.stdout.strip()
print "Command: %s" % result.cmd.to_string()
if result.output.HasCrashed():
print "exit code: %d" % result.output.exit_code
print output.stdout.strip()
print "Command: %s" % cmd.to_string()
if output.HasCrashed():
print "exit code: %d" % output.exit_code
print "--- CRASHED ---"
crashed += 1
if result.output.HasTimedOut():
if output.HasTimedOut():
print "--- TIMEOUT ---"
if len(self._failed) == 0:
print "==="