git.asbjorn.biz
/
swftools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed compiler warnings
[swftools.git]
/
lib
/
as3
/
test
diff --git
a/lib/as3/test
b/lib/as3/test
index
de4a2e2
..
1100996
100755
(executable)
--- a/
lib/as3/test
+++ b/
lib/as3/test
@@
-28,6
+28,11
@@
import marshal
import select
from optparse import OptionParser
import select
from optparse import OptionParser
+CMD_ARGS=[]
+CMD = "./parser"
+#CMD="as3compile"
+CMD_ARGS=["-o","abc.swf"]
+
def check(s):
row = None
ok = 0
def check(s):
row = None
ok = 0
@@
-42,11
+47,16
@@
def check(s):
if "/" not in line:
return 0
i = line.index('/')
if "/" not in line:
return 0
i = line.index('/')
- nr,len = int(line[3:i]),int(line[i+1:])
- if nr<1 or nr>len:
+ try:
+ nr,l = int(line[3:i]),int(line[i+1:])
+ except ValueError:
+ return 0
+ if nr<1 or nr>l:
return 0
if not row:
return 0
if not row:
- row = [0]*len
+ row = [0]*l
+ elif l != len(row):
+ return 0
if row[nr-1]:
return 0
row[nr-1] = 1
if row[nr-1]:
return 0
row[nr-1] = 1
@@
-70,15
+80,20
@@
def runcmd(cmd,args,wait):
output += os.read(fi, 8192)
if "[exit]" in output:
break
output += os.read(fi, 8192)
if "[exit]" in output:
break
- if "rror" in output:
+ if "== by" in output:
+ ret = -33
break
ret = p.poll()
if ret is not None:
break
ret = p.poll()
if ret is not None:
+ if cmd == "valgrind":
+ # valgrind never returns true
+ ret = 0
break
time.sleep(0.1)
else:
os.kill(p.pid, 9)
os.system("killall -9 %s >/dev/null 2>/dev/null" % cmd)
break
time.sleep(0.1)
else:
os.kill(p.pid, 9)
os.system("killall -9 %s >/dev/null 2>/dev/null" % cmd)
+ ret = -1
fo.close()
if fi in select.select([fi],[],[], 0.01)[0]:
fo.close()
if fi in select.select([fi],[],[], 0.01)[0]:
@@
-98,13
+113,14
@@
class Cache:
try:
self.milestone = marshal.load(open(self.filename_milestone, "rb"))
except IOError:
try:
self.milestone = marshal.load(open(self.filename_milestone, "rb"))
except IOError:
- self.milstone = {}
+ self.milestone = {}
def parse_args(self):
parser = OptionParser()
parser.add_option("-d", "--diff", dest="diff", help="Only run tests that failed the last time",action="store_true")
def parse_args(self):
parser = OptionParser()
parser.add_option("-d", "--diff", dest="diff", help="Only run tests that failed the last time",action="store_true")
- parser.add_option("-a", "--all", dest="all", help="Run all tests (also tests expected fail)",action="store_true")
+ parser.add_option("-a", "--all", dest="all", help="Run all tests (also tests expected to fail)",action="store_true")
parser.add_option("-t", "--tag", dest="tag", help="Mark the current pass/fail statistic as milestone",action="store_true")
parser.add_option("-t", "--tag", dest="tag", help="Mark the current pass/fail statistic as milestone",action="store_true")
+ parser.add_option("-m", "--valgrind", dest="valgrind", help="Run compiler through valgrind",action="store_true")
(options, args) = parser.parse_args()
if args and args[0]=="add":
(options, args) = parser.parse_args()
if args and args[0]=="add":
@@
-119,11
+135,21
@@
class Cache:
self.runtime = 1
if self.tag:
self.all = 1
self.runtime = 1
if self.tag:
self.all = 1
- self.runtime = 5 # allow more time if we're tagging this state
+ self.runtime = 3 # allow more time if we're tagging this state
+
+ if self.valgrind:
+ global CMD,CMD_ARGS
+ CMD_ARGS = [CMD] + CMD_ARGS
+ CMD = "valgrind"
+ self.runtime = 20 # allow even more time for valgrind
self.checknum=-1
self.checknum=-1
+ self.checkfile=None
if len(args):
if len(args):
- self.checknum = int(args[0])
+ try:
+ self.checknum = int(args[0])
+ except ValueError:
+ self.checkfile = args[0]
@staticmethod
def load(filename):
@staticmethod
def load(filename):
@@
-140,14
+166,18
@@
class Cache:
fi.close()
def highlight(self, nr, filename):
fi.close()
def highlight(self, nr, filename):
+ if self.checkfile and filename==self.checkfile:
+ return 1
return self.checknum==nr
def skip_file(self, nr, filename):
if self.checknum>=0 and nr!=self.checknum:
return 1
return self.checknum==nr
def skip_file(self, nr, filename):
if self.checknum>=0 and nr!=self.checknum:
return 1
- if not self.all and self.milestone[filename]!="ok":
+ if self.checkfile and filename!=self.checkfile:
+ return 1
+ if not self.all and self.milestone.get(filename,"new")!="ok":
return 1
return 1
- if self.diff and self.filename2status[filename]=="ok":
+ if self.diff and self.filename2status(filename,"new")=="ok":
return 1
return 0
return 1
return 0
@@
-168,7
+198,7
@@
class TestBase:
def compile(self):
try: os.unlink("abc.swf");
except: pass
def compile(self):
try: os.unlink("abc.swf");
except: pass
- ret,output = runcmd("./parser",[self.file],wait=cache.runtime)
+ ret,output = runcmd(CMD,CMD_ARGS+[self.file],wait=cache.runtime)
self.compile_error = 0
self.compile_output = output
self.exit_status = 0
self.compile_error = 0
self.compile_output = output
self.exit_status = 0
@@
-183,7
+213,7
@@
class TestBase:
return 1
def run(self):
return 1
def run(self):
- ret,output = runcmd("flashplayer",["abc.swf"],wait=cache.runtime)
+ ret,output = runcmd("flashplayer",[os.path.join(os.getcwd(),"abc.swf")],wait=cache.runtime)
os.system("killall flashplayer")
self.flash_output = output
os.system("killall flashplayer")
self.flash_output = output