added class type
[swftools.git] / lib / as3 / runtests.py
index 3947f33..ba3b033 100644 (file)
@@ -44,7 +44,9 @@ def check(s):
                 return 0
             if not row:
                 row = [0]*len
-            row[nr-1] = len
+            if row[nr-1]:
+                return 0
+            row[nr-1] = 1
         elif line == "ok":
             ok = 1
     if ok:
@@ -53,7 +55,7 @@ def check(s):
         return 0 not in row
     return 0
 
-def runcmd(cmd,args,output,wait):
+def runcmd(cmd,args,wait):
     #fo = open(tempfile, "wb")
     fo= os.tmpfile()
     p = subprocess.Popen([cmd] + args, executable=cmd, stdout=fo, stderr=fo)
@@ -70,7 +72,6 @@ def runcmd(cmd,args,output,wait):
     fo.seek(0)
     output = fo.read()
     fo.close()
-
     return ret,output
 
 class Test:
@@ -86,14 +87,18 @@ class Test:
             self.run()
 
     def compile(self):
-        ret,output = runcmd("./parser",[self.file],"/tmp/abctest.txt",wait=60)
+        try: os.unlink("abc.swf");
+        except: pass
+        ret,output = runcmd("./parser",[self.file],wait=60)
         self.compile_error = 0
         self.compile_output = output
-        if ret&0xff00:
+        if ret:
+            self.compile_error = 1
+        if not os.path.isfile("abc.swf"):
             self.compile_error = 1
 
     def run(self):
-        ret,output = runcmd("flashplayer",["abc.swf"],"/tmp/abctest.txt",wait=1)
+        ret,output = runcmd("flashplayer",["abc.swf"],wait=1)
         os.system("killall flashplayer")
         self.flash_output = output
         
@@ -125,8 +130,10 @@ class Test:
     def doprintlong(self):
         print self.nr, self.file
         print "================================"
+        print "compile:", (test.compile_error and "error" or "ok")
         print test.compile_output
         print "================================"
+        print "run:", (test.flash_error and "error" or "ok")
         print test.flash_output
         print "================================"