$sourceDir = __DIR__; if (!empty($argv[1])) { $sourceDir = loader::get_public('modules/' . $argv[1]); } fs::build_tree($sourceDir, $out, false, '\\.php$'); // убираем loader и ru-all.php foreach ($out['files'] as $k => $v) { if (preg_match('@(loader|run\\-all)\\.php$@', $v)) { unset($out['files'][$k]); } } // $files = array_splice($out['files'], 2); $files = $out['files']; test_assertions::$successed = 0; test_assertions::$failed = 0; test_assertions::$start_time = microtime(1); $concurrent = 10; $processes = []; $file = null; $kfile = 0; $done_files = []; /** @var $process Process */ test_head('TESTS: ' . count($files)); reset($files); while (1) { while (count($processes) < $concurrent) { if ($file = next($files)) { $kfile++; // printf("* %4d (%d) %s \n", $kfile, count($processes), $file); // run test $process = new Process("php -f {$file} 2>&1", dirname($file));
/** * Complete */ function test_done() { list($oks, $fails) = test_assertions::get(); test_head(sprintf('%-10s (+%d, -%d) %s', test_assertions::$failed ? 'FAILED' : 'PASSED', $oks, $fails, basename($_SERVER['PHP_SELF']))); printf('Time: %.5f ms, Mem: %.3f MB %s', microtime(1) - test_assertions::$start_time, memory_get_peak_usage() / 1048576, Strings::nl()); // outro exit($fails ? 1 : 0); }