Jelajahi Sumber

TravisCI: test flash8, in allow_failures.

Andy Li 11 tahun lalu
induk
melakukan
cf845a96dc
2 mengubah file dengan 53 tambahan dan 46 penghapusan
  1. 2 1
      .travis.yml
  2. 51 45
      tests/unit/RunTravis.hx

+ 2 - 1
.travis.yml

@@ -2,6 +2,7 @@ language: node_js
 
 env:
   - TARGET=flash9
+  - TARGET=flash8
   - TARGET=neko
   - TARGET=macro
   - TARGET=php
@@ -9,11 +10,11 @@ env:
   - TARGET=js
   - TARGET=java
   - TARGET=cs
-  # - TARGET=flash8
   # - TARGET=as3
 
 matrix:
   allow_failures:
+    - env: TARGET=flash8
     - env: TARGET=java
     - env: TARGET=cs
 

+ 51 - 45
tests/unit/RunTravis.hx

@@ -15,6 +15,51 @@ class RunTravis {
 		}
 	}
 
+	static function setupFlashPlayerDebugger():Void {
+		Sys.putEnv("DISPLAY", ":99.0");
+		runProcess("sh", ["-e", "/etc/init.d/xvfb", "start"]);
+		Sys.putEnv("AUDIODEV", "null");
+		runProcess("sudo", ["apt-get", "install", "-qq", "libgd2-xpm", "ia32-libs", "ia32-libs-multiarch", "flashplugin-installer", "-y"]);
+		runProcess("wget", ["-nv", "http://fpdownload.macromedia.com/pub/flashplayer/updaters/11/flashplayer_11_sa_debug.i386.tar.gz"]);
+		runProcess("tar", ["-xvf", "flashplayer_11_sa_debug.i386.tar.gz"]);
+		File.saveContent(Sys.getEnv("HOME") + "/mm.cfg", "ErrorReportingEnable=1\nTraceOutputFileEnable=1");
+		runProcess("./flashplayerdebugger", ["-v"]);
+	}
+
+	static function runFlash(flashplayerdebuggerProcess:Process):Void {
+		//wait a little until flashlog.txt is created
+		var flashlogPath = Sys.getEnv("HOME") + "/.macromedia/Flash_Player/Logs/flashlog.txt";
+		for (t in 0...5) {
+			if (FileSystem.exists(flashlogPath))
+				break;
+			else
+				runProcess("sleep", ["2"]); 
+		}				
+		if (!FileSystem.exists(flashlogPath)) {
+			//the flashplayerdebugger should has already exited with some error...
+			Sys.println(flashplayerdebuggerProcess.stdout.readAll().toString());
+			Sys.println(flashplayerdebuggerProcess.stderr.readAll().toString());
+
+			var exitCode = flashplayerdebuggerProcess.exitCode();
+			Sys.println('flashplayerdebuggerProcess exited with $exitCode');
+			Sys.exit(1);
+		}
+
+		//read flashlog.txt continously
+		var traceProcess = new Process("tail", ["-f", "-v", flashlogPath]);
+		var line = "";
+		while (true) {
+			try {
+				line = traceProcess.stdout.readLine();
+				Sys.println(line);
+				if (line.indexOf("SUCCESS: ") >= 0) {
+					Sys.exit(line.indexOf("SUCCESS: true") >= 0 ? 0 : 1);
+				}
+			} catch (e:haxe.io.Eof) {}
+		}
+		Sys.exit(1);
+	}
+
 	static function main():Void {
 		var cwd = Sys.getCwd();
 		switch (Sys.getEnv("TARGET")) {
@@ -56,52 +101,13 @@ class RunTravis {
 				runProcess("haxe", ["compile-cs-unsafe.hxml"]);
 				runProcess("mono", ["cs_unsafe/bin/Test-Debug.exe"]);
 			case "flash9":
-				//setup flash player debugger
-				Sys.putEnv("DISPLAY", ":99.0");
-				runProcess("sh", ["-e", "/etc/init.d/xvfb", "start"]);
-				Sys.putEnv("AUDIODEV", "null");
-				runProcess("sudo", ["apt-get", "install", "-qq", "libgd2-xpm", "ia32-libs", "ia32-libs-multiarch", "flashplugin-installer", "-y"]);
-				runProcess("wget", ["-nv", "http://fpdownload.macromedia.com/pub/flashplayer/updaters/11/flashplayer_11_sa_debug.i386.tar.gz"]);
-				runProcess("tar", ["-xvf", "flashplayer_11_sa_debug.i386.tar.gz"]);
-				File.saveContent(Sys.getEnv("HOME") + "/mm.cfg", "ErrorReportingEnable=1\nTraceOutputFileEnable=1");
-				runProcess("./flashplayerdebugger", ["-v"]);
-				
-				//compile and run
+				setupFlashPlayerDebugger();
 				runProcess("haxe", ["compile-flash9.hxml", "-D", "fdb"]);
-				var flashplayerdebuggerProcess = new Process("./flashplayerdebugger", ["unit9.swf"]);
-
-				//wait a little until flashlog.txt is created
-				var flashlogPath = Sys.getEnv("HOME") + "/.macromedia/Flash_Player/Logs/flashlog.txt";
-				for (t in 0...5) {
-					if (FileSystem.exists(flashlogPath))
-						break;
-					else
-						runProcess("sleep", ["2"]); 
-				}				
-				if (!FileSystem.exists(flashlogPath)) {
-					//the flashplayerdebugger should has already exited with some error...
-					Sys.println(flashplayerdebuggerProcess.stdout.readAll().toString());
-					Sys.println(flashplayerdebuggerProcess.stderr.readAll().toString());
-
-					var exitCode = flashplayerdebuggerProcess.exitCode();
-					Sys.println('flashplayerdebuggerProcess exited with $exitCode');
-					Sys.exit(1);
-				}
-
-				//read flashlog.txt continously
-				var traceProcess = new Process("tail", ["-f", "-v", flashlogPath]);
-				var line = "";
-				while (true) {
-					try {
-						line = traceProcess.stdout.readLine();
-						Sys.println(line);
-						if (line.indexOf("SUCCESS: ") >= 0) {
-							Sys.exit(line.indexOf("SUCCESS: true") >= 0 ? 0 : 1);
-						}
-					} catch (e:haxe.io.Eof) {}
-				}
-				Sys.exit(1);
-				
+				runFlash(new Process("./flashplayerdebugger", ["unit9.swf"]));
+			case "flash8":
+				setupFlashPlayerDebugger();
+				runProcess("haxe", ["compile-flash8.hxml", "-D", "fdb"]);
+				runFlash(new Process("./flashplayerdebugger", ["unit8.swf"]));
 			// case "as3":
 			// 	//install Apache Flex
 			// 	//see https://cwiki.apache.org/confluence/display/FLEX/1.3+Setting+up+Linux+(if+having+trouble)