diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2019-01-19 10:04:05 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2019-01-19 10:04:05 +0000 |
commit | 676fbe8105eeb6ff4bb2ed261cb212fcfdbe7b63 (patch) | |
tree | 02a1ac369cb734d0abfa5000dd86e5b7797e6a74 /utils/modfuzz.py | |
parent | c7e70c433efc6953dc3888b9fbf9f3512d7da2b0 (diff) |
Diffstat (limited to 'utils/modfuzz.py')
-rw-r--r-- | utils/modfuzz.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/utils/modfuzz.py b/utils/modfuzz.py index a6aa1f1a257ab..61ca3272aca56 100644 --- a/utils/modfuzz.py +++ b/utils/modfuzz.py @@ -4,6 +4,7 @@ # 1) Update the 'decls' list below with your fuzzing configuration. # 2) Run with the clang binary as the command-line argument. +from __future__ import absolute_import, division, print_function import random import subprocess import sys @@ -12,7 +13,7 @@ import os clang = sys.argv[1] none_opts = 0.3 -class Decl: +class Decl(object): def __init__(self, text, depends=[], provides=[], conflicts=[]): self.text = text self.depends = depends @@ -39,7 +40,7 @@ decls = [ Decl('X %(name)s;\n', depends=['X']), ] -class FS: +class FS(object): def __init__(self): self.fs = {} self.prevfs = {} @@ -62,7 +63,7 @@ class FS: fs = FS() -class CodeModel: +class CodeModel(object): def __init__(self): self.source = '' self.modules = {} @@ -97,7 +98,7 @@ def generate(): if not model.fails(): return except KeyboardInterrupt: - print + print() return True sys.stdout.write('\nReducing:\n') @@ -106,7 +107,7 @@ def generate(): try: while True: assert m, 'got a failure with no steps; broken clang binary?' - i = random.choice(range(len(m))) + i = random.choice(list(range(len(m)))) x = m[0:i] + m[i+1:] m2 = CodeModel() for d in x: |