-
Notifications
You must be signed in to change notification settings - Fork 0
/
reduce_one.py
executable file
·40 lines (34 loc) · 1.24 KB
/
reduce_one.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/python3
# reduce_one.py reducer testfile
# Reduce a single standalone test via the specified reducer, and add the
# fully reduced result back to the corpus. Uses configuration state from
# config.json
#
# IMPORTANT: Assumes (but does not check) that binaries in build-dir
# correspond to a build of the source at revision.
import tempfile
from common import *
import os
import shutil
reducer = sys.argv[1]
test = os.path.abspath(sys.argv[2])
config = load_and_validate_comfig()
revision = config["LLVM_BUILD_REVISION"]
builddir = config["LLVM_BUILD_DIR"]
corpusdir = os.path.abspath(config["CORPUS_DIR"])
if reducer.endswith("-crash-unconstrained"):
reducer = reducer[0:len(reducer)-len("-crash-unconstrained")]
print (reducer)
pass
if reducer == "llvm-reduce":
reduce_with_llvm_reduce(builddir, corpusdir, test)
elif reducer == "bugpoint":
reduce_with_bugpoint(builddir, corpusdir, test)
elif reducer == "creduce":
reduce_with_creduce(builddir, corpusdir, test)
elif reducer == "opt-analysis-isolate-crash-unconstrained":
vary_opt_pass(builddir, corpusdir, test)
elif reducer == "clang-to-opt":
convert_clang_test_to_opt_test(builddir, corpusdir, test)
else:
print ("Unsupported reducer: %s" % reducer)