Skip to content

Commit b5e1296

Browse files
authored
Use fixed run-tests script to run phpt tests and compile on debian buster (#998)
* Use fixed run-tests.php from PHP8.0 * modified run-tests.php * build everything using debian buster * run package tests on debian buster
1 parent 85cfe7f commit b5e1296

File tree

5 files changed

+3820
-17
lines changed

5 files changed

+3820
-17
lines changed

.ci/static-check-unit-test.sh

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,38 @@ trap onScriptExit EXIT
2727

2828
ensureSyslogIsRunning
2929

30-
## This make runs PHPT
31-
# Disable agent for auxiliary PHP processes to reduce noise in logs
32-
export ELASTIC_APM_ENABLED=false
30+
31+
PHP_EXECUTABLE=$(which php)
32+
33+
RUN_TESTS=$APP_FOLDER/src/ext/tests/run-tests.php
34+
AGENT_EXTENSION_DIR=$APP_FOLDER/src/ext/modules
35+
AGENT_EXTENSION=$AGENT_EXTENSION_DIR/elastic_apm.so
36+
37+
# ## This runs PHPT
38+
# # Disable agent for auxiliary PHP processes to reduce noise in logs
39+
export ELASTIC_APM_ENABLED=true
3340
for phptFile in ./tests/*.phpt; do
3441
msg="Running tests in \`${phptFile}' ..."
3542
echo "${msg}"
3643
this_script_name="$( basename "${BASH_SOURCE[0]}" )"
3744
logger -t "${this_script_name}" "${msg}"
3845

3946
# Disable exit-on-error
40-
set +e
41-
make test TESTS="--show-all ${phptFile}"
47+
# set +e
48+
TESTS="--show-all ${phptFile}"
49+
50+
INI_FILE=`php -d 'display_errors=stderr' -r 'echo php_ini_loaded_file();' 2> /dev/null`
51+
52+
if test "$INI_FILE"; then
53+
egrep -h -v $PHP_DEPRECATED_DIRECTIVES_REGEX "$INI_FILE" > /tmp/tmp-php.ini
54+
else
55+
echo > /tmp/tmp-php.ini
56+
fi
57+
58+
TEST_PHP_SRCDIR=$APP_FOLDER/src/ext TEST_PHP_EXECUTABLE=$PHP_EXECUTABLE $PHP_EXECUTABLE -n -c /tmp/tmp-php.ini $PHP_TEST_SETTINGS $RUN_TESTS -n -c /tmp/tmp-php.ini -d extension_dir=$AGENT_EXTENSION_DIR -d extension=$AGENT_EXTENSION $PHP_TEST_SHARED_EXTENSIONS $TESTS
4259
exitCode=$?
60+
rm /tmp/tmp-php.ini
61+
4362

4463
if [ ${exitCode} -ne 0 ] ; then
4564
echo "Tests in \`${phptFile}' failed"

Dockerfile

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ARG PHP_VERSION=7.2
2-
FROM php:${PHP_VERSION}-fpm
2+
FROM php:${PHP_VERSION}-fpm-buster
33

44
RUN apt-get -qq update \
55
&& apt-get -qq -y --no-install-recommends install \
@@ -52,8 +52,3 @@ CMD phpize \
5252

5353
# Create a link to extensions directory to make it easier accessible (paths are different between php releases)
5454
RUN ln -s `find /usr/local/lib/php/extensions/ -name opcache.so | head -n1 | xargs dirname` /tmp/extensions
55-
56-
# Patch run-tests.php to handle SKIPIF correctly in tests with agent debug logs enabled
57-
RUN find /usr/local/lib/php/ -name run-tests.php | xargs sed -i 's#if (!strncasecmp(\x27skip\x27, ltrim(\$output), 4))#if (!strncasecmp(\x27skip\x27, ltrim(\$output), 4) || strstr(\$output, \x27ElasticApmSkipTest\x27))#g'
58-
59-
RUN find /usr/local/lib/php/ -name run-tests.php | xargs sed -i 's#system_with_timeout("\$extra \$php \$pass_options -q \$ini_settings \$no_file_cache -d display_errors=0 \\"\$test_skipif\\"", \$env)#system_with_timeout("\$extra \$php \$pass_options -q \$ini_settings \$no_file_cache -d display_errors=0 \\"\$test_skipif\\" 2>\&1", \$env)#g'

Dockerfile.alpine

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,3 @@ CMD export CFLAGS="-std=gnu99 ${CFLAGS}" ; \
5454

5555
# Create a link to extensions directory to make it easier accessible (paths are different between php releases)
5656
RUN ln -s `find /usr/local/lib/php/extensions/ -name opcache.so | head -n1 | xargs dirname` /tmp/extensions
57-
58-
# Patch run-tests.php to handle SKIPIF correctly in tests with agent debug logs enabled
59-
RUN find /usr/local/lib/php/ -name run-tests.php | xargs sed -i 's#if (!strncasecmp(\x27skip\x27, ltrim(\$output), 4))#if (!strncasecmp("skip", ltrim(\$output), 4) || strstr(\$output, "ElasticApmSkipTest"))#g'
60-
61-
RUN find /usr/local/lib/php/ -name run-tests.php | xargs sed -i 's#system_with_timeout("\$extra \$php \$pass_options -q \$ini_settings \$no_file_cache -d display_errors=0 \\"\$test_skipif\\"", \$env)#system_with_timeout("\$extra \$php \$pass_options -q \$ini_settings \$no_file_cache -d display_errors=0 \\"\$test_skipif\\" 2>\&1", \$env)#g'

packaging/test/ubuntu/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ARG PHP_VERSION=7.2
2-
FROM php:${PHP_VERSION}-fpm
2+
FROM php:${PHP_VERSION}-fpm-buster
33

44
RUN apt-get -qq update \
55
&& apt-get -qq -y --no-install-recommends install \

0 commit comments

Comments
 (0)