瀏覽代碼

Re-enable the cppia tests, and allow them to be run from the command line

Hugh Sanderson 8 年之前
父節點
當前提交
33143a581e
共有 3 個文件被更改,包括 30 次插入20 次删除
  1. 6 3
      tests/RunCi.hx
  2. 2 1
      tests/runci/TestTarget.hx
  3. 22 16
      tests/runci/targets/Cpp.hx

+ 6 - 3
tests/RunCi.hx

@@ -21,7 +21,8 @@ class RunCi {
 	static function main():Void {
 		Sys.putEnv("OCAMLRUNPARAM", "b");
 
-		var tests:Array<TestTarget> = switch (Sys.getEnv("TEST")) {
+		var args = Sys.args();
+		var tests:Array<TestTarget> = switch (args.length==1 ? args[0] : Sys.getEnv("TEST")) {
 			case null:
 				[Macro];
 			case env:
@@ -64,7 +65,9 @@ class RunCi {
 					case Lua:
 						runci.targets.Lua.run(args);
 					case Cpp:
-						runci.targets.Cpp.run(args);
+						runci.targets.Cpp.run(args, true, true);
+					case Cppia:
+						runci.targets.Cpp.run(args, false, true);
 					case Js:
 						runci.targets.Js.run(args);
 					case Java:
@@ -104,4 +107,4 @@ class RunCi {
 			Sys.exit(1);
 		}
 	}
-}
+}

+ 2 - 1
tests/runci/TestTarget.hx

@@ -9,10 +9,11 @@ abstract TestTarget(String) from String {
 	var Php = "php";
 	var Php7 = "php7";
 	var Cpp = "cpp";
+	var Cppia = "cppia";
 	var Flash9 = "flash9";
 	var As3 = "as3";
 	var Java = "java";
 	var Cs = "cs";
 	var Python = "python";
 	var Hl = "hl";
-}
+}

+ 22 - 16
tests/runci/targets/Cpp.hx

@@ -21,8 +21,8 @@ class Cpp {
 
 		//install and build hxcpp
 		try {
-			getHaxelibPath("hxcpp");
-			infoMsg('hxcpp has already been installed.');
+			var path = getHaxelibPath("hxcpp");
+			infoMsg('hxcpp has already been installed in $path.');
 		} catch(e:Dynamic) {
 			haxelibInstallGit("HaxeFoundation", "hxcpp", true);
 			var oldDir = Sys.getCwd();
@@ -40,27 +40,33 @@ class Cpp {
 		runCommand(bin, args);
 	}
 
-	static public function run(args:Array<String>) {
+	static public function run(args:Array<String>, testCompiled:Bool, testCppia:Bool) {
 		getCppDependencies();
-		runCommand("haxe", ["compile-cpp.hxml", "-D", "HXCPP_M32"].concat(args));
-		runCpp("bin/cpp/TestMain-debug", []);
+		if (testCompiled) {
+			runCommand("haxe", ["compile-cpp.hxml", "-D", "HXCPP_M32"].concat(args));
+			runCpp("bin/cpp/TestMain-debug", []);
+		}
 
 		switch (ci) {
 			case AppVeyor:
 				//save time...
 			case _:
-				runCommand("rm", ["-rf", "cpp"]);
-				runCommand("haxe", ["compile-cpp.hxml", "-D", "HXCPP_M64"].concat(args));
-				runCpp("bin/cpp/TestMain-debug", []);
+				if (testCompiled) {
+					runCommand("rm", ["-rf", "cpp"]);
+					runCommand("haxe", ["compile-cpp.hxml", "-D", "HXCPP_M64"].concat(args));
+					runCpp("bin/cpp/TestMain-debug", []);
+				}
 
+				if (testCppia) {
 				// https://github.com/HaxeFoundation/hxcpp/issues/646
-				// runCommand("haxe", ["compile-cppia-host.hxml"]);
-				// runCommand("haxe", ["compile-cppia.hxml"]);
-				// runCpp("bin/cppia/Host-debug", ["bin/unit.cppia"]);
-				// runCpp("bin/cppia/Host-debug", ["bin/unit.cppia", "-jit"]);
-				// runCommand("haxe", ["compile-cppia.hxml", "-D", "nocppiaast"]);
-				// runCpp("bin/cppia/Host-debug", ["bin/unit.cppia"]);
-				// runCpp("bin/cppia/Host-debug", ["bin/unit.cppia", "-jit"]);
+					runCommand("haxe", ["compile-cppia-host.hxml"]);
+					runCommand("haxe", ["compile-cppia.hxml"]);
+					runCpp("bin/cppia/Host-debug", ["bin/unit.cppia"]);
+					runCpp("bin/cppia/Host-debug", ["bin/unit.cppia", "-jit"]);
+					runCommand("haxe", ["compile-cppia.hxml", "-D", "nocppiaast"]);
+					runCpp("bin/cppia/Host-debug", ["bin/unit.cppia"]);
+					runCpp("bin/cppia/Host-debug", ["bin/unit.cppia", "-jit"]);
+				}
 		}
 
 		changeDirectory(sysDir);
@@ -75,4 +81,4 @@ class Cpp {
 		// 	runCpp("bin/TestObjc-debug");
 		// }
 	}
-}
+}