- Fixed error output.

This commit is contained in:
ccremers 2006-08-07 10:52:48 +00:00
parent 720d18415f
commit 3178e8e90c
2 changed files with 13 additions and 21 deletions

View File

@ -41,6 +41,7 @@ class Scyther(object):
self.claims = None self.claims = None
self.errors = None self.errors = None
self.errorcount = 0 self.errorcount = 0
self.run = False
def setInput(self,spdl): def setInput(self,spdl):
self.spdl = spdl self.spdl = spdl
@ -77,6 +78,7 @@ class Scyther(object):
# them. # them.
# TODO for now this simply counts the lines # TODO for now this simply counts the lines
self.errorcount = len(self.errors) self.errorcount = len(self.errors)
print self.errorcount
# close # close
stdout.close() stdout.close()
@ -90,14 +92,18 @@ class Scyther(object):
# no output... # no output...
self.claims = [] self.claims = []
self.run = True
return self.claims return self.claims
def __str__(self): def __str__(self):
if self.claims: if self.run:
s = "" if self.errorcount > 0:
for cl in self.claims: return "%i errors:\n%s" % (self.errorcount, "".join(self.errors))
s += str(cl) + "\n" else:
return s s = "Claim results:\n"
for cl in self.claims:
s += str(cl) + "\n"
return s
else: else:
return "Scyther has not been run yet." return "Scyther has not been run yet."
@ -110,23 +116,9 @@ def basicTest():
# print p.read() # print p.read()
# print p.close() # print p.close()
# confirm("See the dir?") # confirm("See the dir?")
#
print "I don't know what to test now."
# Scyther
x = Scyther()
if sys.platform.startswith('win'):
x.program = os.path.join("bin","Scyther.exe")
if not os.path.isfile(x.program):
print "I can't find the Scyther executable %s" % (x.program)
pw,pr = os.popen2("%s --help" % x.program)
pw.close()
print pr.read()
confirm("Do you see the help?")
x.setFile("ns3.spdl")
x.verify()
print x
confirm("See the output?")
def simpleRun(args): def simpleRun(args):
x = Scyther() x = Scyther()

Binary file not shown.