Skip to content

Instantly share code, notes, and snippets.

@jon-whit
Created November 12, 2015 21:03
Show Gist options
  • Save jon-whit/91edee0a6186a7d426ee to your computer and use it in GitHub Desktop.
Save jon-whit/91edee0a6186a7d426ee to your computer and use it in GitHub Desktop.
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