Skip to content
Snippets Groups Projects
Commit aca2ea45 authored by Jared Hancock's avatar Jared Hancock
Browse files

Allow interrupting the testing process

parent d6d7a21e
Branches
Tags
No related merge requests found
...@@ -19,13 +19,37 @@ $root = get_osticket_root_path(); ...@@ -19,13 +19,37 @@ $root = get_osticket_root_path();
function glob_recursive($pattern, $flags = 0) { function glob_recursive($pattern, $flags = 0) {
$files = glob($pattern, $flags); $files = glob($pattern, $flags);
foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir) { foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir) {
$files = array_merge($files, $files = array_merge($files,
glob_recursive($dir.'/'.basename($pattern), $flags)); glob_recursive($dir.'/'.basename($pattern), $flags));
} }
return $files; return $files;
} }
$fails = array(); $fails = array();
function show_fails() {
global $fails, $root;
if ($fails) {
echo count($fails) . " FAIL(s)\n";
echo "-------------------------------------------------------\n";
foreach ($fails as $f) {
list($test, $script, $line, $message) = $f;
$script = str_replace($root.'/', '', $script);
print("$test: $message @ $script:$line\n");
}
}
}
if (function_exists('pcntl_signal')) {
declare(ticks=1);
function show_fails_on_ctrlc() {
while (@ob_end_flush());
print("\n");
show_fails();
exit();
}
pcntl_signal(SIGINT, 'show_fails_on_ctrlc');
}
foreach (glob_recursive(dirname(__file__)."/tests/test.*.php") as $t) { foreach (glob_recursive(dirname(__file__)."/tests/test.*.php") as $t) {
if (strpos($t,"class.") !== false) if (strpos($t,"class.") !== false)
continue; continue;
...@@ -38,15 +62,6 @@ foreach (glob_recursive(dirname(__file__)."/tests/test.*.php") as $t) { ...@@ -38,15 +62,6 @@ foreach (glob_recursive(dirname(__file__)."/tests/test.*.php") as $t) {
$fails = array_merge($fails, $test->fails); $fails = array_merge($fails, $test->fails);
echo " ok\n"; echo " ok\n";
} }
show_fails();
if ($fails) {
echo count($fails) . " FAIL(s)\n";
echo "-------------------------------------------------------\n";
foreach ($fails as $f) {
list($test, $script, $line, $message) = $f;
$script = str_replace($root.'/', '', $script);
print("$test: $message @ $script:$line\n");
}
}
?> ?>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment