Verilator

Форк
0
/
actual_fail 
53 строки · 1.6 Кб
1
#!/usr/bin/env python3
2
# pylint: disable=C0103,C0114,C0115,C0116,C0321,R0911
3
######################################################################
4
# DESCRIPTION: Fuzzer result checker
5
#
6
# Copyright 2019-2019 by Eric Rippey. This program is free software; you
7
# can redistribute it and/or modify it under the terms of either the GNU Lesser
8
# General Public License Version 3 or the Perl Artistic License Version 2.0.
9
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
10
######################################################################
11

12
# This script is designed to rerun examples to see whether they have
13
# unexpected types of output besides the ones that afl-fuzz detects as
14
# such.
15

16
from glob import glob
17
from subprocess import getstatusoutput
18
from argparse import ArgumentParser
19

20

21
def interesting(s):
22
    if 'assert' in s: return 1
23
    if 'Assert' in s: return 1
24
    if 'Aborted' in s: return 1
25
    if 'terminate' in s:
26
        if 'unterminated' in s:
27
            return 0
28
        return 1
29
    if 'Segmentation' in s:
30
        return 1
31
    if 'internal error' in s:
32
        return 1
33
    return 0
34

35

36
def main():
37
    p = ArgumentParser()
38
    p.add_argument('--dir', default='out1/queue')
39
    args = p.parse_args()
40

41
    for infile in glob(args.dir + '/*'):
42
        # Input filenames are known not to contain spaces or other unusual
43
        # characters, therefore this works.
44
        status, output = getstatusoutput('../../bin/verilator_bin --cc ' +
45
                                         infile)
46
        if interesting(output):
47
            print(infile)
48
            print(status)
49
            print(output)
50

51

52
if __name__ == '__main__':
53
    main()
54

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.