فهرست منبع

[ci] Prevent random flash test failures (#10999)

* [ci] Use fdb for reading flash test logs

Should be cleaner and more reliable than running a process to print
changes of some log file.

* [ci] Clean up flash setup

* [ci] Enable windows 32 bit flash tests

* [ci] Rename flash9 tests to flash

We don't have any other flash tests anyway
tobil4sk 2 سال پیش
والد
کامیت
45f59a68ea

+ 8 - 8
.github/workflows/main.yml

@@ -348,7 +348,7 @@ jobs:
     strategy:
     strategy:
       fail-fast: false
       fail-fast: false
       matrix:
       matrix:
-        target: [macro, js, hl, cpp, 'java,jvm', cs, php, python, lua, flash9, neko]
+        target: [macro, js, hl, cpp, 'java,jvm', cs, php, python, lua, flash, neko]
         include:
         include:
           - target: hl
           - target: hl
             APT_PACKAGES: cmake ninja-build libturbojpeg-dev
             APT_PACKAGES: cmake ninja-build libturbojpeg-dev
@@ -356,7 +356,7 @@ jobs:
             APT_PACKAGES: gcc-multilib g++-multilib
             APT_PACKAGES: gcc-multilib g++-multilib
           - target: lua
           - target: lua
             APT_PACKAGES: ncurses-dev
             APT_PACKAGES: ncurses-dev
-          - target: flash9
+          - target: flash
             APT_PACKAGES: libglib2.0-0 libfreetype6 xvfb
             APT_PACKAGES: libglib2.0-0 libfreetype6 xvfb
     steps:
     steps:
       - uses: actions/checkout@main
       - uses: actions/checkout@main
@@ -413,7 +413,7 @@ jobs:
           sudo apt install -qqy ${{matrix.APT_PACKAGES}}
           sudo apt install -qqy ${{matrix.APT_PACKAGES}}
 
 
       - name: Flash setup
       - name: Flash setup
-        if: matrix.target == 'flash9'
+        if: matrix.target == 'flash'
         run: export DISPLAY=:99.0
         run: export DISPLAY=:99.0
 
 
       - name: Test
       - name: Test
@@ -673,7 +673,7 @@ jobs:
       fail-fast: false
       fail-fast: false
       matrix:
       matrix:
         # TODO enable lua after https://github.com/HaxeFoundation/haxe/issues/10919
         # TODO enable lua after https://github.com/HaxeFoundation/haxe/issues/10919
-        target: [macro, js, hl, cpp, 'java,jvm', cs, php, python, flash9, neko]
+        target: [macro, js, hl, cpp, 'java,jvm', cs, php, python, flash, neko]
     steps:
     steps:
       - uses: actions/checkout@main
       - uses: actions/checkout@main
         with:
         with:
@@ -733,7 +733,7 @@ jobs:
           call lua53/bin/activate
           call lua53/bin/activate
 
 
       - name: Install wget
       - name: Install wget
-        if: matrix.target == 'flash9'
+        if: matrix.target == 'flash'
         shell: cmd
         shell: cmd
         run: |
         run: |
           choco install wget
           choco install wget
@@ -765,7 +765,7 @@ jobs:
       matrix:
       matrix:
         # TODO jvm: https://github.com/HaxeFoundation/haxe/issues/8601
         # TODO jvm: https://github.com/HaxeFoundation/haxe/issues/8601
         # TODO enable lua after https://github.com/HaxeFoundation/haxe/issues/10919
         # TODO enable lua after https://github.com/HaxeFoundation/haxe/issues/10919
-        target: [macro, js, hl, cpp, java, cs, php, python, neko]
+        target: [macro, js, hl, cpp, java, cs, php, python, flash, neko]
     steps:
     steps:
       - uses: actions/checkout@main
       - uses: actions/checkout@main
         with:
         with:
@@ -825,7 +825,7 @@ jobs:
           call lua53/bin/activate
           call lua53/bin/activate
 
 
       - name: Install wget
       - name: Install wget
-        if: matrix.target == 'flash9'
+        if: matrix.target == 'flash'
         shell: cmd
         shell: cmd
         run: |
         run: |
           choco install wget
           choco install wget
@@ -853,7 +853,7 @@ jobs:
     strategy:
     strategy:
       fail-fast: false
       fail-fast: false
       matrix:
       matrix:
-        target: [macro, js, hl, cpp, 'java,jvm', cs, php, python, flash9, neko]
+        target: [macro, js, hl, cpp, 'java,jvm', cs, php, python, flash, neko]
         include:
         include:
           - target: hl
           - target: hl
             BREW_PACKAGES: ninja
             BREW_PACKAGES: ninja

+ 1 - 1
Earthfile

@@ -386,7 +386,7 @@ test-flash:
     FROM +test-environment-flash
     FROM +test-environment-flash
     ARG GITHUB_ACTIONS
     ARG GITHUB_ACTIONS
     ENV GITHUB_ACTIONS=$GITHUB_ACTIONS
     ENV GITHUB_ACTIONS=$GITHUB_ACTIONS
-    DO +RUN_CI --TEST=flash9
+    DO +RUN_CI --TEST=flash
 
 
 test-all:
 test-all:
     ARG TARGETPLATFORM
     ARG TARGETPLATFORM

+ 1 - 1
extra/github-actions/test-windows.yml

@@ -37,7 +37,7 @@
     call lua53/bin/activate
     call lua53/bin/activate
 
 
 - name: Install wget
 - name: Install wget
-  if: matrix.target == 'flash9'
+  if: matrix.target == 'flash'
   shell: cmd
   shell: cmd
   run: |
   run: |
     choco install wget
     choco install wget

+ 6 - 6
extra/github-actions/workflows/main.yml

@@ -161,7 +161,7 @@ jobs:
     strategy:
     strategy:
       fail-fast: false
       fail-fast: false
       matrix:
       matrix:
-        target: [macro, js, hl, cpp, 'java,jvm', cs, php, python, lua, flash9, neko]
+        target: [macro, js, hl, cpp, 'java,jvm', cs, php, python, lua, flash, neko]
         include:
         include:
           - target: hl
           - target: hl
             APT_PACKAGES: cmake ninja-build libturbojpeg-dev
             APT_PACKAGES: cmake ninja-build libturbojpeg-dev
@@ -169,7 +169,7 @@ jobs:
             APT_PACKAGES: gcc-multilib g++-multilib
             APT_PACKAGES: gcc-multilib g++-multilib
           - target: lua
           - target: lua
             APT_PACKAGES: ncurses-dev
             APT_PACKAGES: ncurses-dev
-          - target: flash9
+          - target: flash
             APT_PACKAGES: libglib2.0-0 libfreetype6 xvfb
             APT_PACKAGES: libglib2.0-0 libfreetype6 xvfb
     steps:
     steps:
       - uses: actions/checkout@main
       - uses: actions/checkout@main
@@ -210,7 +210,7 @@ jobs:
           sudo apt install -qqy ${{matrix.APT_PACKAGES}}
           sudo apt install -qqy ${{matrix.APT_PACKAGES}}
 
 
       - name: Flash setup
       - name: Flash setup
-        if: matrix.target == 'flash9'
+        if: matrix.target == 'flash'
         run: export DISPLAY=:99.0
         run: export DISPLAY=:99.0
 
 
       - name: Test
       - name: Test
@@ -362,7 +362,7 @@ jobs:
       fail-fast: false
       fail-fast: false
       matrix:
       matrix:
         # TODO enable lua after https://github.com/HaxeFoundation/haxe/issues/10919
         # TODO enable lua after https://github.com/HaxeFoundation/haxe/issues/10919
-        target: [macro, js, hl, cpp, 'java,jvm', cs, php, python, flash9, neko]
+        target: [macro, js, hl, cpp, 'java,jvm', cs, php, python, flash, neko]
     steps:
     steps:
       - uses: actions/checkout@main
       - uses: actions/checkout@main
         with:
         with:
@@ -388,7 +388,7 @@ jobs:
       matrix:
       matrix:
         # TODO jvm: https://github.com/HaxeFoundation/haxe/issues/8601
         # TODO jvm: https://github.com/HaxeFoundation/haxe/issues/8601
         # TODO enable lua after https://github.com/HaxeFoundation/haxe/issues/10919
         # TODO enable lua after https://github.com/HaxeFoundation/haxe/issues/10919
-        target: [macro, js, hl, cpp, java, cs, php, python, neko]
+        target: [macro, js, hl, cpp, java, cs, php, python, flash, neko]
     steps:
     steps:
       - uses: actions/checkout@main
       - uses: actions/checkout@main
         with:
         with:
@@ -410,7 +410,7 @@ jobs:
     strategy:
     strategy:
       fail-fast: false
       fail-fast: false
       matrix:
       matrix:
-        target: [macro, js, hl, cpp, 'java,jvm', cs, php, python, flash9, neko]
+        target: [macro, js, hl, cpp, 'java,jvm', cs, php, python, flash, neko]
         include:
         include:
           - target: hl
           - target: hl
             BREW_PACKAGES: ninja
             BREW_PACKAGES: ninja

+ 1 - 1
tests/README.md

@@ -9,7 +9,7 @@ We have a number of test suites, which are placed in their own folders in this d
 It is possible to run it in local machines too:
 It is possible to run it in local machines too:
 
 
  1. Change to this directory.
  1. Change to this directory.
- 2. Define the test target by `export TEST=$TARGET` (or `set "TEST=$TARGET"` on Windows), where `$TARGET` should be a comma-seperated list of targets, e.g. `neko,macro`. Possible targets are `macro`, `neko`, `js`, `lua`, `php`, `cpp`, `cppia`, `flash9`, `java`, `jvm`, `cs`, `python`, and `hl`.
+ 2. Define the test target by `export TEST=$TARGET` (or `set "TEST=$TARGET"` on Windows), where `$TARGET` should be a comma-seperated list of targets, e.g. `neko,macro`. Possible targets are `macro`, `neko`, `js`, `lua`, `php`, `cpp`, `cppia`, `flash`, `java`, `jvm`, `cs`, `python`, and `hl`.
  3. Run the script: `haxe RunCi.hxml`.
  3. Run the script: `haxe RunCi.hxml`.
 
 
 Note that the script will try to look for test dependencies and install them if they are not found. Look at the `getXXXDependencies` functions for the details.
 Note that the script will try to look for test dependencies and install them if they are not found. Look at the `getXXXDependencies` functions for the details.

+ 1 - 1
tests/RunCi.hx

@@ -78,7 +78,7 @@ class RunCi {
 						runci.targets.Jvm.run(args);
 						runci.targets.Jvm.run(args);
 					case Cs:
 					case Cs:
 						runci.targets.Cs.run(args);
 						runci.targets.Cs.run(args);
-					case Flash9:
+					case Flash:
 						runci.targets.Flash.run(args);
 						runci.targets.Flash.run(args);
 					case Hl:
 					case Hl:
 						runci.targets.Hl.run(args);
 						runci.targets.Hl.run(args);

+ 1 - 1
tests/runci/TestTarget.hx

@@ -8,7 +8,7 @@ enum abstract TestTarget(String) from String {
 	var Php = "php";
 	var Php = "php";
 	var Cpp = "cpp";
 	var Cpp = "cpp";
 	var Cppia = "cppia";
 	var Cppia = "cppia";
-	var Flash9 = "flash9";
+	var Flash = "flash";
 	var Java = "java";
 	var Java = "java";
 	var Jvm = "jvm";
 	var Jvm = "jvm";
 	var Cs = "cs";
 	var Cs = "cs";

+ 92 - 116
tests/runci/targets/Flash.hx

@@ -15,34 +15,29 @@ using StringTools;
 
 
 class Flash {
 class Flash {
 	static final miscFlashDir = getMiscSubDir('flash');
 	static final miscFlashDir = getMiscSubDir('flash');
+	static var playerLocation:String;
 
 
-	static function getLatestFPVersion():Array<Int> {
-		final appcast = Xml.parse(haxe.Http.requestUrl("http://fpdownload.macromedia.com/get/flashplayer/update/current/xml/version_en_mac_pep.xml"));
-		final versionStr = new haxe.xml.Access(appcast).node.XML.node.update.att.version;
-		return versionStr.split(",").map(Std.parseInt);
-	}
-
-	static final defaultApacheMirror = "https://downloads.apache.org/";
+	static final DEFAULT_APACHE_MIRROR = "https://downloads.apache.org/";
 
 
 	static function getPreferredApacheMirror() {
 	static function getPreferredApacheMirror() {
 		return try {
 		return try {
 			Json.parse(Http.requestUrl("https://www.apache.org/dyn/closer.lua?as_json=1")).preferred;
 			Json.parse(Http.requestUrl("https://www.apache.org/dyn/closer.lua?as_json=1")).preferred;
 		} catch (e) {
 		} catch (e) {
-			failMsg('Unable to determine preferred Apache mirror. Defaulting to $defaultApacheMirror');
-			defaultApacheMirror;
-		}
+			failMsg('Unable to determine preferred Apache mirror. Defaulting to $DEFAULT_APACHE_MIRROR');
+			DEFAULT_APACHE_MIRROR;
+		};
 	}
 	}
 
 
-	static function downloadFlexSdk(version:String, sdkPath:String):Void {
+	static function downloadAndExtractFlexSdk(version:String, sdkPath:String):Void {
 		final apacheMirror = getPreferredApacheMirror();
 		final apacheMirror = getPreferredApacheMirror();
+		final archiveExtension = if (systemName == "Windows") "zip" else "tar.gz";
+		final archiveName = 'apache-flex-sdk-${version}-bin.$archiveExtension';
+		runNetworkCommand("wget", ["-nv", '${apacheMirror}/flex/${version}/binaries/$archiveName', "-O", getDownloadPath() + '/$archiveName']);
+
 		if (systemName == "Windows") {
 		if (systemName == "Windows") {
-			final zipName = 'apache-flex-sdk-${version}-bin.zip';
-			runNetworkCommand("wget", ["-nv", '${apacheMirror}/flex/${version}/binaries/$zipName', "-O", getDownloadPath() + '/$zipName']);
-			runCommand("7z", ["x", getDownloadPath() + '/$zipName', "-o" + sdkPath, "-y"]);
+			runCommand("7z", ["x", getDownloadPath() + '/$archiveName', "-o" + sdkPath, "-y"]);
 		} else {
 		} else {
-			final tarName = 'apache-flex-sdk-${version}-bin.tar.gz';
-			runNetworkCommand("wget", ["-nv", '${apacheMirror}/flex/${version}/binaries/$tarName', "-O", getDownloadPath() + '/$tarName']);
-			runCommand("tar", ["-xf", getDownloadPath() + '/$tarName', "-C", getInstallPath()]);
+			runCommand("tar", ["-xf", getDownloadPath() + '/$archiveName', "-C", getInstallPath()]);
 		}
 		}
 	}
 	}
 
 
@@ -58,7 +53,7 @@ class Flash {
 		if (FileSystem.exists(flexSdkPath)) {
 		if (FileSystem.exists(flexSdkPath)) {
 			infoMsg('Flex SDK found at $flexSdkPath');
 			infoMsg('Flex SDK found at $flexSdkPath');
 		} else {
 		} else {
-			downloadFlexSdk(flexVersion, flexSdkPath);
+			downloadAndExtractFlexSdk(flexVersion, flexSdkPath);
 		}
 		}
 		addToPATH(flexSdkPath + "/bin");
 		addToPATH(flexSdkPath + "/bin");
 
 
@@ -79,7 +74,6 @@ class Flash {
 				"-O",
 				"-O",
 				playerGlobalSwcPath
 				playerGlobalSwcPath
 			]);
 			]);
-
 		}
 		}
 		// set playerglobal.swc
 		// set playerglobal.swc
 		File.saveContent(flexSdkPath + "/env.properties", 'env.PLAYERGLOBAL_HOME=$playerGlobalSwcFolder');
 		File.saveContent(flexSdkPath + "/env.properties", 'env.PLAYERGLOBAL_HOME=$playerGlobalSwcFolder');
@@ -88,30 +82,30 @@ class Flash {
 		runCommand("mxmlc", ["--version"]);
 		runCommand("mxmlc", ["--version"]);
 	}
 	}
 
 
-	static var playerLocation:String;
-	static var flashlogPath:String;
+	static function getLatestFPVersion():Array<Int> {
+		final appcast = Xml.parse(haxe.Http.requestUrl("http://fpdownload.macromedia.com/get/flashplayer/update/current/xml/version_en_mac_pep.xml"));
+		final versionStr = new haxe.xml.Access(appcast).node.XML.node.update.att.version;
+		return versionStr.split(",").map(Std.parseInt);
+	}
 
 
-	static function createConfigFile(location:String):Void {
-		final mmcfgPath = location + "/mm.cfg";
-		if (!FileSystem.exists(mmcfgPath))
-			File.saveContent(mmcfgPath, "ErrorReportingEnable=1\nTraceOutputFileEnable=1");
+	static function downloadPlayer(version:Int, fileName:String, outputPath:String) {
+		runNetworkCommand("wget", [
+			"-nv",
+			'https://fpdownload.macromedia.com/pub/flashplayer/updaters/$version/$fileName',
+			"-O",
+			'$outputPath/$fileName'
+		]);
 	}
 	}
 
 
-	static function setupFlashDebuggerMac():Void {
+	static function setupFlashPlayerMac():Void {
 		playerLocation = getInstallPath() + "/Flash Player.app";
 		playerLocation = getInstallPath() + "/Flash Player.app";
-		flashlogPath = Sys.getEnv("HOME") + "/Library/Preferences/Macromedia/Flash Player/Logs/flashlog.txt";
 
 
 		if (FileSystem.exists(playerLocation))
 		if (FileSystem.exists(playerLocation))
 			infoMsg('Flash player found at $playerLocation');
 			infoMsg('Flash player found at $playerLocation');
 		else {
 		else {
 			final majorVersion = getLatestFPVersion()[0];
 			final majorVersion = getLatestFPVersion()[0];
-			final packageName = "flashplayer_32_sa_debug.dmg";
-			runNetworkCommand("wget", [
-				"-nv",
-				'https://fpdownload.macromedia.com/pub/flashplayer/updaters/${majorVersion}/$packageName',
-				"-O",
-				getDownloadPath() + '/$packageName'
-			]);
+			final packageName = 'flashplayer_${majorVersion}_sa_debug.dmg';
+			downloadPlayer(majorVersion, packageName, getDownloadPath());
 			runCommand("hdiutil", ["attach", getDownloadPath() + '/$packageName']);
 			runCommand("hdiutil", ["attach", getDownloadPath() + '/$packageName']);
 
 
 			runCommand("cp", ["-R", "/Volumes/Flash Player/Flash Player.app", getInstallPath()]);
 			runCommand("cp", ["-R", "/Volumes/Flash Player/Flash Player.app", getInstallPath()]);
@@ -121,41 +115,24 @@ class Flash {
 			runCommand("xattr", ["-d", "-r", "com.apple.quarantine", playerLocation]);
 			runCommand("xattr", ["-d", "-r", "com.apple.quarantine", playerLocation]);
 		}
 		}
 
 
-		final configLocation = "/Library/Application Support/Macromedia";
-		if (!FileSystem.exists(configLocation)) {
-			runCommand("sudo", ["mkdir", "-p", configLocation]);
-			runCommand("sudo", ["chmod", "a+w", configLocation]);
-		}
-		createConfigFile(configLocation);
-
 		runCommand("open", ["-a", playerLocation, "-v"]);
 		runCommand("open", ["-a", playerLocation, "-v"]);
 	}
 	}
 
 
-	static function setupFlashDebuggerLinux():Void {
-		flashlogPath = Sys.getEnv("HOME") + "/.macromedia/Flash_Player/Logs/flashlog.txt";
-
-		final debuggerName = "flashplayerdebugger";
-		playerLocation = Path.join([getInstallPath(), debuggerName]);
-		if (Sys.command("type", [debuggerName]) == 0) {
-			playerLocation = debuggerName;
-			infoMsg('Using $debuggerName from PATH');
+	static function setupFlashPlayerLinux():Void {
+		final playerName = "flashplayerdebugger";
+		playerLocation = Path.join([getInstallPath(), playerName]);
+		if (Sys.command("type", [playerName]) == 0) {
+			playerLocation = playerName;
+			infoMsg('Using $playerName from PATH');
 		} else if(FileSystem.exists(playerLocation)) {
 		} else if(FileSystem.exists(playerLocation)) {
 			infoMsg('Flash player found at $playerLocation');
 			infoMsg('Flash player found at $playerLocation');
 		} else {
 		} else {
 			Linux.requireAptPackages(["libglib2.0-0", "libfreetype6"]);
 			Linux.requireAptPackages(["libglib2.0-0", "libfreetype6"]);
-			final majorVersion = getLatestFPVersion()[0];
 			final tarFileName = 'flash_player_sa_linux_debug.x86_64.tar.gz';
 			final tarFileName = 'flash_player_sa_linux_debug.x86_64.tar.gz';
-			runNetworkCommand("wget", [
-				"-nv",
-				'https://fpdownload.macromedia.com/pub/flashplayer/updaters/${majorVersion}/$tarFileName',
-				"-O",
-				getDownloadPath() + '/$tarFileName'
-			]);
+			downloadPlayer(getLatestFPVersion()[0], tarFileName, getDownloadPath());
 			runCommand("tar", ["-xf", getDownloadPath() + '/$tarFileName', "-C", getInstallPath()]);
 			runCommand("tar", ["-xf", getDownloadPath() + '/$tarFileName', "-C", getInstallPath()]);
 		}
 		}
 
 
-		createConfigFile(Sys.getEnv("HOME"));
-
 		// ensure the debugger works
 		// ensure the debugger works
 		switch (ci) {
 		switch (ci) {
 			case GithubActions:
 			case GithubActions:
@@ -165,104 +142,103 @@ class Flash {
 		}
 		}
 	}
 	}
 
 
-	static function setupFlashDebuggerWindows():Void {
-		flashlogPath = Sys.getEnv("APPDATA") + "\\Macromedia\\Flash Player\\Logs\\flashlog.txt";
-		final exeName = "flashplayer_32_sa_debug.exe";
+	static function setupFlashPlayerWindows():Void {
+		final majorVersion = getLatestFPVersion()[0];
+		final exeName = 'flashplayer_${majorVersion}_sa_debug.exe';
 		playerLocation = Path.join([getInstallPath(), exeName]);
 		playerLocation = Path.join([getInstallPath(), exeName]);
 
 
-		final majorVersion = getLatestFPVersion()[0];
 		if (FileSystem.exists(playerLocation))
 		if (FileSystem.exists(playerLocation))
 			infoMsg('Flash player found at $playerLocation');
 			infoMsg('Flash player found at $playerLocation');
 		else
 		else
-			runNetworkCommand("wget", [
-				"-nv",
-				'https://fpdownload.macromedia.com/pub/flashplayer/updaters/${majorVersion}/$exeName',
-				"-O",
-				playerLocation
-			]);
-
-		createConfigFile(Sys.getEnv("HOMEDRIVE") + "\\" + Sys.getEnv("HOMEPATH"));
+			downloadPlayer(majorVersion, exeName, getInstallPath());
 	}
 	}
 
 
-	static function setupFlashPlayerDebugger():Void {
+	static function setupFlashPlayer():Void {
 		switch (systemName) {
 		switch (systemName) {
 			case "Linux":
 			case "Linux":
-				setupFlashDebuggerLinux();
+				setupFlashPlayerLinux();
 			case "Mac":
 			case "Mac":
-				setupFlashDebuggerMac();
+				setupFlashPlayerMac();
 			case "Windows":
 			case "Windows":
-				setupFlashDebuggerWindows();
+				setupFlashPlayerWindows();
 			case _:
 			case _:
 				throw "unsupported system";
 				throw "unsupported system";
 		}
 		}
 	}
 	}
 
 
+	static function readUntil(stdout:haxe.io.Input, expected:String) {
+		var output = "";
+		while (true) {
+			output += try {
+				String.fromCharCode(stdout.readByte());
+			} catch (e:haxe.io.Eof) {
+				failMsg('Expected to find "$expected". Output was:');
+				Sys.print(output);
+				throw new CommandFailure();
+			};
+			if (output.endsWith(expected)) {
+				break;
+			}
+		}
+		return output;
+	}
+
 	/**
 	/**
 		Run a Flash swf file.
 		Run a Flash swf file.
 		Throws `CommandFailure` if unsuccessful.
 		Throws `CommandFailure` if unsuccessful.
-		It detemines the test result by reading the flashlog.txt, looking for "success: true".
 	*/
 	*/
 	static function runFlash(swf:String):Void {
 	static function runFlash(swf:String):Void {
 		swf = FileSystem.fullPath(swf);
 		swf = FileSystem.fullPath(swf);
 		infoMsg('Running .swf file: $swf');
 		infoMsg('Running .swf file: $swf');
 
 
-		final runProcess = switch (systemName) {
+		final debuggerProcess = new Process("fdb");
+
+		var output = "";
+
+		// waits for the fdb prompt and runs a command
+		function runDebuggerCommand(command:String) {
+			output += readUntil(debuggerProcess.stdout, "(fdb) ") + '$command\n';
+			debuggerProcess.stdin.writeString('$command\n');
+		}
+
+		runDebuggerCommand("run");
+
+		final playerProcess = switch (systemName) {
 			case "Linux" if (ci == GithubActions):
 			case "Linux" if (ci == GithubActions):
 				new Process("xvfb-run", ["-a", playerLocation, swf]);
 				new Process("xvfb-run", ["-a", playerLocation, swf]);
 			case "Mac":
 			case "Mac":
 				new Process("open", ["-a", playerLocation, swf]);
 				new Process("open", ["-a", playerLocation, swf]);
 			default:
 			default:
 				new Process(playerLocation, [swf]);
 				new Process(playerLocation, [swf]);
-		}
+		};
 
 
-		// wait a little until flashlog.txt is created
-		for (_ in 0...5) {
-			infoMsg("Waiting 2 seconds for flash log file...");
-			Sys.sleep(2);
-			if (FileSystem.exists(flashlogPath))
-				break;
-		}
-		if (!FileSystem.exists(flashlogPath)) {
-			failMsg('$flashlogPath not found.');
-			throw new CommandFailure();
-		}
+		runDebuggerCommand("continue");
 
 
-		// read flashlog.txt continously
-		final traceProcess = switch (systemName) {
-			case "Windows":
-				new Process("powershell", ["-command", '& {Get-Content "$flashlogPath" -Wait -Tail 1}']);
-			default:
-				new Process("tail", ["-f", flashlogPath]);
-		}
-		var success = false;
-		while (true) {
-			try {
-				final line = traceProcess.stdout.readLine();
-				if (line.indexOf("success: ") >= 0) {
-					success = line.indexOf("success: true") >= 0;
-					break;
-				}
-			} catch (e:haxe.io.Eof) {
-				break;
-			}
-		}
-		runProcess.kill();
-		runProcess.close();
+		output += readUntil(debuggerProcess.stdout, "results: ");
+
+		final results = readUntil(debuggerProcess.stdout, "\n");
+		final success = results.contains("(success: true)");
+		output += results;
+
+		runDebuggerCommand("quit");
+
+		Sys.print(output);
+
+		debuggerProcess.kill();
+		debuggerProcess.close();
+		playerProcess.kill();
+		playerProcess.close();
 
 
-		traceProcess.kill();
-		traceProcess.close();
-		final cmd = (systemName == "Windows") ? "type" : "cat";
-		Sys.command(cmd, [flashlogPath]);
 		if (!success)
 		if (!success)
 			throw new CommandFailure();
 			throw new CommandFailure();
 	}
 	}
 
 
 	static public function run(args:Array<String>) {
 	static public function run(args:Array<String>) {
-		setupFlashPlayerDebugger();
+		setupFlashPlayer();
 		setupFlexSdk();
 		setupFlexSdk();
 		for (flashVersion in ["11", "32"]) {
 		for (flashVersion in ["11", "32"]) {
-			runCommand("haxe", ["compile-flash9.hxml", "-D", "fdb", "-D", "dump", "-D", "dump_ignore_var_ids", "--swf-version", flashVersion].concat(args));
-			runFlash("bin/unit9.swf");
+			runCommand("haxe", ["compile-flash.hxml", "-D", "fdb", "-D", "dump", "-D", "dump_ignore_var_ids", "--swf-version", flashVersion].concat(args));
+			runFlash("bin/unit.swf");
 		}
 		}
 
 
 		changeDirectory(miscFlashDir);
 		changeDirectory(miscFlashDir);

+ 1 - 1
tests/unit/compile-flash9.hxml → tests/unit/compile-flash.hxml

@@ -4,6 +4,6 @@
 
 
 compile-each.hxml
 compile-each.hxml
 --main unit.TestMain
 --main unit.TestMain
--swf bin/unit9.swf
+-swf bin/unit.swf
 -swf-lib native_swf/lib.swc
 -swf-lib native_swf/lib.swc
 -D network-sandbox
 -D network-sandbox

+ 1 - 1
tests/unit/compile.hxml

@@ -11,7 +11,7 @@ compile-java-runner.hxml
 
 
 # targets
 # targets
 
 
---next compile-flash9.hxml
+--next compile-flash.hxml
 --next compile-js.hxml
 --next compile-js.hxml
 --next compile-hl.hxml
 --next compile-hl.hxml
 --next compile-lua.hxml
 --next compile-lua.hxml

+ 4 - 0
tests/unit/src/unit/TestMain.hx

@@ -155,4 +155,8 @@ function main() {
 		});
 		});
 	#end
 	#end
 	runner.run();
 	runner.run();
+
+	#if (flash && fdb)
+	flash.Lib.fscommand("quit");
+	#end
 }
 }

+ 5 - 5
tests/unit/unit.html

@@ -56,23 +56,23 @@ iframe {
   <div id="php_container" class="cont"><iframe src="bin/php/index.php"></iframe></div>
   <div id="php_container" class="cont"><iframe src="bin/php/index.php"></iframe></div>
 </div>
 </div>
 <div class="window">
 <div class="window">
-  <div class="label">Flash 9</div>
+  <div class="label">Flash</div>
   <object	classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
   <object	classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
 	width="400"
 	width="400"
 	height="300"
 	height="300"
-	id="haxeFlash9"
+	id="haxeFlash"
 	align="middle">
 	align="middle">
-    <param name="movie" value="bin/unit9.swf"/>
+    <param name="movie" value="bin/unit.swf"/>
     <param name="allowScriptAccess" value="always" />
     <param name="allowScriptAccess" value="always" />
     <param name="quality" value="high" />
     <param name="quality" value="high" />
     <param name="scale" value="noscale" />
     <param name="scale" value="noscale" />
     <param name="salign" value="lt" />
     <param name="salign" value="lt" />
     <param name="bgcolor" value="#ffffff"/>
     <param name="bgcolor" value="#ffffff"/>
-    <embed src="bin/unit9.swf"
+    <embed src="bin/unit.swf"
       bgcolor="#ffffff"
       bgcolor="#ffffff"
       width="400"
       width="400"
       height="300"
       height="300"
-      name="haxeFlash9"
+      name="haxeFlash"
       quality="high"
       quality="high"
       align="middle"
       align="middle"
       allowScriptAccess="always"
       allowScriptAccess="always"