From 2c574ed77130ff4129bf47b0d5ddf2e33237daeb Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Wed, 6 Sep 2023 01:12:37 -0700 Subject: [PATCH] [PHP tests] Remove non-standard PHP memory leak test (#34257) This test is not giving us good signals while adding some long term maintenance cost. The way the test is set up and run was not standard. There are other sanitizer tests to test for memory leaks. --- src/php/bin/run_tests.sh | 19 ----- .../tests/MemoryLeakTest/MemoryLeakTest.php | 78 ------------------- 2 files changed, 97 deletions(-) delete mode 100644 src/php/tests/MemoryLeakTest/MemoryLeakTest.php diff --git a/src/php/bin/run_tests.sh b/src/php/bin/run_tests.sh index 60ce4775eb4..bcf8954bc39 100755 --- a/src/php/bin/run_tests.sh +++ b/src/php/bin/run_tests.sh @@ -38,22 +38,3 @@ if [[ "$SKIP_PERSISTENT_CHANNEL_TESTS" != "true" ]]; then $(which php) $extension_dir -d max_execution_time=300 $(which phpunit) -v --debug \ ../tests/unit_tests/PersistentChannelTests fi - -export ZEND_DONT_UNLOAD_MODULES=1 -export USE_ZEND_ALLOC=0 -# Detect whether valgrind is executable -if [ -x "$(command -v valgrind)" ]; then - # skip the memory leak test on ARM64 - # TODO(jtattermusch): reenable the test once https://github.com/grpc/grpc/issues/29098 is fixed. - if [ "$(uname -m)" != "aarch64" ]; then - $(which valgrind) --error-exitcode=10 --leak-check=yes \ - --errors-for-leak-kinds=definite \ - -v \ - --num-callers=30 \ - --suppressions=../tests/MemoryLeakTest/ignore_leaks.supp \ - $VALGRIND_UNDEF_VALUE_ERRORS \ - $(which php) $extension_dir -d max_execution_time=300 \ - ../tests/MemoryLeakTest/MemoryLeakTest.php - fi -fi - diff --git a/src/php/tests/MemoryLeakTest/MemoryLeakTest.php b/src/php/tests/MemoryLeakTest/MemoryLeakTest.php deleted file mode 100644 index e6124f54f18..00000000000 --- a/src/php/tests/MemoryLeakTest/MemoryLeakTest.php +++ /dev/null @@ -1,78 +0,0 @@ - "v1"]; -} - -function assertConnecting($state) -{ - assert(($state == GRPC\CHANNEL_CONNECTING || $state == GRPC\CHANNEL_TRANSIENT_FAILURE) == true); -} - -function waitUntilNotIdle($channel) { - for ($i = 0; $i < 10; $i++) { - $now = Grpc\Timeval::now(); - $deadline = $now->add(new Grpc\Timeval(10000)); - if ($channel->watchConnectivityState(GRPC\CHANNEL_IDLE, - $deadline)) { - return true; - } - } - assert(true == false); -} - -// Set up -$channel = new Grpc\Channel('localhost:50101', ['credentials' => Grpc\ChannelCredentials::createInsecure()]); - -// Test InsecureCredentials -assert('Grpc\Channel' == get_class($channel)); - -// Test ConnectivityState -$state = $channel->getConnectivityState(); -assert(0 == $state); - -$channel->close(); - -// Test GetTarget -$channel = new Grpc\Channel('localhost:50102', ['credentials' => Grpc\ChannelCredentials::createInsecure()]); -$target = $channel->getTarget(); -assert(is_string($target) == true); -$channel->close(); - -// Test WatchConnectivityState -$channel = new Grpc\Channel('localhost:50103', ['credentials' => Grpc\ChannelCredentials::createInsecure()]); -$now = Grpc\Timeval::now(); -$deadline = $now->add(new Grpc\Timeval(100*1000)); - -$state = $channel->watchConnectivityState(1, $deadline); -assert($state == true); - -unset($now); -unset($deadline); - -$channel->close();