You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by go...@apache.org on 2012/12/01 02:11:14 UTC

svn commit: r1415903 - in /incubator/flex/falcon/trunk: ./ compiler.tests/ compiler.tests/feature-tests/mxml/tags/

Author: gordonsmith
Date: Sat Dec  1 01:11:13 2012
New Revision: 1415903

URL: http://svn.apache.org/viewvc?rev=1415903&view=rev
Log:
Falcon: The MXML feature tests now run the SWF in the debug FlashPlayer and check whether the SWF terminates normally with System.exit(0) or with an abnormal exit code.

The tests for <Boolean>, <int>, <uint>, <Number>, <String>, <Class>, and generic instance tags like <Sprite> are passing in Eclipse, demonstrating correct codegen of various simple values. They are not yet part of 'ant tests'.

In Falcon, 'ant eclipse' now copies the player specified by the environment variable FLASHPLAYER_DEBUGGER to the compiler.tests/temp folder so that JUnit tests running in Eclipse can find it.

I updated the README to explain that you need to set FLASHPLAYER_DEBUGGER.

Modified:
    incubator/flex/falcon/trunk/README
    incubator/flex/falcon/trunk/build.xml
    incubator/flex/falcon/trunk/compiler.tests/build.xml
    incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLClassTagTests.java
    incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLFeatureTestsBase.java
    incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLInstanceTagTestsBase.java

Modified: incubator/flex/falcon/trunk/README
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/README?rev=1415903&r1=1415902&r2=1415903&view=diff
==============================================================================
--- incubator/flex/falcon/trunk/README (original)
+++ incubator/flex/falcon/trunk/README Sat Dec  1 01:11:13 2012
@@ -6,7 +6,7 @@ Before trying to build Falcon, you must:
 1. Build the the "develop" branch of the SDK at incubator/flex/sdk/branches/develop by doing 'ant main'.
 See the README there for instructions.
 
-2. Set the environment variables JAVA_HOME, ANT_HOME, and PLAYERGLOBAL_HOME as when building the SDK.
+2. Set the environment variables JAVA_HOME, ANT_HOME, PLAYERGLOBAL_HOME, and FLASHPLAYER_DEBUGGER as when building the SDK.
 
 3. Set the environment variable JFLEX_JAR to point to the JAR file for JFlex 1.4.3.
 

Modified: incubator/flex/falcon/trunk/build.xml
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/build.xml?rev=1415903&r1=1415902&r2=1415903&view=diff
==============================================================================
--- incubator/flex/falcon/trunk/build.xml (original)
+++ incubator/flex/falcon/trunk/build.xml Sat Dec  1 01:11:13 2012
@@ -27,6 +27,7 @@
 
     <target name="eclipse" description="Prepares or updates Falcon's project(s) for use in Eclipse. This takes care of generating Java files for lexers, parsers, and BURMs.">
         <ant dir="compiler" target="eclipse"/>
+        <ant dir="compiler.tests" target="eclipse"/>
     </target>
 
     <target name="sdk" description="Produces an SDK at generated/dist/sdk containing both Falcon and the legacy compiler.">

Modified: incubator/flex/falcon/trunk/compiler.tests/build.xml
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/build.xml?rev=1415903&r1=1415902&r2=1415903&view=diff
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/build.xml (original)
+++ incubator/flex/falcon/trunk/compiler.tests/build.xml Sat Dec  1 01:11:13 2012
@@ -26,6 +26,7 @@
     </pathconvert>
 
     <property name="compiler" value="${compiler.tests}/../compiler"/>
+    <property environment="env"/> 
     <property name="sdk" value="${compiler}/generated/dist/sdk"/>
 
     <target name="download" description="Downloads third-party JARs">
@@ -33,6 +34,10 @@
     	<delete dir="${compiler.tests}/in"/>
     </target>
 
+    <target name="eclipse">
+        <copy file="${env.FLASHPLAYER_DEBUGGER}" tofile="${compiler.tests}/temp/FlashPlayer.exe"/>
+    </target>
+
     <target name="jar.tests">
         <java jar="${sdk}/lib/falcon-mxmlc.jar" fork="true"/>
         <java jar="${sdk}/lib/falcon-compc.jar" fork="true"/>

Modified: incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLClassTagTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLClassTagTests.java?rev=1415903&r1=1415902&r2=1415903&view=diff
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLClassTagTests.java (original)
+++ incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLClassTagTests.java Sat Dec  1 01:11:13 2012
@@ -29,7 +29,7 @@ import org.junit.Test;
 public class MXMLClassTagTests extends MXMLInstanceTagTestsBase
 {
     @Test
-    public void MXMLNumberTag_basic()
+    public void MXMLClassTag_basic()
     {
         String[] declarations = new String[]
         {
@@ -37,7 +37,7 @@ public class MXMLClassTagTests extends M
         };
         String[] asserts = new String[]
         {
-            "assertEqual('c1', c1 is Sprite, true);",
+            "assertEqual('c1', c1, Sprite);",
         };
         String mxml = getMXML(declarations, asserts);
         compileAndRun(mxml);

Modified: incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLFeatureTestsBase.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLFeatureTestsBase.java?rev=1415903&r1=1415902&r2=1415903&view=diff
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLFeatureTestsBase.java (original)
+++ incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLFeatureTestsBase.java Sat Dec  1 01:11:13 2012
@@ -41,6 +41,9 @@ public class MXMLFeatureTestsBase
 	private static final String PLAYERGLOBAL_SWC = FilenameNormalization.normalize(SDK + "\\frameworks\\libs\\player\\11.1\\playerglobal.swc");
 	private static final String NAMESPACE_2009 = "http://ns.adobe.com/mxml/2009";
     private static final String MANIFEST_2009 = FilenameNormalization.normalize(SDK + "\\frameworks\\mxml-2009-manifest.xml");
+    
+    // The Ant script for compiler.tests copies a standalone player to the temp directory.
+    private static final String FLASHPLAYER = FilenameNormalization.normalize("temp/FlashPlayer.exe");
 
 	protected void compileAndRun(String mxml)
 	{
@@ -74,6 +77,22 @@ public class MXMLFeatureTestsBase
 		// Check that there were no compilation problems.
 		assertThat(exitCode, is(0));
 		
-		// Coming soon-- run the SWF in the standalone player and check that there are no runtime asserts.
+		// Run the SWF in the standalone player amd wait until the SWF calls System.exit().
+		String swf = FilenameNormalization.normalize(tempMXMLFile.getAbsolutePath());
+		swf = swf.replace(".mxml", ".swf");
+		args = new String[] { FLASHPLAYER, swf };
+		try
+		{
+			Process process = Runtime.getRuntime().exec(args);
+			process.waitFor();
+			exitCode = process.exitValue();
+		}
+		catch (Exception e)
+		{
+			e.printStackTrace();
+		}
+		
+	    // Check that the runtime exit code was 0, meaning that no asserts failed.
+		assertThat(exitCode, is(0));
 	}
 }

Modified: incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLInstanceTagTestsBase.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLInstanceTagTestsBase.java?rev=1415903&r1=1415902&r2=1415903&view=diff
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLInstanceTagTestsBase.java (original)
+++ incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLInstanceTagTestsBase.java Sat Dec  1 01:11:13 2012
@@ -45,11 +45,15 @@ public class MXMLInstanceTagTestsBase ex
             "        private function assertEqual(message:String, actualValue:*, expectedValue:*):void",
             "        {",
             "            if (actualValue !== expectedValue)",
+            "            {",
             "                trace(message, actualValue, expectedValue);",
+            "                System.exit(1);",
+            "            }",
             "        }",
             "        private function enterFrameHandler(event:Event):void",
             "        {",
             "            %2",
+            "            System.exit(0);",
             "        }",
             "    ]]>",
             "    </fx:Script>",