this makes coverage dumping work on windows; on windows the cwd is changed to the apache executable's path by the time the coverage end is reached, changing the coverage end function to a closure that gives back a function with the actual shimmie cwd stored fixes this
This commit is contained in:
parent
e9cabb30b3
commit
e5b3afb31c
@ -991,11 +991,15 @@ function _start_coverage() {
|
|||||||
|
|
||||||
function _end_coverage() {
|
function _end_coverage() {
|
||||||
if(function_exists("xdebug_get_code_coverage")) {
|
if(function_exists("xdebug_get_code_coverage")) {
|
||||||
if(!file_exists("data/coverage")) mkdir("data/coverage");
|
$dir = getcwd();
|
||||||
$n = 0;
|
$end_cov = function() use ( $dir ) {
|
||||||
$t = time();
|
if(!file_exists("$dir/data/coverage")) mkdir("$dir/data/coverage");
|
||||||
while(file_exists("data/coverage/$t.$n.log")) $n++;
|
$n = 0;
|
||||||
file_put_contents("data/coverage/$t.$n.log", serialize(xdebug_get_code_coverage()));
|
$t = time();
|
||||||
|
while(file_exists("$dir/data/coverage/$t.$n.log")) $n++;
|
||||||
|
file_put_contents("$dir/data/coverage/$t.$n.log", serialize(xdebug_get_code_coverage()));
|
||||||
|
};
|
||||||
|
return $end_cov;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -68,7 +68,7 @@ require_once "config.php";
|
|||||||
require_once "core/util.inc.php";
|
require_once "core/util.inc.php";
|
||||||
if(COVERAGE) {
|
if(COVERAGE) {
|
||||||
_start_coverage();
|
_start_coverage();
|
||||||
register_shutdown_function("_end_coverage");
|
register_shutdown_function(_end_coverage());
|
||||||
}
|
}
|
||||||
_version_check();
|
_version_check();
|
||||||
_sanitise_environment();
|
_sanitise_environment();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user