VirtualBox

source: vbox/trunk/src/libs/openssl-3.0.3/fuzz/helper.py@ 95338

Last change on this file since 95338 was 94082, checked in by vboxsync, 3 years ago

libs/openssl-3.0.1: started applying and adjusting our OpenSSL changes to 3.0.1. bugref:10128

  • Property svn:executable set to *
File size: 1.3 KB
Line 
1#!/usr/bin/python
2#
3# Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
4#
5# Licensed under the Apache License 2.0 (the "License"). You may not use
6# this file except in compliance with the License. You can obtain a copy
7# in the file LICENSE in the source distribution or at
8# https://www.openssl.org/source/license.html
9
10"""Fuzzing helper, creates and uses corpus/crash directories.
11
12fuzzer.py <fuzzer> <extra fuzzer arguments>
13"""
14
15import os
16import subprocess
17import sys
18
19FUZZER = sys.argv[1]
20
21THIS_DIR = os.path.abspath(os.path.dirname(__file__))
22CORPORA_DIR = os.path.abspath(os.path.join(THIS_DIR, "corpora"))
23
24FUZZER_DIR = os.path.abspath(os.path.join(CORPORA_DIR, FUZZER))
25if not os.path.isdir(FUZZER_DIR):
26 os.mkdir(FUZZER_DIR)
27
28corpora = []
29
30def _create(d):
31 dd = os.path.abspath(os.path.join(CORPORA_DIR, d))
32 if not os.path.isdir(dd):
33 os.mkdir(dd)
34 corpora.append(dd)
35
36def _add(d):
37 dd = os.path.abspath(os.path.join(CORPORA_DIR, d))
38 if os.path.isdir(dd):
39 corpora.append(dd)
40
41def main():
42 _create(FUZZER)
43 _create(FUZZER + "-crash")
44 _add(FUZZER + "-seed")
45
46 cmd = ([os.path.abspath(os.path.join(THIS_DIR, FUZZER))] + sys.argv[2:]
47 + ["-artifact_prefix=" + corpora[1] + "/"] + corpora)
48 print(" ".join(cmd))
49 subprocess.call(cmd)
50
51if __name__ == "__main__":
52 main()
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette