bug 785879: in runtestBase.py add support for asc2 ash entry point (r=trbaker)
authorDan Schaffer <Dan.Schaffer@adobe.com>
Tue, 28 Aug 2012 06:10:05 -0700
changeset 7536 029e4b60bcf39e4edd199ad471b37c1350e2c827
parent 7535 799e18c0d918ea253e23d0227fc28d50ea5aebf6
child 7537 e0e2fbe3381cfb1bf5f20f08b583191e2f5acad7
push id4257
push userdschaffe@adobe.com
push dateThu, 06 Sep 2012 14:36:05 +0000
reviewerstrbaker
bugs785879, 1105699
bug 785879: in runtestBase.py add support for asc2 ash entry point (r=trbaker) CL@1105699
test/util/runtestBase.py
--- a/test/util/runtestBase.py
+++ b/test/util/runtestBase.py
@@ -44,17 +44,17 @@
 # simple script that executes tamarin certification tests.  you have to build the
 # stand-alone, avmplus executable.
 # see http://developer.mozilla.org/en/docs/Tamarin_Build_Documentation
 #
 # this test looks for an executable avmplus shell in
 # %MOZ_SRC/mozilla/js/tamarin/platform/,
 #
 
-import os, sys, getopt, datetime, pipes, glob, itertools, tempfile, string, re, platform, shutil
+import os, sys, getopt, datetime, pipes, glob, itertools, tempfile, string, re, platform, shutil,zipfile
 import subprocess, random
 from os.path import abspath, basename, dirname, exists, isdir, isfile, split, splitext, getmtime
 from os import getcwd,environ
 from datetime import datetime
 from glob import glob
 from sys import argv, exit
 from getopt import getopt
 from itertools import count
@@ -1242,17 +1242,31 @@ class RuntestBase(object):
                     self.ashErrors.append("abc files %s.abc not created" % (testdir))
                     continue
 
                 if self.aotsdk: # ABC compiled, so now AOT compile
                     # Need to figure out how to deal with additional required abc files
                     self.compile_aot(testdir+".abc")
 
         else:  #pexpect available
-            child = pexpect.spawn('"%s" %s -classpath %s macromedia.asc.embedding.Shell' % (self.java, self.javaargs, self.asc))
+            # check asc.jar to look for an entry point into ash, we support either of the following classes:
+            entry1='macromedia.asc.embedding.Shell'
+            entry2='com.adobe.flash.compiler.clients.ASCShell'
+            f=zipfile.ZipFile(self.asc,"r")
+            if any(eachfile.startswith(entry1.replace('.','/')) for eachfile in f.namelist()):
+                entrypoint=entry1
+            elif any(eachfile.startswith(entry2.replace('.','/')) for eachfile in f.namelist()):
+                entrypoint=entry2
+            else:
+                print("ERROR: could not find ash class in %s" % self.asc)
+                self.ashErrors.append("error could not find ash entry point in %s" % self.asc)
+                return
+                
+
+            child = pexpect.spawn('"%s" %s -classpath %s %s' % (self.java, self.javaargs, self.asc,entrypoint))
             child.logfile = None
             child.expect("\(ash\)")
             child.expect("\(ash\)")
 
             for test in tests:
                 self.js_print('compiling %s' % test)
                 (dir, file) = split(test)
                 (testdir, ext) = splitext(test)