- Added more scoring levels to the comparative heuristics.
- Added option to override cache.
This commit is contained in:
parent
b831c755f3
commit
46974091dc
@ -30,7 +30,7 @@ def parse(scout):
|
|||||||
|
|
||||||
|
|
||||||
# Test with a goal selector
|
# Test with a goal selector
|
||||||
def test_goal_selector(goalselector):
|
def test_goal_selector(goalselector, options):
|
||||||
import protocollist
|
import protocollist
|
||||||
|
|
||||||
scythertest.set_extra_parameters("--goal-select=" + str(goalselector))
|
scythertest.set_extra_parameters("--goal-select=" + str(goalselector))
|
||||||
@ -43,7 +43,9 @@ def test_goal_selector(goalselector):
|
|||||||
proofs = 0
|
proofs = 0
|
||||||
claims = 0
|
claims = 0
|
||||||
for p in plist:
|
for p in plist:
|
||||||
(status,scout) = scythertest.default_test([p],0,0)
|
(status,scout) = scythertest.default_test([p], \
|
||||||
|
int(options.match), \
|
||||||
|
int(options.bounds))
|
||||||
(ra,rb,rp,nc) = parse(scout)
|
(ra,rb,rp,nc) = parse(scout)
|
||||||
attacks = attacks + ra
|
attacks = attacks + ra
|
||||||
bounds = bounds + rb
|
bounds = bounds + rb
|
||||||
@ -60,18 +62,29 @@ def main():
|
|||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
scythertest.process_default_options(options)
|
scythertest.process_default_options(options)
|
||||||
|
|
||||||
print "G-sel\tAttack\tBound\tProof\tClaims\tScore"
|
print "G-sel\tAttack\tBound\tProof\tClaims\tScore1\tScore2"
|
||||||
print
|
print
|
||||||
for g in range(1,31):
|
score1max = 0
|
||||||
(ra,rb,rp,nc,np) = test_goal_selector(g)
|
score2max = 0
|
||||||
|
|
||||||
# Score: bounds are negative
|
for g in range(1,31):
|
||||||
score = ra + rp - rb
|
(ra,rb,rp,nc,np) = test_goal_selector(g, options)
|
||||||
|
|
||||||
|
# Scores: bounds are negative
|
||||||
|
score1 = ra + rp - rb
|
||||||
|
score2 = ra + rp - (2 * rb)
|
||||||
|
|
||||||
res = str(g)
|
res = str(g)
|
||||||
res = res + "\t" + str(ra) + "\t" + str(rb)
|
res = res + "\t" + str(ra) + "\t" + str(rb)
|
||||||
res = res + "\t" + str(rp) + "\t" + str(nc)
|
res = res + "\t" + str(rp) + "\t" + str(nc)
|
||||||
res = res + "\t" + str(score)
|
res = res + "\t" + str(score1)
|
||||||
|
if score1 >= score1max:
|
||||||
|
score1max = score1
|
||||||
|
res = res + "*"
|
||||||
|
res = res + "\t" + str(score2)
|
||||||
|
if score2 >= score2max:
|
||||||
|
score2max = score2
|
||||||
|
res = res + "*"
|
||||||
print res
|
print res
|
||||||
print
|
print
|
||||||
print "Goal selector scan completed."
|
print "Goal selector scan completed."
|
||||||
|
@ -22,6 +22,7 @@ from tempfile import NamedTemporaryFile, gettempdir
|
|||||||
# Minimum duration for a test to get into the cache (in seconds)
|
# Minimum duration for a test to get into the cache (in seconds)
|
||||||
CacheTimer = 0.1
|
CacheTimer = 0.1
|
||||||
ScytherProgram = "scyther"
|
ScytherProgram = "scyther"
|
||||||
|
RetrieveFromCache = True
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# How to override Scyther program setting
|
# How to override Scyther program setting
|
||||||
@ -35,6 +36,11 @@ def scytheroverride (newprg):
|
|||||||
print "Cannot find any file at", ScytherProgram, " and it cannot be used as a Scyther executable."
|
print "Cannot find any file at", ScytherProgram, " and it cannot be used as a Scyther executable."
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
def cacheoverride ():
|
||||||
|
global RetrieveFromCache
|
||||||
|
|
||||||
|
RetrieveFromCache = False
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# How to call Scyther
|
# How to call Scyther
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
@ -138,7 +144,7 @@ def evaluate (argumentstring, inputstring):
|
|||||||
|
|
||||||
# Determine the unique filename for this test
|
# Determine the unique filename for this test
|
||||||
cachefile = cachefilename(cacheid())
|
cachefile = cachefilename(cacheid())
|
||||||
if os.path.exists(cachefile):
|
if os.path.exists(cachefile) and RetrieveFromCache:
|
||||||
return retrieve_from_cache(cachefile)
|
return retrieve_from_cache(cachefile)
|
||||||
else:
|
else:
|
||||||
return compute_and_cache(cachefile)
|
return compute_and_cache(cachefile)
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#
|
#
|
||||||
import sys
|
import sys
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
from scythercache import evaluate, scytheroverride
|
from scythercache import evaluate, scytheroverride, cacheoverride
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
@ -151,6 +151,10 @@ def default_options(parser):
|
|||||||
parser.add_option("-P","--program", dest="program",
|
parser.add_option("-P","--program", dest="program",
|
||||||
default = "",
|
default = "",
|
||||||
help = "define alternative scyther executable")
|
help = "define alternative scyther executable")
|
||||||
|
parser.add_option("-N","--no-cache", dest="nocache",
|
||||||
|
default = False,
|
||||||
|
action = "store_true",
|
||||||
|
help = "do not use cache mechanism")
|
||||||
|
|
||||||
# Process the default options
|
# Process the default options
|
||||||
def process_default_options(options):
|
def process_default_options(options):
|
||||||
@ -160,7 +164,10 @@ def process_default_options(options):
|
|||||||
if options.extra != "":
|
if options.extra != "":
|
||||||
add_extra_parameters(options.extra)
|
add_extra_parameters(options.extra)
|
||||||
print "Added extra options, now:", get_extra_parameters(options.extra)
|
print "Added extra options, now:", get_extra_parameters(options.extra)
|
||||||
|
if options.nocache:
|
||||||
|
# Do not use cache
|
||||||
|
print "Warning: Disabling cache"
|
||||||
|
cacheoverride ()
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
@ -261,15 +268,15 @@ def main():
|
|||||||
parser = OptionParser()
|
parser = OptionParser()
|
||||||
default_options(parser)
|
default_options(parser)
|
||||||
parser.add_option("-e","--errors", dest="errors",
|
parser.add_option("-e","--errors", dest="errors",
|
||||||
default = "False",
|
default = False,
|
||||||
action = "store_true",
|
action = "store_true",
|
||||||
help = "detect compilation errors for all protocols [in list_all]")
|
help = "detect compilation errors for all protocols [in list_all]")
|
||||||
parser.add_option("-r","--results", dest="results",
|
parser.add_option("-r","--results", dest="results",
|
||||||
default = "False",
|
default = False,
|
||||||
action = "store_true",
|
action = "store_true",
|
||||||
help = "scan for results for all protocols [in list_all]")
|
help = "scan for results for all protocols [in list_all]")
|
||||||
parser.add_option("-t","--timeouts", dest="timeouts",
|
parser.add_option("-t","--timeouts", dest="timeouts",
|
||||||
default = "False",
|
default = False,
|
||||||
action = "store_true",
|
action = "store_true",
|
||||||
help = "scan for timeout errors for all protocols [in list_all]")
|
help = "scan for timeout errors for all protocols [in list_all]")
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
@ -278,11 +285,11 @@ def main():
|
|||||||
process_default_options(options)
|
process_default_options(options)
|
||||||
|
|
||||||
# Subcases
|
# Subcases
|
||||||
if options.errors != "False":
|
if options.errors:
|
||||||
scan_for_errors(options,args)
|
scan_for_errors(options,args)
|
||||||
elif options.results != "False":
|
elif options.results:
|
||||||
scan_for_results(options,args)
|
scan_for_results(options,args)
|
||||||
elif options.timeouts != "False":
|
elif options.timeouts:
|
||||||
scan_for_timeouts(options,args)
|
scan_for_timeouts(options,args)
|
||||||
else:
|
else:
|
||||||
# Not any other switch: just test the list then
|
# Not any other switch: just test the list then
|
||||||
|
Loading…
Reference in New Issue
Block a user