Created
November 12, 2015 21:03
-
-
Save jon-whit/91edee0a6186a7d426ee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import glob | |
import subprocess | |
import os | |
if __name__ == '__main__': | |
parser = argparse.ArgumentParser(description="Reports svcomp benchmarks which have references to uninitialized memory.") | |
parser.add_argument("--witness-dir", default=".", help="The directory containing the witeness files.") | |
parser.add_argument("--bench-dir", default=".", help="The directory containing the benchmark files.") | |
args = parser.parse_args() | |
""" | |
Compile each benchmark in the supplied directory with the -Wuninitialized flag. | |
If any of the benchmarks have this warning, then compare that benchmark with the | |
list of witness files. If that benchmark has a witness corresponding to a false | |
result, then print out that file. | |
""" | |
benchmarks = glob.glob(args.bench_dir + '/' + "*.[ic]") | |
witnesses = glob.glob(args.witness_dir + '/' + "*.graphml") | |
for file in benchmarks: | |
proc = subprocess.Popen(["clang", "-Wuninitialized", file], stdin=subprocess.PIPE, | |
stdout=subprocess.PIPE, stderr=subprocess.PIPE) | |
output, err = proc.communicate() | |
if "[-Wuninitialized]" in err: | |
benchmark_name = os.path.basename(file) | |
for witness in witnesses: | |
witness_name = os.path.basename(witness) | |
if benchmark_name in witness_name: | |
print file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment