|
@@ -1,3 +1,4 @@
|
|
|
|
+import haxe.macro.Compiler;
|
|
import sys.FileSystem;
|
|
import sys.FileSystem;
|
|
import sys.io.File;
|
|
import sys.io.File;
|
|
import haxe.io.Path;
|
|
import haxe.io.Path;
|
|
@@ -19,7 +20,7 @@ class Main {
|
|
static public function compileProjects():Result {
|
|
static public function compileProjects():Result {
|
|
var count = 0;
|
|
var count = 0;
|
|
var failures = 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, "");
|
|
var filterRegex = filter == null ? ~/.*/ : new EReg(filter, "");
|
|
function browse(dirPath) {
|
|
function browse(dirPath) {
|
|
var dir = FileSystem.readDirectory(dirPath);
|
|
var dir = FileSystem.readDirectory(dirPath);
|
|
@@ -27,7 +28,11 @@ class Main {
|
|
for (file in dir) {
|
|
for (file in dir) {
|
|
var path = Path.join([dirPath, file]);
|
|
var path = Path.join([dirPath, file]);
|
|
if (FileSystem.isDirectory(path)) {
|
|
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)) {
|
|
} else if (file.endsWith(".hxml") && !file.endsWith("-each.hxml") && filterRegex.match(path)) {
|
|
var old = Sys.getCwd();
|
|
var old = Sys.getCwd();
|
|
Sys.setCwd(dirPath);
|
|
Sys.setCwd(dirPath);
|
|
@@ -74,10 +79,24 @@ class Main {
|
|
}
|
|
}
|
|
|
|
|
|
static function runCommand(command:String, args:Array<String>, expectFailure:Bool, expectStderr:String) {
|
|
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 proc = new sys.io.Process(command, args);
|
|
var stdout = proc.stdout.readAll();
|
|
var stdout = proc.stdout.readAll();
|
|
var exit = proc.exitCode();
|
|
var exit = proc.exitCode();
|
|
var success = exit == 0;
|
|
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] {
|
|
var result = switch [success, expectFailure] {
|
|
case [true, false]:
|
|
case [true, false]:
|
|
true;
|
|
true;
|