#!/usr/bin/env python3 # mypy: disallow-untyped-defs # pylint: disable=C0103,C0114,C0115,C0116,C0321,R0911 ###################################################################### # DESCRIPTION: Fuzzer result checker # # SPDX-FileCopyrightText: 2019 Eric Rippey # SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 ###################################################################### # This script is designed to rerun examples to see whether they have # unexpected types of output besides the ones that afl-fuzz detects as # such. from glob import glob from subprocess import getstatusoutput from argparse import ArgumentParser def interesting(s: str) -> bool: if 'assert' in s: return True if 'Assert' in s: return True if 'Aborted' in s: return True if 'terminate' in s: if 'unterminated' in s: return False return True if 'Segmentation' in s: return True if 'internal error' in s: return True return False def main() -> None: p = ArgumentParser() p.add_argument('--dir', default='out1/queue') args = p.parse_args() for infile in glob(args.dir + '/*'): # Input filenames are known not to contain spaces or other unusual # characters, therefore this works. status, output = getstatusoutput('../../bin/verilator_bin --cc ' + infile) if interesting(output): print(infile) print(status) print(output) if __name__ == '__main__': main()