mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Use external diff tool if TEST_PHP_DIFF_CMD env var is set
This commit is contained in:
parent
7496a400aa
commit
d7d6794f94
1 changed files with 13 additions and 1 deletions
|
@ -2696,7 +2696,12 @@ COMMAND $cmd
|
|||
}
|
||||
|
||||
// write .diff
|
||||
if (!empty($environment['TEST_PHP_DIFF_CMD'])) {
|
||||
$diff = generate_diff_external($environment['TEST_PHP_DIFF_CMD'], $exp_filename, $output_filename);
|
||||
} else {
|
||||
$diff = generate_diff($wanted, $wanted_re, $output);
|
||||
}
|
||||
|
||||
if (is_array($IN_REDIRECT)) {
|
||||
$orig_shortname = str_replace(TEST_PHP_SRCDIR . '/', '', $file);
|
||||
$diff = "# original source file: $orig_shortname\n" . $diff;
|
||||
|
@ -2959,6 +2964,13 @@ function generate_array_diff(array $ar1, array $ar2, bool $is_reg, array $w): ar
|
|||
return $diff;
|
||||
}
|
||||
|
||||
function generate_diff_external(string $diff_cmd, string $exp_file, string $output_file): string
|
||||
{
|
||||
$retval = shell_exec("{$diff_cmd} {$exp_file} {$output_file}");
|
||||
|
||||
return is_string($retval) ? $retval : 'Could not run external diff tool set through PHP_TEST_DIFF_CMD environment variable';
|
||||
}
|
||||
|
||||
function generate_diff(string $wanted, ?string $wanted_re, string $output): string
|
||||
{
|
||||
$w = explode("\n", $wanted);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue