浏览代码

[ci] Enable missing hashlink tests (#11064)

* Enabling hashlink tests depending on ssl.hdll

* Fix test guard

interp here is for the hashlink interpreter, not haxe's interp target

* Clean up
tobil4sk 2 年之前
父节点
当前提交
55ea42b64a
共有 4 个文件被更改,包括 19 次插入35 次删除
  1. 2 10
      tests/runci/targets/Hl.hx
  2. 15 22
      tests/unit/src/unit/TestHttp.hx
  3. 1 2
      tests/unit/src/unit/TestMain.hx
  4. 1 1
      tests/unit/src/unitstd/EReg.unit.hx

+ 2 - 10
tests/runci/targets/Hl.hx

@@ -52,7 +52,7 @@ class Hl {
 			"-DWITH_OPENAL=OFF",
 			"-DWITH_SDL=OFF",
 			"-DWITH_SQLITE=ON",
-			"-DWITH_SSL=OFF",
+			"-DWITH_SSL=ON",
 			"-DWITH_UI=OFF",
 			"-DWITH_UV=OFF",
 			"-DWITH_VIDEO=OFF",
@@ -72,15 +72,7 @@ class Hl {
 	static public function run(args:Array<String>) {
 		getHlDependencies();
 
-		switch (systemName) {
-			case "Windows":
-				runCommand("haxe", ["compile-hl.hxml"].concat(args));
-			case _:
-				runCommand("haxe", [
-					"compile-hl.hxml",
-					"-D", "no_http", // hl's ssl.hdll is only built on Windows
-				].concat(args));
-		}
+		runCommand("haxe", ["compile-hl.hxml"].concat(args));
 		runCommand(hlBinary, ["bin/unit.hl"]);
 
 		changeDirectory(threadsDir);

+ 15 - 22
tests/unit/src/unit/TestHttp.hx

@@ -3,39 +3,33 @@ package unit;
 import utest.Async;
 
 class TestHttp extends Test {
+	#if flash
 	public function setupClass() {
-		#if flash
 		flash.system.Security.allowDomain("*");
 		flash.system.Security.allowInsecureDomain("*");
 		flash.system.Security.loadPolicyFile("http://localhost:20200/crossdomain.xml");
-		#end
 	}
+	#end
 
-	function run(async:Async, test:()->Void) {
-		// { comment this out to run http tests locally
-		#if (!github || (github && js && !nodejs)) //also don't run on sauce labs
-		noAssert();
-		async.done();
-		return;
-		#end
-		// }
+	static final RUN_HTTP_TESTS =
+		#if !github false && #end // comment out line to run http tests locally
+		#if (github && (java || flash || (cs && Windows)))
+			false
+		#elseif (js && !nodejs)
+			js.Browser.supported
+		#else
+			true
+		#end;
 
-		#if (js && !nodejs)
-		if(!js.Browser.supported) {
-			noAssert();
-			async.done();
+	function run(async:Async, test:()->Void) {
+		if (RUN_HTTP_TESTS) {
+			test();
 			return;
 		}
-		test();
-		#elseif (github && (hl || java || (flash && (Linux || Mac || Windows)) || (cs && Windows)))
 		noAssert();
 		async.done();
-		return;
-		#else
-		test();
-		#end
 	}
-#if !(github && hl)
+
 	@:timeout(1000)
 	public function testPostData(async:Async) run(async, () -> {
 		var srcStr = 'hello, world';
@@ -84,5 +78,4 @@ class TestHttp extends Test {
 		d.setPostBytes(srcData);
 		d.request();
 	});
-#end
 }

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

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

+ 1 - 1
tests/unit/src/unitstd/EReg.unit.hx

@@ -87,7 +87,7 @@ pos.len == 2;
 ~/a/g.replace("bab", "z") == "bzb";
 ~/a/g.replace("baba", "z") == "bzbz";
 
-#if !(interp) // not allowed in local interpreter, still allowed in hl runtime
+#if !(hl && interp) // not allowed in local hl interpreter, still allowed in hl runtime
 // replace + $
 ~/href="(.*?)"/.replace('lead href="foo" trail',"$1") == "lead foo trail";
 //~/href="(.*?)"/.replace('lead href="foo" trail',"$2") == "lead $2 trail";