Browse Source

some test setup fixes

Aurel Bílý 6 years ago
parent
commit
d33b27c829
3 changed files with 21 additions and 3 deletions
  1. 17 0
      tests/asys/Main.hx
  2. 2 2
      tests/asys/TestBase.hx
  3. 2 1
      tests/asys/build-eval.hxml

+ 17 - 0
tests/asys/Main.hx

@@ -1,8 +1,25 @@
 import utest.Runner;
 import utest.ui.Report;
 
+import sys.FileSystem;
+
 class Main {
 	public static function main():Void {
+		if (FileSystem.exists("resources-rw")) {
+			function walk(path:String):Void {
+				for (f in FileSystem.readDirectory(path)) {
+					if (FileSystem.isDirectory('$path/$f')) {
+						walk('$path/$f');
+						FileSystem.deleteDirectory('$path/$f');
+					} else {
+						FileSystem.deleteFile('$path/$f');
+					}
+				}
+			}
+			walk("resources-rw");
+		} else {
+			FileSystem.createDirectory("resources-rw");
+		}
 		var runner = new Runner();
 		runner.addCases(test);
 		runner.onTestStart.add(test -> trace("running", Type.getClassName(Type.getClass(test.fixture.target)), test.fixture.method));

+ 2 - 2
tests/asys/TestBase.hx

@@ -42,10 +42,10 @@ class TestBase {
 		args.unshift(name.charAt(0).toUpperCase() + name.substr(1));
 		args.unshift("--run");
 		args.unshift('test-helpers/eval/$name.hxml');
-		name = "/DevProjects/Repos/haxe/haxe";
+		name = "haxe";
 		#elseif hl
 		args.unshift('test-helpers/hl/$name.hl');
-		name = "/DevProjects/Repos/hashlink/hl";
+		name = "hl";
 		#else
 		throw "unsupported platform for helperStart";
 		#end

+ 2 - 1
tests/asys/build-eval.hxml

@@ -1,4 +1,5 @@
-build-common.hxml
 # TODO: tests hang without disabling DCE
 -dce no
+--main Main
+--library utest
 --interp