Merge pull request #17728 from jerrycmh/memory_leak_test

Memory leak test for PHP unit tests
pull/17836/head
Stanley Cheung 6 years ago committed by GitHub
commit 30b80cadf9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      src/php/bin/run_tests.sh
  2. 2310
      src/php/tests/MemoryLeakTest/MemoryLeakTest.php
  3. 10
      src/php/tests/unit_tests/CallTest.php
  4. 7
      templates/tools/dockerfile/php_valgrind.include
  5. 1
      templates/tools/dockerfile/test/php7_jessie_x64/Dockerfile.template
  6. 1
      templates/tools/dockerfile/test/php_jessie_x64/Dockerfile.template
  7. 8
      tools/dockerfile/test/php7_jessie_x64/Dockerfile
  8. 8
      tools/dockerfile/test/php_jessie_x64/Dockerfile

@ -22,9 +22,17 @@ cd src/php/bin
source ./determine_extension_dir.sh
# in some jenkins macos machine, somehow the PHP build script can't find libgrpc.dylib
export DYLD_LIBRARY_PATH=$root/libs/$CONFIG
php $extension_dir -d max_execution_time=300 $(which phpunit) -v --debug \
--exclude-group persistent_list_bound_tests ../tests/unit_tests
php $extension_dir -d max_execution_time=300 $(which phpunit) -v --debug \
../tests/unit_tests/PersistentChannelTests
export ZEND_DONT_UNLOAD_MODULES=1
export USE_ZEND_ALLOC=0
# Detect whether valgrind is executable
if [ -x "$(command -v valgrind)" ]; then
valgrind --error-exitcode=10 --leak-check=yes php $extension_dir -d max_execution_time=300 \
../tests/MemoryLeakTest/MemoryLeakTest.php
fi

File diff suppressed because it is too large Load Diff

@ -86,6 +86,16 @@ class CallTest extends PHPUnit_Framework_TestCase
$this->assertTrue($result->send_metadata);
}
public function testAddMultiAndMultiValueMetadata()
{
$batch = [
Grpc\OP_SEND_INITIAL_METADATA => ['key1' => ['value1', 'value2'],
'key2' => ['value3', 'value4'],],
];
$result = $this->call->startBatch($batch);
$this->assertTrue($result->send_metadata);
}
public function testGetPeer()
{
$this->assertTrue(is_string($this->call->getPeer()));

@ -0,0 +1,7 @@
#=================
# PHP Test dependencies
# Install dependencies
RUN apt-get update && apt-get install -y ${'\\'}
valgrind

@ -19,6 +19,7 @@
<%include file="../../php7_deps.include"/>
<%include file="../../gcp_api_libraries.include"/>
<%include file="../../python_deps.include"/>
<%include file="../../php_valgrind.include"/>
<%include file="../../run_tests_addons.include"/>
# Define the default command.
CMD ["bash"]

@ -20,6 +20,7 @@
<%include file="../../gcp_api_libraries.include"/>
<%include file="../../python_deps.include"/>
<%include file="../../php_deps.include"/>
<%include file="../../php_valgrind.include"/>
<%include file="../../run_tests_addons.include"/>
# Define the default command.
CMD ["bash"]

@ -79,6 +79,14 @@ RUN pip install --upgrade pip==10.0.1
RUN pip install virtualenv
RUN pip install futures==2.2.0 enum34==1.0.4 protobuf==3.5.2.post1 six==1.10.0 twisted==17.5.0
#=================
# PHP Test dependencies
# Install dependencies
RUN apt-get update && apt-get install -y \
valgrind
RUN mkdir /var/local/jenkins

@ -76,6 +76,14 @@ RUN pip install futures==2.2.0 enum34==1.0.4 protobuf==3.5.2.post1 six==1.10.0 t
RUN apt-get update && apt-get install -y \
git php5 php5-dev phpunit unzip
#=================
# PHP Test dependencies
# Install dependencies
RUN apt-get update && apt-get install -y \
valgrind
RUN mkdir /var/local/jenkins

Loading…
Cancel
Save