summaryrefslogtreecommitdiff
path: root/Test/houdini
diff options
context:
space:
mode:
authorGravatar Pantazis Deligiannis <pdeligia@me.com>2013-07-07 03:18:00 +0100
committerGravatar Pantazis Deligiannis <pdeligia@me.com>2013-07-07 03:18:00 +0100
commita6ad13aab30cd2bdd9576c74bf58e7e2b9b855d5 (patch)
treeb9a80e38fa71d779069b58f7a023e4ba95c28ef8 /Test/houdini
parent5dcb1f8e4f28db2f449cb318fc8f114e2982cc7c (diff)
added python scripts (work in unix and windows) for testing Z3 and CVC4 to many of the test suite dirs
Diffstat (limited to 'Test/houdini')
-rwxr-xr-xTest/houdini/runtest.py72
1 files changed, 72 insertions, 0 deletions
diff --git a/Test/houdini/runtest.py b/Test/houdini/runtest.py
new file mode 100755
index 00000000..89b38404
--- /dev/null
+++ b/Test/houdini/runtest.py
@@ -0,0 +1,72 @@
+#!/usr/bin/python
+
+# 2013 Pantazis Deligiannis
+#
+# runs the test cases of this directory
+
+import sys;
+import os;
+import getopt;
+
+MONO = "/usr/bin/mono "
+BOOGIE = "/Users/pantazis/workspace/boogie/Binaries/Boogie.exe "
+
+PROVER_OPTIONS_Z3 = "/nologo "
+PROVER_OPTIONS_CVC4 = "/proverOpt:SOLVER=cvc4 /nologo "
+
+# choose a parser
+opts, args = getopt.getopt(sys.argv[1:], "s:", ["solver="])
+solver = "Z3"
+for o, a in opts:
+ if o in ("-s", "--solver"):
+ if a == "cvc4":
+ solver = a
+
+# if the Output file exists remove it
+if os.path.exists("Output"):
+ os.remove("Output")
+
+# runs the given test
+def runtest(filename):
+ if solver == "cvc4":
+ if os.name == "nt":
+ command = BOOGIE + PROVER_OPTIONS_CVC4 + filename
+ else:
+ command = MONO + BOOGIE + PROVER_OPTIONS_CVC4 + filename
+ else:
+ if os.name == "nt":
+ command = BOOGIE + PROVER_OPTIONS_Z3 + filename
+ else:
+ command = MONO + BOOGIE + PROVER_OPTIONS_Z3 + filename
+
+ print "===== Testing: " + filename
+
+ if os.path.exists("Output"):
+ os.system(command + " >> Output")
+ else:
+ os.system(command + " > Output")
+
+files = ["houd1.bpl", "houd2.bpl", "houd3.bpl", "houd4.bpl", "houd5.bpl", "houd6.bpl", "houd7.bpl", "houd8.bpl", "houd9.bpl", "houd10.bpl", "houd11.bpl", "houd12.bpl"]
+
+for file in files:
+ os.system("echo >> Output")
+ os.system("echo -------------------- " + file + " -------------------- >> Output")
+ runtest("/noinfer /contractInfer /printAssignment " + file)
+
+files = ["test1.bpl", "test2.bpl", "test7.bpl", "test8.bpl", "test9.bpl", "test10.bpl"]
+
+for file in files:
+ os.system("echo . >> Output")
+ os.system("echo -------------------- " + file + " -------------------- >> Output")
+ runtest("/noinfer /contractInfer /printAssignment /inlineDepth:1 " + file)
+
+# compare the output with the expected answers
+test_file = open("Output").readlines()
+correct_file = open("Answer").readlines()
+
+for test, correct in zip(test_file, correct_file):
+ if test.strip(' \t\n\r') != correct.strip(' \t\n\r'):
+ print "\n===== " + os.getcwd().split(os.sep)[-1] + ": FAILED"
+ break
+else:
+ print "\n===== " + os.getcwd().split(os.sep)[-1] + ": PASSED"