2
0
Эх сурвалжийг харах

setup compiler_loops tests for linux (see #6200)

Aleksandr Kuzmenko 6 жил өмнө
parent
commit
4a4f9912c8
24 өөрчлөгдсөн 81 нэмэгдсэн , 39 устгасан
  1. 0 0
      tests/misc/compiler_loops/projects/Issue5189/Main.hx
  2. 1 0
      tests/misc/compiler_loops/projects/Issue5189/compile-fail.hxml
  3. 3 0
      tests/misc/compiler_loops/projects/Issue5189/compile-fail.hxml.stderr
  4. 5 0
      tests/misc/compiler_loops/projects/Issue5345/Main.hx
  5. 6 0
      tests/misc/compiler_loops/projects/Issue5345/Main2.hx
  6. 6 0
      tests/misc/compiler_loops/projects/Issue5345/Main3.hx
  7. 1 0
      tests/misc/compiler_loops/projects/Issue5345/compile-fail.hxml
  8. 1 0
      tests/misc/compiler_loops/projects/Issue5345/compile-fail.hxml.stderr
  9. 1 0
      tests/misc/compiler_loops/projects/Issue5345/compile2-fail.hxml
  10. 1 0
      tests/misc/compiler_loops/projects/Issue5345/compile2-fail.hxml.stderr
  11. 1 0
      tests/misc/compiler_loops/projects/Issue5345/compile3-fail.hxml
  12. 1 0
      tests/misc/compiler_loops/projects/Issue5345/compile3-fail.hxml.stderr
  13. 7 7
      tests/misc/compiler_loops/projects/Issue5785.disabled/Main.hx
  14. 1 0
      tests/misc/compiler_loops/projects/Issue5785.disabled/compile.hxml
  15. 14 0
      tests/misc/compiler_loops/projects/Issue6038/Main.hx
  16. 1 0
      tests/misc/compiler_loops/projects/Issue6038/compile.hxml
  17. 3 0
      tests/misc/compiler_loops/run.hxml
  18. 21 2
      tests/misc/src/Main.hx
  19. 7 0
      tests/runci/targets/Macro.hx
  20. 0 11
      tests/unit/compiler_loops/All.hx
  21. 0 1
      tests/unit/compiler_loops/Issue5345.hx
  22. 0 2
      tests/unit/compiler_loops/Issue5345b.hx
  23. 0 2
      tests/unit/compiler_loops/Issue5345c.hx
  24. 0 14
      tests/unit/compiler_loops/Issue6038.hx

+ 0 - 0
tests/unit/compiler_loops/Issue5189.hx → tests/misc/compiler_loops/projects/Issue5189/Main.hx


+ 1 - 0
tests/misc/compiler_loops/projects/Issue5189/compile-fail.hxml

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

+ 3 - 0
tests/misc/compiler_loops/projects/Issue5189/compile-fail.hxml.stderr

@@ -0,0 +1,3 @@
+Main.hx:18: characters 9-29 : error: { c : Array<TT_A>, b : String, a : Int } has no field d
+Main.hx:18: characters 9-29 :  have: { c: Array<{ c, b, a }> }
+Main.hx:18: characters 9-29 :  want: { c: Array<TT_B> }

+ 5 - 0
tests/misc/compiler_loops/projects/Issue5345/Main.hx

@@ -0,0 +1,5 @@
+typedef Issue5345 = Issue5345;
+
+class Main {
+	public static function main() {}
+}

+ 6 - 0
tests/misc/compiler_loops/projects/Issue5345/Main2.hx

@@ -0,0 +1,6 @@
+typedef Issue5345<T> = Issue5345b<T>;
+typedef Issue5345b<T> = Issue5345<T>;
+
+class Main2 {
+	public static function main() {}
+}

+ 6 - 0
tests/misc/compiler_loops/projects/Issue5345/Main3.hx

@@ -0,0 +1,6 @@
+typedef Issue5345 = Issue5345b;
+typedef Issue5345b = Issue5345;
+
+class Main3 {
+	public static function main() {}
+}

+ 1 - 0
tests/misc/compiler_loops/projects/Issue5345/compile-fail.hxml

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

+ 1 - 0
tests/misc/compiler_loops/projects/Issue5345/compile-fail.hxml.stderr

@@ -0,0 +1 @@
+Main.hx:1: characters 1-30 : Recursive typedef is not allowed

+ 1 - 0
tests/misc/compiler_loops/projects/Issue5345/compile2-fail.hxml

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

+ 1 - 0
tests/misc/compiler_loops/projects/Issue5345/compile2-fail.hxml.stderr

@@ -0,0 +1 @@
+Main.hx:1: characters 1-30 : Recursive typedef is not allowed

+ 1 - 0
tests/misc/compiler_loops/projects/Issue5345/compile3-fail.hxml

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

+ 1 - 0
tests/misc/compiler_loops/projects/Issue5345/compile3-fail.hxml.stderr

@@ -0,0 +1 @@
+Main.hx:1: characters 1-30 : Recursive typedef is not allowed

+ 7 - 7
tests/unit/compiler_loops/Issue5785.hx → tests/misc/compiler_loops/projects/Issue5785.disabled/Main.hx

@@ -1,16 +1,16 @@
 typedef Observable<T> = {
 	function flatten<U>():Stream<U>;
-};
+}
+
 typedef Stream<T> = {
 	function flatten<V>():Stream<V>;
 	function takeUntilBy<U>(otherObs:Observable<U>):Stream<U>;
-	function bufferWhileBy():Stream<Array<T>>;
-};
+}
 
 class Main {
 
-  public static function main() {
-    var mouseMoves : Stream<Int> = null;
-    mouseMoves.takeUntilBy(mouseMoves);
-  } 
+	public static function main() {
+		var mouseMoves : Stream<Int> = null;
+		mouseMoves.takeUntilBy(mouseMoves);
+	}
 }

+ 1 - 0
tests/misc/compiler_loops/projects/Issue5785.disabled/compile.hxml

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

+ 14 - 0
tests/misc/compiler_loops/projects/Issue6038/Main.hx

@@ -0,0 +1,14 @@
+class Promise<T> {
+	public function then<TOut>():Promise<TOut> { return null; }
+}
+
+typedef Thenable<T> = {
+	function then():Thenable<T>;
+}
+
+class Main {
+	static function main() {
+		var p:Promise<Int> = null;
+		var t:Thenable<Int> = p;
+	}
+}

+ 1 - 0
tests/misc/compiler_loops/projects/Issue6038/compile.hxml

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

+ 3 - 0
tests/misc/compiler_loops/run.hxml

@@ -0,0 +1,3 @@
+-cp ../src
+-D timeout=3
+--run Main

+ 21 - 2
tests/misc/src/Main.hx

@@ -1,3 +1,4 @@
+import haxe.macro.Compiler;
 import sys.FileSystem;
 import sys.io.File;
 import haxe.io.Path;
@@ -19,7 +20,7 @@ class Main {
 	static public function compileProjects():Result {
 		var count = 0;
 		var failures = 0;
-		var filter = haxe.macro.Compiler.getDefine("MISC_TEST_FILTER");
+		var filter = Compiler.getDefine("MISC_TEST_FILTER");
 		var filterRegex = filter == null ? ~/.*/ : new EReg(filter, "");
 		function browse(dirPath) {
 			var dir = FileSystem.readDirectory(dirPath);
@@ -27,7 +28,11 @@ class Main {
 			for (file in dir) {
 				var path = Path.join([dirPath, file]);
 				if (FileSystem.isDirectory(path)) {
-					browse(path);
+					if(path.endsWith('.disabled')) {
+						Sys.println('Skipping $path');
+					} else {
+						browse(path);
+					}
 				} else if (file.endsWith(".hxml") && !file.endsWith("-each.hxml") && filterRegex.match(path)) {
 					var old = Sys.getCwd();
 					Sys.setCwd(dirPath);
@@ -74,10 +79,24 @@ class Main {
 	}
 
 	static function runCommand(command:String, args:Array<String>, expectFailure:Bool, expectStderr:String) {
+		#if timeout
+		switch Sys.systemName() {
+			case 'Linux':
+				args.unshift(command);
+				args.unshift(Compiler.getDefine('timeout'));
+				command = 'timeout';
+			case _:
+				throw 'Running tests with timeout is not implemented for this OS';
+		}
+		#end
 		var proc = new sys.io.Process(command, args);
 		var stdout = proc.stdout.readAll();
 		var exit = proc.exitCode();
 		var success = exit == 0;
+		// 124 - exit code of linux `timeout` command in case it actually timed out
+		if(exit == 124) {
+			Sys.println('Timeout. No response in ${Compiler.getDefine('timeout')} seconds.');
+		}
 		var result = switch [success, expectFailure] {
 			case [true, false]:
 				true;

+ 7 - 0
tests/runci/targets/Macro.hx

@@ -27,6 +27,13 @@ class Macro {
 		changeDirectory(sysDir);
 		runCommand("haxe", ["compile-macro.hxml"]);
 
+		switch Sys.systemName() {
+			case 'Linux':
+				changeDirectory(miscDir + 'compiler_loops');
+				runCommand("haxe", ["run.hxml"]);
+			case _: // TODO
+		}
+
 		// changeDirectory(threadsDir);
 		// runCommand("haxe", ["build.hxml", "--interp"]);
 	}

+ 0 - 11
tests/unit/compiler_loops/All.hx

@@ -1,11 +0,0 @@
-class All {
-
-	static function main() {
-		for( f in sys.FileSystem.readDirectory(".") ) {
-			if( !StringTools.endsWith(f,".hx") || f == "All.hx" ) continue;
-			Sys.println(f);
-			Sys.command("haxe",[f.substr(0,-3)]);
-		}
-	}
-
-}

+ 0 - 1
tests/unit/compiler_loops/Issue5345.hx

@@ -1 +0,0 @@
-typedef Issue5345 = Issue5345;

+ 0 - 2
tests/unit/compiler_loops/Issue5345b.hx

@@ -1,2 +0,0 @@
-typedef Issue5345 = Issue5345b;
-typedef Issue5345b = Issue5345;

+ 0 - 2
tests/unit/compiler_loops/Issue5345c.hx

@@ -1,2 +0,0 @@
-typedef Issue5345<T> = Issue5345b<T>;
-typedef Issue5345b<T> = Issue5345<T>;

+ 0 - 14
tests/unit/compiler_loops/Issue6038.hx

@@ -1,14 +0,0 @@
-class Promise<T> {
-    public function then<TOut>():Promise<TOut> { return null; }
-}
-
-typedef Thenable<T> = {
-    function then():Thenable<T>;
-}
-
-class Issue6038 {
-    static function main() {
-        var p:Promise<Int> = null;
-        var t:Thenable<Int> = p;
-    }
-}