Bläddra i källkod

[ci] run all hl tests through hl/c on linux (#11384)

* [tests] enable http tests for hl/c

* [ci] run all tests through hl/c on linux (except hl misc tests)

* [tests] remove unused hxml
Rudy Ges 1 år sedan
förälder
incheckning
e8551dd6bc

+ 0 - 1
tests/misc/eventLoop/build-hl.hxml

@@ -1,3 +1,2 @@
 --main Main
 --main Main
 --dce full
 --dce full
--hl eventLoop.hl

+ 0 - 2
tests/misc/hl/reserved-keywords/compile.hxml

@@ -1,2 +0,0 @@
--main Main
--hl bin/test.c

+ 0 - 0
tests/misc/hl/reserved-keywords/Macro.macro.hx → tests/misc/hl/reservedKeywords/Macro.macro.hx


+ 0 - 0
tests/misc/hl/reserved-keywords/Main.hx → tests/misc/hl/reservedKeywords/Main.hx


+ 1 - 0
tests/misc/hl/reservedKeywords/compile.hxml

@@ -0,0 +1 @@
+-main Main

+ 37 - 26
tests/runci/targets/Hl.hx

@@ -70,51 +70,62 @@ class Hl {
 		haxelibDev("hashlink", '$hlSrc/other/haxelib/');
 		haxelibDev("hashlink", '$hlSrc/other/haxelib/');
 	}
 	}
 
 
-	static public function run(args:Array<String>) {
-		getHlDependencies();
+	static function buildAndRunHlc(dir:String, filename:String, ?run) {
+		if (run == null) run = runCommand;
 
 
-		runCommand("haxe", ["compile-hl.hxml"].concat(args));
-		runCommand(hlBinary, ["bin/unit.hl"]);
-
-		runCommand("haxe", ["compile-hlc.hxml"].concat(args));
 		switch (systemName) {
 		switch (systemName) {
 			case "Linux" if (isCi()):
 			case "Linux" if (isCi()):
 				runCommand("gcc", [
 				runCommand("gcc", [
-					"-o", "bin/hlc/main",
-					"bin/hlc/main.c",
-					"-Ibin/hlc/",
+					"-o", '$dir/$filename.exe',
+					'$dir/$filename.c',
+					'-I$dir',
 					'-I$hlSrc/src',
 					'-I$hlSrc/src',
 					'$hlBuildBinDir/fmt.hdll',
 					'$hlBuildBinDir/fmt.hdll',
+					'$hlBuildBinDir/ssl.hdll',
+					'$hlBuildBinDir/sqlite.hdll',
 					"-lm",
 					"-lm",
 					'-L$hlBuildBinDir', "-lhl"
 					'-L$hlBuildBinDir', "-lhl"
 				]);
 				]);
-				runCommand("bin/hlc/main", []);
-			case _:
-				// TODO hl/c for mac/windows
+
+				run('$dir/$filename.exe', []);
+
+			case _: // TODO hl/c for mac/windows
 		}
 		}
+	}
+
+	static function buildAndRun(hxml:String, target:String, ?args:Array<String>) {
+		if (args == null) args = [];
+
+		runCommand("haxe", [hxml, "-hl", '$target/hl-jit.hl'].concat(args));
+		runCommand(hlBinary, ['$target/hl-jit.hl']);
+
+		runCommand("haxe", [hxml, "-hl", '$target/hlc.c'].concat(args));
+		buildAndRunHlc(target, "hlc");
+	}
+
+	static public function run(args:Array<String>) {
+		getHlDependencies();
+
+		buildAndRun("compile-hl.hxml", "bin/unit", args);
 
 
 		changeDirectory(threadsDir);
 		changeDirectory(threadsDir);
-		runCommand("haxe", ["build.hxml", "-hl", "export/threads.hl"]);
-		runCommand(hlBinary, ["export/threads.hl"]);
+		buildAndRun("build.hxml", "export/threads");
 
 
 		changeDirectory(sysDir);
 		changeDirectory(sysDir);
 		runCommand("haxe", ["compile-hl.hxml"].concat(args));
 		runCommand("haxe", ["compile-hl.hxml"].concat(args));
 		runSysTest(hlBinary, ["bin/hl/sys.hl"]);
 		runSysTest(hlBinary, ["bin/hl/sys.hl"]);
+		runCommand("haxe", ["compile-hlc.hxml"].concat(args));
+		function dontRun(cmd,?args) {}
+		buildAndRunHlc("bin/hlc/testArguments", "TestArguments", dontRun);
+		buildAndRunHlc("bin/hlc/exitCode", "ExitCode", dontRun);
+		buildAndRunHlc("bin/hlc/utilityProcess", "UtilityProcess", dontRun);
+		buildAndRunHlc("bin/hlc/sys", "sys", (cmd, ?args) -> runSysTest(FileSystem.fullPath(cmd), args));
 
 
 		changeDirectory(getMiscSubDir("eventLoop"));
 		changeDirectory(getMiscSubDir("eventLoop"));
-		runCommand("haxe", ["build-hl.hxml"]);
-		// TODO: check output like misc tests do
-		runCommand(hlBinary, ["eventLoop.hl"]);
+		buildAndRun("build-hl.hxml", "bin/eventLoop");
 
 
-		changeDirectory(getMiscSubDir("hl/reserved-keywords"));
-		runCommand("haxe", ["compile.hxml"]);
-		switch (systemName) {
-			case "Linux" if (isCi()):
-				runCommand("gcc", ["-o", "bin/test", "bin/test.c", "-Ibin/", '-I$hlSrc/src', '-L$hlBuildBinDir', "-lhl"]);
-				runCommand("bin/test", []);
-			case _:
-				// TODO hl/c for mac/windows
-		}
+		changeDirectory(getMiscSubDir("hl/reservedKeywords"));
+		buildAndRun("compile.hxml", "bin/reservedKeywords");
 
 
 		changeDirectory(miscHlDir);
 		changeDirectory(miscHlDir);
 		runCommand("haxe", ["run.hxml"]);
 		runCommand("haxe", ["run.hxml"]);

+ 18 - 0
tests/sys/compile-hlc.hxml

@@ -0,0 +1,18 @@
+compile-each.hxml
+--main Main
+-hl bin/hlc/sys/sys.c
+
+--next
+compile-each.hxml
+--main TestArguments
+-hl bin/hlc/testArguments/TestArguments.c
+
+--next
+compile-each.hxml
+--main ExitCode
+-hl bin/hlc/exitCode/ExitCode.c
+
+--next
+compile-each.hxml
+--main UtilityProcess
+-hl bin/hlc/utilityProcess/UtilityProcess.c

+ 1 - 0
tests/sys/gen_test_res.py

@@ -82,6 +82,7 @@ for data in all_filenames:
         ("../../bin/cs/bin/UtilityProcess-Debug.exe", "bin-cs-debug"),
         ("../../bin/cs/bin/UtilityProcess-Debug.exe", "bin-cs-debug"),
         ("../../bin/cs/bin/UtilityProcess.exe", "bin-cs"),
         ("../../bin/cs/bin/UtilityProcess.exe", "bin-cs"),
         ("../../bin/hl/UtilityProcess.hl", "bin-hl"),
         ("../../bin/hl/UtilityProcess.hl", "bin-hl"),
+        ("../../bin/hlc/utilityProcess/UtilityProcess.exe", "bin-hlc"),
         ("../../bin/lua/UtilityProcess.lua", "bin-lua"),
         ("../../bin/lua/UtilityProcess.lua", "bin-lua"),
         ("../../bin/java/UtilityProcess-Debug.jar", "bin-java-debug"),
         ("../../bin/java/UtilityProcess-Debug.jar", "bin-java-debug"),
         ("../../bin/java/UtilityProcess.jar", "bin-java"),
         ("../../bin/java/UtilityProcess.jar", "bin-java"),

+ 5 - 1
tests/sys/src/ExitCode.hx

@@ -12,7 +12,11 @@ class ExitCode {
 	#elseif neko
 	#elseif neko
 		"bin/neko/ExitCode.n";
 		"bin/neko/ExitCode.n";
 	#elseif hl
 	#elseif hl
-		"bin/hl/ExitCode.hl";
+		#if hlc
+			"bin/hlc/exitCode/ExitCode.exe";
+		#else
+			"bin/hl/ExitCode.hl";
+		#end
 	#elseif cpp
 	#elseif cpp
 		#if debug
 		#if debug
 			"bin/cpp/ExitCode-debug";
 			"bin/cpp/ExitCode-debug";

+ 5 - 1
tests/sys/src/TestArguments.hx

@@ -72,7 +72,11 @@ class TestArguments extends utest.Test {
 	#elseif neko
 	#elseif neko
 		"bin/neko/TestArguments.n";
 		"bin/neko/TestArguments.n";
 	#elseif hl
 	#elseif hl
-		"bin/hl/TestArguments.hl";
+		#if hlc
+			"bin/hlc/testArguments/TestArguments.exe";
+		#else
+			"bin/hl/TestArguments.hl";
+		#end
 	#elseif cpp
 	#elseif cpp
 		#if debug
 		#if debug
 			"bin/cpp/TestArguments-debug";
 			"bin/cpp/TestArguments-debug";

+ 8 - 0
tests/sys/src/TestCommandBase.hx

@@ -37,7 +37,11 @@ class TestCommandBase extends utest.Test {
 			#elseif neko
 			#elseif neko
 				run("neko", [bin].concat(args));
 				run("neko", [bin].concat(args));
 			#elseif hl
 			#elseif hl
+				#if hlc
+				run(bin, args);
+				#else
 				run("hl", [bin].concat(args));
 				run("hl", [bin].concat(args));
+				#end
 			#elseif php
 			#elseif php
 				run(php.Global.defined('PHP_BINARY') ? php.Const.PHP_BINARY : 'php', [bin].concat(args));
 				run(php.Global.defined('PHP_BINARY') ? php.Const.PHP_BINARY : 'php', [bin].concat(args));
 			#elseif lua
 			#elseif lua
@@ -130,7 +134,11 @@ class TestCommandBase extends utest.Test {
 				#elseif neko
 				#elseif neko
 					run("neko", [bin].concat(args));
 					run("neko", [bin].concat(args));
 				#elseif hl
 				#elseif hl
+					#if hlc
+					run(bin, args);
+					#else
 					run("hl", [bin].concat(args));
 					run("hl", [bin].concat(args));
+					#end
 				#elseif php
 				#elseif php
 					run(php.Global.defined('PHP_BINARY') ? php.Const.PHP_BINARY : 'php', [bin].concat(args));
 					run(php.Global.defined('PHP_BINARY') ? php.Const.PHP_BINARY : 'php', [bin].concat(args));
 				#elseif lua
 				#elseif lua

+ 5 - 1
tests/sys/src/TestUnicode.hx

@@ -23,7 +23,11 @@ class TestUnicode extends utest.Test {
 			"bin-cs";
 			"bin-cs";
 		#end
 		#end
 #elseif hl
 #elseif hl
-		"bin-hl";
+		#if hlc
+			"bin-hlc";
+		#else
+			"bin-hl";
+		#end
 #elseif lua
 #elseif lua
 		"bin-lua";
 		"bin-lua";
 #elseif jvm
 #elseif jvm

+ 13 - 1
tests/sys/src/UtilityProcess.hx

@@ -13,7 +13,11 @@ class UtilityProcess {
 #elseif cs
 #elseif cs
 		Path.join(["bin", "cs", "bin"]);
 		Path.join(["bin", "cs", "bin"]);
 #elseif hl
 #elseif hl
+	#if hlc
+		Path.join(["bin", "hlc/utilityProcess"]);
+	#else
 		Path.join(["bin", "hl"]);
 		Path.join(["bin", "hl"]);
+	#end
 #elseif lua
 #elseif lua
 		Path.join(["bin", "lua"]);
 		Path.join(["bin", "lua"]);
 #elseif jvm
 #elseif jvm
@@ -47,7 +51,11 @@ class UtilityProcess {
 			"UtilityProcess.exe";
 			"UtilityProcess.exe";
 		#end
 		#end
 #elseif hl
 #elseif hl
+	#if hlc
+		"UtilityProcess.exe";
+	#else
 		"UtilityProcess.hl";
 		"UtilityProcess.hl";
+	#end
 #elseif lua
 #elseif lua
 		"UtilityProcess.lua";
 		"UtilityProcess.lua";
 #elseif jvm
 #elseif jvm
@@ -100,7 +108,11 @@ class UtilityProcess {
 		#elseif neko
 		#elseif neko
 		new Process("neko", [execFull].concat(args));
 		new Process("neko", [execFull].concat(args));
 		#elseif hl
 		#elseif hl
-		new Process("hl", [execFull].concat(args));
+			#if hlc
+			new Process(execFull, args);
+			#else
+			new Process("hl", [execFull].concat(args));
+			#end
 		#elseif php
 		#elseif php
 		new Process(php.Global.defined('PHP_BINARY') ? php.Const.PHP_BINARY : 'php', [execFull].concat(args));
 		new Process(php.Global.defined('PHP_BINARY') ? php.Const.PHP_BINARY : 'php', [execFull].concat(args));
 		#elseif lua
 		#elseif lua

+ 1 - 2
tests/unit/compile-hl.hxml

@@ -1,6 +1,5 @@
 compile-each.hxml
 compile-each.hxml
 --main unit.TestMain
 --main unit.TestMain
--hl bin/unit.hl
 #-D interp
 #-D interp
 -D hl-check
 -D hl-check
--D hl-ver=1.13.0
+-D hl-ver=1.13.0

+ 0 - 5
tests/unit/compile-hlc.hxml

@@ -1,5 +0,0 @@
-compile-each.hxml
---main unit.TestMain
--hl bin/hlc/main.c
--D hl-check
--D hl-ver=1.13.0

+ 1 - 1
tests/unit/src/unit/TestMain.hx

@@ -79,7 +79,7 @@ function main() {
 		new TestNumericCasts(),
 		new TestNumericCasts(),
 		new TestHashMap(),
 		new TestHashMap(),
 		new TestRest(),
 		new TestRest(),
-		#if !hlc new TestHttp(), #end
+		new TestHttp(),
 		#if !no_pattern_matching
 		#if !no_pattern_matching
 		new TestMatch(),
 		new TestMatch(),
 		#end
 		#end