Fix setting xdebug.mode

This commit is contained in:
Shivam Mathur 2020-12-17 20:49:20 +05:30
parent 8862a73fdd
commit d74064b67a
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
9 changed files with 21 additions and 25 deletions

View File

@ -24,7 +24,7 @@ describe('Config tests', () => {
true
);
expect(linux).toContain(
'echo "post_max_size=256M\nshort_open_tag=On\ndate.timezone=Asia/Kolkata" | sudo tee -a "${ini_file[@]}"'
'echo "post_max_size=256M\nshort_open_tag=On\ndate.timezone=Asia/Kolkata" | sudo tee -a "${pecl_file:-${ini_file[@]}}"'
);
linux = await config.addINIValues(
@ -40,7 +40,7 @@ describe('Config tests', () => {
'darwin'
);
expect(darwin).toContain(
'echo "post_max_size=256M\nshort_open_tag=On\ndate.timezone=Asia/Kolkata" | sudo tee -a "${ini_file[@]}"'
'echo "post_max_size=256M\nshort_open_tag=On\ndate.timezone=Asia/Kolkata" | sudo tee -a "${pecl_file:-${ini_file[@]}}"'
);
darwin = await config.addINIValues(

View File

@ -28,43 +28,36 @@ describe('Config tests', () => {
it('checking addCoverage with Xdebug on windows', async () => {
const win32: string = await coverage.addCoverage('xdebug', '7.4', 'win32');
expect(win32).toContain('Add-Extension xdebug');
expect(win32).toContain('xdebug.mode=coverage');
});
it('checking addCoverage with Xdebug on linux', async () => {
const linux: string = await coverage.addCoverage('xdebug', '8.0', 'linux');
expect(linux).toContain('add_extension xdebug');
expect(linux).toContain('echo "xdebug.mode=coverage"');
});
it('checking addCoverage with Xdebug3 on linux', async () => {
const linux: string = await coverage.addCoverage('xdebug3', '7.4', 'linux');
expect(linux).toContain('add_extension_from_source xdebug');
expect(linux).toContain('echo "xdebug.mode=coverage"');
});
it('checking addCoverage with Xdebug3 on linux', async () => {
const linux: string = await coverage.addCoverage('xdebug3', '8.0', 'linux');
expect(linux).toContain('add_extension xdebug');
expect(linux).toContain('echo "xdebug.mode=coverage"');
});
it('checking addCoverage with Xdebug on linux', async () => {
const linux: string = await coverage.addCoverage('xdebug', '8.0', 'linux');
expect(linux).toContain('add_extension xdebug');
expect(linux).toContain('echo "xdebug.mode=coverage"');
});
it('checking addCoverage with Xdebug3 on linux', async () => {
const linux: string = await coverage.addCoverage('xdebug3', '8.1', 'linux');
expect(linux).toContain('add_extension xdebug');
expect(linux).toContain('echo "xdebug.mode=coverage"');
});
it('checking addCoverage with Xdebug on linux', async () => {
const linux: string = await coverage.addCoverage('xdebug', '8.1', 'linux');
expect(linux).toContain('add_extension xdebug');
expect(linux).toContain('echo "xdebug.mode=coverage"');
});
it('checking addCoverage with Xdebug on darwin', async () => {

5
dist/index.js vendored
View File

@ -2337,9 +2337,8 @@ const config = __importStar(__webpack_require__(641));
async function addCoverageXdebug(extension, version, os_version, pipe) {
const xdebug = (await extensions.addExtension(extension, version, os_version, true)) +
pipe;
const ini = await config.addINIValues('xdebug.mode=coverage', os_version, true);
const log = await utils.addLog('$tick', extension, 'Xdebug enabled as coverage driver', os_version);
return [xdebug, ini, log].join('\n');
return xdebug + '\n' + log;
}
exports.addCoverageXdebug = addCoverageXdebug;
/**
@ -2474,7 +2473,7 @@ async function addINIValuesUnix(ini_values_csv) {
});
return ('echo "' +
ini_values.join('\n') +
'" | sudo tee -a "${ini_file[@]}" >/dev/null 2>&1' +
'" | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null 2>&1' +
script);
}
exports.addINIValuesUnix = addINIValuesUnix;

View File

@ -17,7 +17,7 @@ export async function addINIValuesUnix(
return (
'echo "' +
ini_values.join('\n') +
'" | sudo tee -a "${ini_file[@]}" >/dev/null 2>&1' +
'" | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null 2>&1' +
script
);
}

View File

@ -19,18 +19,13 @@ export async function addCoverageXdebug(
const xdebug =
(await extensions.addExtension(extension, version, os_version, true)) +
pipe;
const ini = await config.addINIValues(
'xdebug.mode=coverage',
os_version,
true
);
const log = await utils.addLog(
'$tick',
extension,
'Xdebug enabled as coverage driver',
os_version
);
return [xdebug, ini, log].join('\n');
return xdebug + '\n' + log;
}
/**

View File

@ -3,7 +3,8 @@ export tick="✓"
export cross="✗"
export curl_opts=(-sL)
export old_versions="5.[3-5]"
export jit_versions="8.[0-1]"
export jit_versions="8.[0-9]"
export xdebug3_versions="7.[2-4]|8.[0-9]"
export tool_path_dir="/usr/local/bin"
export composer_bin="$HOME/.composer/vendor/bin"
export composer_json="$HOME/.composer/composer.json"
@ -107,10 +108,19 @@ enable_extension() {
sudo phpenmod -v "$version" "$1" >/dev/null 2>&1
fi
if ! check_extension "$1" && [ -e "${ext_dir:?}/$1.so" ]; then
echo "$2=${ext_dir:?}/$1.so" >>"${pecl_file:-${ini_file[@]}}"
echo "$2=${ext_dir:?}/$1.so" | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null
fi
}
# Function to configure PHP
configure_php() {
(
echo -e "date.timezone=UTC\nmemory_limit=-1"
[[ "$version" =~ $jit_versions ]] && echo -e "opcache.enable=1\nopcache.jit_buffer_size=256M\nopcache.jit=1235"
[[ "$version" =~ $xdebug3_versions ]] && echo -e "xdebug.mode=coverage"
) | sudo tee -a "${pecl_file:-${ini_file[@]}}" >/dev/null
}
# Function to configure PECL.
configure_pecl() {
if ! [ -e /tmp/pecl_config ]; then

View File

@ -139,8 +139,7 @@ setup_php() {
fi
ini_file=$(php -d "date.timezone=UTC" --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
sudo chmod 777 "$ini_file" "${tool_path_dir:?}"
echo -e "date.timezone=UTC\nmemory_limit=-1" >>"$ini_file"
[[ "$version" =~ ${jit_versions:?} ]] && echo -e "opcache.enable=1\nopcache.jit_buffer_size=256M\nopcache.jit=1235" >>"$ini_file"
configure_php
ext_dir=$(php -i | grep -Ei "extension_dir => /" | sed -e "s|.*=> s*||")
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
sudo mkdir -m 777 -p "$ext_dir" "$HOME/.composer"

View File

@ -278,10 +278,10 @@ setup_php() {
pecl_file="$scan_dir"/99-pecl.ini
mapfile -t ini_file < <(sudo find "$ini_dir/.." -name "php.ini" -exec readlink -m {} +)
link_pecl_file
configure_php
sudo rm -rf /usr/local/bin/phpunit >/dev/null 2>&1
sudo chmod 777 "${ini_file[@]}" "$pecl_file" "${tool_path_dir:?}"
sudo cp "$dist"/../src/configs/*.json "$RUNNER_TOOL_CACHE/"
[[ "$version" =~ ${jit_versions:?} ]] && echo -e "opcache.enable=1\nopcache.jit_buffer_size=256M\nopcache.jit=1235" | sudo tee -a "${ini_file[@]}" >/dev/null 2>&1
add_log "${tick:?}" "PHP" "$status PHP $semver"
}

View File

@ -419,7 +419,7 @@ if($installed.MajorMinorVersion -ne $version) {
Add-Log $cross "PHP" "Could not setup PHP $version"
exit 1
}
('date.timezone=UTC', 'memory_limit=-1') | ForEach-Object { $p=$_.split('='); Set-PhpIniKey -Key $p[0] -Value $p[1] -Path $php_dir }
('date.timezone=UTC', 'memory_limit=-1', 'xdebug.mode=coverage') | ForEach-Object { $p=$_.split('='); Set-PhpIniKey -Key $p[0] -Value $p[1] -Path $php_dir }
if($version -lt "5.5") {
('libeay32.dll', 'ssleay32.dll') | ForEach-Object { Invoke-WebRequest -Uri $bintray/$_ -OutFile $php_dir\$_ >$null 2>&1 }
} else {