Skip to content

Commit

Permalink
Change fuzzers to check for specific exit codes.
Browse files Browse the repository at this point in the history
  • Loading branch information
chfoo committed Feb 20, 2015
1 parent ef5e19c commit 1c02476
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
11 changes: 10 additions & 1 deletion test/fuzz_fusil/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,15 @@ def mangle_data(self, data, config):
return mangler.data


class WatchProcessSpecificStatusCode(WatchProcess):
def computeScore(self, status):
if status in (4, 6, 7, 8):
print('Change status', status, 'to 0.')
status = 0

return WatchProcess.computeScore(self, status)


class Fuzzer(Application):
def setupProject(self):
self.project.debugger.enabled = False
Expand All @@ -171,7 +180,7 @@ def setupProject(self):
os.path.abspath(os.path.dirname(__file__)), '..', '..')
)

WatchProcess(process, exitcode_score=0.45)
WatchProcessSpecificStatusCode(process)
stdout_watcher = WatchStdout(process)
stdout_watcher.ignoreRegex(
r'WARNING Invalid content length: invalid literal for int'
Expand Down
11 changes: 10 additions & 1 deletion test/fuzz_fusil_2/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@
from fusil.process.watch import WatchProcess


class WatchProcessSpecificStatusCode(WatchProcess):
def computeScore(self, status):
if status in (4, 6, 7, 8):
print('Change status', status, 'to 0.')
status = 0

return WatchProcess.computeScore(self, status)


class Fuzzer(Application):
def setupProject(self):
self.project.debugger.enabled = False
Expand Down Expand Up @@ -67,7 +76,7 @@ def setupProject(self):
process.env.set('OBJGRAPH_DEBUG', '1')
process.env.set('FILE_LEAK_DEBUG', '1')

WatchProcess(process, exitcode_score=0.45)
WatchProcessSpecificStatusCode(process)
stdout_watcher = WatchStdout(process)
stdout_watcher.max_nb_line = None
stdout_watcher.ignoreRegex(
Expand Down

0 comments on commit 1c02476

Please sign in to comment.