- Improvements to the testing suite.
This commit is contained in:
parent
f3d94b8e0d
commit
4064d8ca65
@ -36,18 +36,25 @@ def parse(scout):
|
|||||||
# Determine timeout, count states
|
# Determine timeout, count states
|
||||||
nc += 1
|
nc += 1
|
||||||
timeout = False
|
timeout = False
|
||||||
|
localstates = 0
|
||||||
for d in data:
|
for d in data:
|
||||||
if d.startswith("states="):
|
if d.startswith("states="):
|
||||||
st = st + int(d[7:])
|
localstates += int(d[7:])
|
||||||
if d.startswith("time="):
|
if d.startswith("time="):
|
||||||
timeout = True
|
timeout = True
|
||||||
|
|
||||||
# Determine claim status
|
# Only count the states if no timeout (otherwise not
|
||||||
|
# dependable)
|
||||||
if not timeout:
|
if not timeout:
|
||||||
|
st += localstates
|
||||||
|
|
||||||
|
# Determine claim status
|
||||||
tag = data[4]
|
tag = data[4]
|
||||||
if tag == 'Fail':
|
if tag == 'Fail':
|
||||||
ra += 1
|
ra += 1
|
||||||
elif tag == 'Ok':
|
else:
|
||||||
|
if not timeout:
|
||||||
|
if tag == 'Ok':
|
||||||
if l.rfind("proof of correctness") != -1:
|
if l.rfind("proof of correctness") != -1:
|
||||||
rp += 1
|
rp += 1
|
||||||
else:
|
else:
|
||||||
@ -79,7 +86,7 @@ def test_goal_selector(goalselector, options,branchbound):
|
|||||||
|
|
||||||
global hurry
|
global hurry
|
||||||
|
|
||||||
scythertest.set_extra_parameters("--count-states --heuristic=" + str(goalselector))
|
scythertest.add_extra_parameters("--count-states --heuristic=" + str(goalselector))
|
||||||
result = str(goalselector)
|
result = str(goalselector)
|
||||||
plist = protocollist.from_literature()
|
plist = protocollist.from_literature()
|
||||||
np = len(plist)
|
np = len(plist)
|
||||||
@ -90,6 +97,7 @@ def test_goal_selector(goalselector, options,branchbound):
|
|||||||
claims = 0
|
claims = 0
|
||||||
states = 0
|
states = 0
|
||||||
timeouts = 0
|
timeouts = 0
|
||||||
|
undecidedprotocols = []
|
||||||
for p in plist:
|
for p in plist:
|
||||||
(status,scout) = scythertest.default_test([p], \
|
(status,scout) = scythertest.default_test([p], \
|
||||||
int(options.match), \
|
int(options.match), \
|
||||||
@ -101,11 +109,14 @@ def test_goal_selector(goalselector, options,branchbound):
|
|||||||
attacks += ra
|
attacks += ra
|
||||||
bounds += rb
|
bounds += rb
|
||||||
proofs += rp
|
proofs += rp
|
||||||
|
# is something undecided for this protocol?
|
||||||
|
if (rb > 0) or (to > 0):
|
||||||
|
undecidedprotocols += [p]
|
||||||
|
|
||||||
if hurry and (bounds * states) > branchbound:
|
if hurry and (bounds * states) > branchbound:
|
||||||
return (-1,0,0,0,0,0)
|
return (-1,0,0,0,0,0)
|
||||||
|
|
||||||
return (attacks,bounds,proofs,claims,np,states,timeouts)
|
return (attacks,bounds,proofs,claims,np,states,timeouts,undecidedprotocols)
|
||||||
|
|
||||||
# Max
|
# Max
|
||||||
class maxor:
|
class maxor:
|
||||||
@ -177,8 +188,12 @@ def main():
|
|||||||
timeoutsmax = maxor(2)
|
timeoutsmax = maxor(2)
|
||||||
decidemax = maxor(1)
|
decidemax = maxor(1)
|
||||||
|
|
||||||
for g in range(1,16):
|
problems = {}
|
||||||
(ra,rb,rp,nc,np,st,timeouts) = test_goal_selector(g, options,
|
sharedproblems = []
|
||||||
|
firstproblem = True
|
||||||
|
|
||||||
|
for g in range(1,8):
|
||||||
|
(ra,rb,rp,nc,np,st,timeouts,prot_undec) = test_goal_selector(g, options,
|
||||||
boundstatesmax.get())
|
boundstatesmax.get())
|
||||||
|
|
||||||
res = str(g)
|
res = str(g)
|
||||||
@ -205,9 +220,30 @@ def main():
|
|||||||
res = shows (res, statesmax, st)
|
res = shows (res, statesmax, st)
|
||||||
res = shows (res, boundstatesmax, boundstates)
|
res = shows (res, boundstatesmax, boundstates)
|
||||||
|
|
||||||
|
problems[g] = prot_undec
|
||||||
|
if firstproblem:
|
||||||
|
firstproblem = False
|
||||||
|
sharedproblems = prot_undec
|
||||||
|
else:
|
||||||
|
nl = []
|
||||||
|
for p in sharedproblems:
|
||||||
|
if p in prot_undec:
|
||||||
|
nl += [p]
|
||||||
|
sharedproblems = nl
|
||||||
|
|
||||||
print res
|
print res
|
||||||
print
|
print
|
||||||
print "Goal selector scan completed."
|
print "Goal selector scan completed."
|
||||||
|
print
|
||||||
|
print "%i shared problem protocols:" % len(sharedproblems)
|
||||||
|
print sharedproblems
|
||||||
|
print
|
||||||
|
for g in problems.keys():
|
||||||
|
print g,
|
||||||
|
print " has %i extra problems: " % (len(problems[g]) - len(sharedproblems)),
|
||||||
|
print [ p for p in problems[g] if p not in sharedproblems ]
|
||||||
|
print
|
||||||
|
print
|
||||||
|
|
||||||
# Only if main stuff
|
# Only if main stuff
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -140,6 +140,7 @@ def evaluate (argumentstring, inputstring):
|
|||||||
f.close()
|
f.close()
|
||||||
# TODO technically, we should store the status in the
|
# TODO technically, we should store the status in the
|
||||||
# cache file as well. For now, we just return 0 status.
|
# cache file as well. For now, we just return 0 status.
|
||||||
|
#print "Retrieved cached version for [%s]." % argumentstring
|
||||||
return (0,res)
|
return (0,res)
|
||||||
|
|
||||||
# Determine the unique filename for this test
|
# Determine the unique filename for this test
|
||||||
|
@ -117,9 +117,7 @@ def default_arguments(plist,match,bounds):
|
|||||||
|
|
||||||
args += " --plain"
|
args += " --plain"
|
||||||
|
|
||||||
extra = get_extra_parameters()
|
args = get_extra_parameters() + " " + args
|
||||||
if extra != "":
|
|
||||||
args = extra + " " + args
|
|
||||||
return args
|
return args
|
||||||
|
|
||||||
# Yield test results
|
# Yield test results
|
||||||
|
Loading…
Reference in New Issue
Block a user