From 8b87075924cfb3096bbf7dd8468c84849b95cfb8 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Tue, 4 May 2021 10:19:22 -0700 Subject: [PATCH] Updated and simplified PHP testing structure (#8558) * Simplified PHP testing setup. - Consolidated on a single autoloader, created by composer. - Consolidated on a single phpunit invocation strategy: we run phpunit on a directory, which will run all tests matching *Test.php in that directory. - We now rely on autoloading to import all test protos. require_once() calls for test protos are removed. - For now the valgrind tests are removed. A follow-up PR will re-enable them in a more robust way. * More improvements to PHP testing. 1. Replace custom PHPUnit-selection logic in test.sh with generic composer version selection. 2. Optimized both test proto generation and the custom extension build to avoid unnecessary work when the files are already up to date. * Added assertions to verify that the C test doesn't use PHP sources. * Updated tests.sh for the new PHP testing commands. * Removed obsolete rules from tests.sh. * Fixed generate_test_protos.sh for when tmp does not exist. Also removed undefined_test.php and fixed Makefile.am. * Added php8.0_all again which is still used. * Added missing file to Makefile.am. * Re-added php_all_32 rule which is also still used. * Updated testing commands for macOS and download composer. * Use /usr/local/bin on mac instead of /usr/bin, since the latter is not writable. --- Makefile.am | 8 +- php/composer.json | 9 +- php/generate_test_protos.sh | 27 + php/phpunit.xml | 18 - php/tests/DescriptorsTest.php | 2 - php/tests/GeneratedClassTest.php | 10 +- php/tests/GeneratedPhpdocTest.php | 2 - php/tests/PhpImplementationTest.php | 2 +- php/tests/autoload.php | 27 - php/tests/bootstrap_phpunit.php | 5 - php/tests/compile_extension.sh | 30 +- php/tests/force_c_ext.php | 14 + php/tests/generate_protos.sh | 16 - php/tests/memory_leak_test.php | 52 +- php/tests/test.sh | 72 --- php/tests/undefined_test.php | 920 ---------------------------- tests.sh | 204 +----- 17 files changed, 105 insertions(+), 1313 deletions(-) create mode 100755 php/generate_test_protos.sh delete mode 100644 php/phpunit.xml delete mode 100644 php/tests/autoload.php delete mode 100644 php/tests/bootstrap_phpunit.php create mode 100644 php/tests/force_c_ext.php delete mode 100755 php/tests/generate_protos.sh delete mode 100755 php/tests/test.sh delete mode 100644 php/tests/undefined_test.php diff --git a/Makefile.am b/Makefile.am index ac308d897b..cab595ded3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -824,7 +824,7 @@ php_EXTRA_DIST= \ php/ext/google/protobuf/protobuf.h \ php/ext/google/protobuf/wkt.inc \ php/generate_descriptor_protos.sh \ - php/phpunit.xml \ + php/generate_test_protos.sh \ php/prepare_c_extension.sh \ php/release.sh \ php/src/GPBMetadata/Google/Protobuf/Any.php \ @@ -953,14 +953,12 @@ php_EXTRA_DIST= \ php/src/Google/Protobuf/Value.php \ php/src/phpdoc.dist.xml \ php/tests/ArrayTest.php \ - php/tests/autoload.php \ - php/tests/bootstrap_phpunit.php \ php/tests/compatibility_test.sh \ php/tests/compile_extension.sh \ php/tests/DescriptorsTest.php \ php/tests/EncodeDecodeTest.php \ + php/tests/force_c_ext.php \ php/tests/gdb_test.sh \ - php/tests/generate_protos.sh \ php/tests/GeneratedClassTest.php \ php/tests/GeneratedPhpdocTest.php \ php/tests/GeneratedServiceTest.php \ @@ -987,10 +985,8 @@ php_EXTRA_DIST= \ php/tests/proto/test_service.proto \ php/tests/proto/test_service_namespace.proto \ php/tests/proto/test_wrapper_type_setters.proto \ - php/tests/test.sh \ php/tests/test_base.php \ php/tests/test_util.php \ - php/tests/undefined_test.php \ php/tests/valgrind.supp \ php/tests/WellKnownTest.php \ php/tests/WrapperTypeSettersTest.php diff --git a/php/composer.json b/php/composer.json index 4c1b5ac675..5ea49edb2e 100644 --- a/php/composer.json +++ b/php/composer.json @@ -6,7 +6,7 @@ "homepage": "https://developers.google.com/protocol-buffers/", "license": "BSD-3-Clause", "require": { - "php": ">=5.5.0" + "php": ">=7.0.0" }, "require-dev": { "phpunit/phpunit": ">=5.0.0" @@ -19,11 +19,12 @@ }, "autoload-dev": { "psr-4": { - "": "tests/generated" + "": "tmp" } }, "scripts": { - "test": "tests/generate_protos.sh && vendor/bin/phpunit", - "aggregate_metadata_test": "tests/generate_protos.sh --aggregate_metadata && vendor/bin/phpunit" + "test_c": "./generate_test_protos.sh && ./tests/compile_extension.sh && php -dextension=ext/google/protobuf/modules/protobuf.so vendor/bin/phpunit --bootstrap tests/force_c_ext.php tests", + "test": "./generate_test_protos.sh && vendor/bin/phpunit tests", + "aggregate_metadata_test": "./generate_test_protos.sh --aggregate_metadata && vendor/bin/phpunit tests" } } diff --git a/php/generate_test_protos.sh b/php/generate_test_protos.sh new file mode 100755 index 0000000000..0aa4bdbe43 --- /dev/null +++ b/php/generate_test_protos.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +set -e + +cd `dirname $0` + +if [[ -d tmp && -z $(find tests/proto ../src/protoc -newer tmp) ]]; then + # Generated protos are already present and up to date, so we can skip protoc. + # + # Protoc is very fast, but sometimes it is not available (like if we haven't + # built it in Docker). Skipping it helps us proceed in this case. + echo "Test protos are up-to-date, skipping protoc." + exit 0 +fi + +rm -rf tmp +mkdir -p tmp + +find tests/proto -type f -name "*.proto"| xargs ../src/protoc --php_out=tmp -I../src -Itests + +if [ "$1" = "--aggregate_metadata" ]; then + # Overwrite some of the files to use aggregation. + AGGREGATED_FILES="tests/proto/test.proto tests/proto/test_include.proto tests/proto/test_import_descriptor_proto.proto" + ../src/protoc --php_out=aggregate_metadata=foo#bar:tmp -I../src -Itests $AGGREGATED_FILES +fi + +echo "Generated test protos from tests/proto -> tmp" diff --git a/php/phpunit.xml b/php/phpunit.xml deleted file mode 100644 index 8e7583596b..0000000000 --- a/php/phpunit.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - tests/PhpImplementationTest.php - tests/ArrayTest.php - tests/EncodeDecodeTest.php - tests/GeneratedClassTest.php - tests/GeneratedPhpdocTest.php - tests/MapFieldTest.php - tests/WellKnownTest.php - tests/DescriptorsTest.php - tests/GeneratedServiceTest.php - tests/WrapperTypeSettersTest.php - - - diff --git a/php/tests/DescriptorsTest.php b/php/tests/DescriptorsTest.php index ca7e8f3690..4f17a49571 100644 --- a/php/tests/DescriptorsTest.php +++ b/php/tests/DescriptorsTest.php @@ -1,7 +1,5 @@ setOptionalNoNamespaceMessage($n); $repeatedNoNamespaceMessage = $m->getRepeatedNoNamespaceMessage(); - $repeatedNoNamespaceMessage[] = new NoNameSpaceMessage(); + $repeatedNoNamespaceMessage[] = new NoNamespaceMessage(); $m->setRepeatedNoNamespaceMessage($repeatedNoNamespaceMessage); // test nested messages @@ -775,9 +773,9 @@ class GeneratedClassTest extends TestBase public function testEnumWithoutNamespace() { $m = new TestMessage(); - $m->setOptionalNoNamespaceEnum(NoNameSpaceEnum::VALUE_A); + $m->setOptionalNoNamespaceEnum(NoNamespaceEnum::VALUE_A); $repeatedNoNamespaceEnum = $m->getRepeatedNoNamespaceEnum(); - $repeatedNoNamespaceEnum[] = NoNameSpaceEnum::VALUE_A; + $repeatedNoNamespaceEnum[] = NoNamespaceEnum::VALUE_A; $m->setRepeatedNoNamespaceEnum($repeatedNoNamespaceEnum); $this->assertTrue(true); } diff --git a/php/tests/GeneratedPhpdocTest.php b/php/tests/GeneratedPhpdocTest.php index 18963a9b39..a0b912b5e1 100644 --- a/php/tests/GeneratedPhpdocTest.php +++ b/php/tests/GeneratedPhpdocTest.php @@ -1,7 +1,5 @@ $value) { - $path = realpath($dir.DIRECTORY_SEPARATOR.$value); - if (!is_dir($path)) { - $results[] = $path; - } else if ($value != "." && $value != "..") { - getGeneratedFiles($path, $results); - } - } - return $results; -} - -foreach (getGeneratedFiles("generated") as $filename) -{ - if (!is_dir($filename)) { - include_once $filename; - } - -} - diff --git a/php/tests/bootstrap_phpunit.php b/php/tests/bootstrap_phpunit.php deleted file mode 100644 index 8452f15896..0000000000 --- a/php/tests/bootstrap_phpunit.php +++ /dev/null @@ -1,5 +0,0 @@ - /dev/null + +CONFIGURE_OPTIONS=("./configure" "--with-php-config=$(which php-config)") + +if [ "$1" != "--release" ]; then + CONFIGURE_OPTIONS+=("CFLAGS=-g -O0 -Wall") fi + +# If the PHP interpreter we are building against or the arguments +# have changed, we must regenerated the Makefile. +if [[ ! -f Makefile ]] || [[ "$(grep ' \$ ./configure' config.log)" != " $ ${CONFIGURE_OPTIONS[@]}" ]]; then + phpize --clean + rm -f configure.in configure.ac + phpize + "${CONFIGURE_OPTIONS[@]}" +fi + make -popd +popd > /dev/null diff --git a/php/tests/force_c_ext.php b/php/tests/force_c_ext.php new file mode 100644 index 0000000000..afc63c52fd --- /dev/null +++ b/php/tests/force_c_ext.php @@ -0,0 +1,14 @@ +assertSame(3, count($arr)); - - unset($arr[1]); - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testRemoveEmptyFail() - { - $arr = new RepeatedField(GPBType::INT32); - - unset($arr[0]); - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testMessageOffsetFail() - { - $arr = new RepeatedField(GPBType::INT32); - $arr[] = 0; - $arr[new Sub()] = 0; - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testStringOffsetFail() - { - $arr = new RepeatedField(GPBType::INT32); - $arr[] = 0; - $arr['abc'] = 0; - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testSetNonExistedOffsetFail() - { - $arr = new RepeatedField(GPBType::INT32); - $arr[0] = 0; - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testInt32FieldInvalidTypeFail() - { - $m = new TestMessage(); - $m->setOptionalInt32(new TestMessage()); - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testInt32FieldInvalidStringFail() - { - $m = new TestMessage(); - $m->setOptionalInt32('abc'); - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testUint32FieldInvalidTypeFail() - { - $m = new TestMessage(); - $m->setOptionalUint32(new TestMessage()); - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testUint32FieldInvalidStringFail() - { - $m = new TestMessage(); - $m->setOptionalUint32('abc'); - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testInt64FieldInvalidTypeFail() - { - $m = new TestMessage(); - $m->setOptionalInt64(new TestMessage()); - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testInt64FieldInvalidStringFail() - { - $m = new TestMessage(); - $m->setOptionalInt64('abc'); - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testUint64FieldInvalidTypeFail() - { - $m = new TestMessage(); - $m->setOptionalUint64(new TestMessage()); - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testUint64FieldInvalidStringFail() - { - $m = new TestMessage(); - $m->setOptionalUint64('abc'); - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testFloatFieldInvalidTypeFail() - { - $m = new TestMessage(); - $m->setOptionalFloat(new TestMessage()); - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testFloatFieldInvalidStringFail() - { - $m = new TestMessage(); - $m->setOptionalFloat('abc'); - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testDoubleFieldInvalidTypeFail() - { - $m = new TestMessage(); - $m->setOptionalDouble(new TestMessage()); - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testDoubleFieldInvalidStringFail() - { - $m = new TestMessage(); - $m->setOptionalDouble('abc'); - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testBoolFieldInvalidStringFail() - { - $m = new TestMessage(); - $m->setOptionalBool(new TestMessage()); - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testStringFieldInvalidUTF8Fail() - { - $m = new TestMessage(); - $hex = hex2bin("ff"); - $m->setOptionalString($hex); - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testMessageFieldWrongTypeFail() - { - $m = new TestMessage(); - $a = 1; - $m->setOptionalMessage($a); - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testMessageFieldWrongClassFail() - { - $m = new TestMessage(); - $m->setOptionalMessage(new TestMessage()); - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testRepeatedFieldWrongTypeFail() - { - $m = new TestMessage(); - $a = 1; - $m->setRepeatedInt32($a); - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testRepeatedFieldWrongObjectFail() - { - $m = new TestMessage(); - $m->setRepeatedInt32($m); - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testRepeatedFieldWrongRepeatedTypeFail() - { - $m = new TestMessage(); - - $repeated_int32 = new RepeatedField(GPBType::UINT32); - $m->setRepeatedInt32($repeated_int32); - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testRepeatedFieldWrongRepeatedMessageClassFail() - { - $m = new TestMessage(); - - $repeated_message = new RepeatedField(GPBType::MESSAGE, - TestMessage::class); - $m->setRepeatedMessage($repeated_message); - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testMapFieldWrongTypeFail() - { - $m = new TestMessage(); - $a = 1; - $m->setMapInt32Int32($a); - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testMapFieldWrongObjectFail() - { - $m = new TestMessage(); - $m->setMapInt32Int32($m); - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testMapFieldWrongRepeatedTypeFail() - { - $m = new TestMessage(); - - $map_uint32_uint32 = new MapField(GPBType::UINT32, GPBType::UINT32); - $m->setMapInt32Int32($map_uint32_uint32); - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testMapFieldWrongRepeatedMessageClassFail() - { - $m = new TestMessage(); - - $map_int32_message = new MapField(GPBType::INT32, - GPBType::MESSAGE, - TestMessage::class); - $m->setMapInt32Message($map_int32_message); - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testMessageMergeFromInvalidTypeFail() - { - $m = new TestMessage(); - $n = new Sub(); - $m->mergeFrom($n); - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testInt32SetStringKeyFail() - { - $arr = new MapField(GPBType::INT32, GPBType::INT32); - $arr['abc'] = 0; - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testInt32SetStringValueFail() - { - $arr = new MapField(GPBType::INT32, GPBType::INT32); - $arr[0] = 'abc'; - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testInt32SetMessageKeyFail() - { - $arr = new MapField(GPBType::INT32, GPBType::INT32); - $arr[new Sub()] = 0; - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testInt32SetMessageValueFail() - { - $arr = new MapField(GPBType::INT32, GPBType::INT32); - $arr[0] = new Sub(); - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testUint32SetStringKeyFail() - { - $arr = new MapField(GPBType::UINT32, GPBType::UINT32); - $arr['abc'] = 0; - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testUint32SetStringValueFail() - { - $arr = new MapField(GPBType::UINT32, GPBType::UINT32); - $arr[0] = 'abc'; - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testUint32SetMessageKeyFail() - { - $arr = new MapField(GPBType::UINT32, GPBType::UINT32); - $arr[new Sub()] = 0; - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testUint32SetMessageValueFail() - { - $arr = new MapField(GPBType::UINT32, GPBType::UINT32); - $arr[0] = new Sub(); - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testInt64SetStringKeyFail() - { - $arr = new MapField(GPBType::INT64, GPBType::INT64); - $arr['abc'] = 0; - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testInt64SetStringValueFail() - { - $arr = new MapField(GPBType::INT64, GPBType::INT64); - $arr[0] = 'abc'; - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testInt64SetMessageKeyFail() - { - $arr = new MapField(GPBType::INT64, GPBType::INT64); - $arr[new Sub()] = 0; - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testInt64SetMessageValueFail() - { - $arr = new MapField(GPBType::INT64, GPBType::INT64); - $arr[0] = new Sub(); - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testUint64SetStringKeyFail() - { - $arr = new MapField(GPBType::UINT64, GPBType::UINT64); - $arr['abc'] = 0; - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testUint64SetStringValueFail() - { - $arr = new MapField(GPBType::UINT64, GPBType::UINT64); - $arr[0] = 'abc'; - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testUint64SetMessageKeyFail() - { - $arr = new MapField(GPBType::UINT64, GPBType::UINT64); - $arr[new Sub()] = 0; - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testUint64SetMessageValueFail() - { - $arr = new MapField(GPBType::UINT64, GPBType::UINT64); - $arr[0] = new Sub(); - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testDoubleSetStringValueFail() - { - $arr = new MapField(GPBType::INT64, GPBType::DOUBLE); - $arr[0] = 'abc'; - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testDoubleSetMessageValueFail() - { - $arr = new MapField(GPBType::INT64, GPBType::DOUBLE); - $arr[0] = new Sub(); - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testBoolSetMessageKeyFail() - { - $arr = new MapField(GPBType::BOOL, GPBType::BOOL); - $arr[new Sub()] = true; - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testBoolSetMessageValueFail() - { - $arr = new MapField(GPBType::BOOL, GPBType::BOOL); - $arr[true] = new Sub(); - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testStringSetInvalidUTF8KeyFail() - { - $arr = new MapField(GPBType::STRING, GPBType::STRING); - $arr[hex2bin("ff")] = 'abc'; - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testStringSetInvalidUTF8ValueFail() - { - $arr = new MapField(GPBType::STRING, GPBType::STRING); - $arr['abc'] = hex2bin("ff"); - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testStringSetMessageKeyFail() - { - $arr = new MapField(GPBType::STRING, GPBType::STRING); - $arr[new Sub()] = 'abc'; - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testStringSetMessageValueFail() - { - $arr = new MapField(GPBType::STRING, GPBType::STRING); - $arr['abc'] = new Sub(); - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testMessageSetIntValueFail() - { - $arr = - new MapField(GPBType::INT32, GPBType::MESSAGE, TestMessage::class); - $arr[0] = 0; - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testMessageSetStringValueFail() - { - $arr = - new MapField(GPBType::INT32, GPBType::MESSAGE, TestMessage::class); - $arr[0] = 'abc'; - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testMessageSetOtherMessageValueFail() - { - $arr = - new MapField(GPBType::INT32, GPBType::MESSAGE, TestMessage::class); - $arr[0] = new Sub(); - } - - /** - * @expectedException PHPUnit_Framework_Error - */ - public function testMessageSetNullFailMap() - { - $arr = - new MapField(GPBType::INT32, GPBType::MESSAGE, TestMessage::class); - $null = NULL; - $arr[0] = $null; - } - -} diff --git a/tests.sh b/tests.sh index 8e0e5439db..e9dbed7b50 100755 --- a/tests.sh +++ b/tests.sh @@ -467,14 +467,8 @@ use_php() { internal_build_cpp } -use_php_zts() { - VERSION=$1 - export PATH=/usr/local/php-${VERSION}-zts/bin:$PATH - internal_build_cpp -} - -build_php5.6() { - use_php 5.6 +build_php() { + use_php $1 pushd php rm -rf vendor composer update @@ -483,41 +477,18 @@ build_php5.6() { (cd conformance && make test_php) } -build_php7.0() { - use_php 7.0 +test_php_c() { pushd php rm -rf vendor composer update - composer test - popd - (cd conformance && make test_php) -} - -build_php7.0_c() { - use_php 7.0 - php/tests/test.sh - pushd conformance - make test_php_c - popd -} - -build_php7.0_mixed() { - use_php 7.0 - pushd php - rm -rf vendor - composer update - tests/compile_extension.sh - tests/generate_protos.sh - php -dextension=./ext/google/protobuf/modules/protobuf.so ./vendor/bin/phpunit + composer test_c popd + (cd conformance && make test_php_c) } -build_php7.0_zts_c() { - use_php_zts 7.0 - php/tests/test.sh - pushd conformance - make test_php_c - popd +build_php_c() { + use_php $1 + test_php_c } build_php7.0_mac() { @@ -528,14 +499,17 @@ build_php7.0_mac() { test ! -z "$PHP_FOLDER" export PATH="$PHP_FOLDER/bin:$PATH" + # Install Composer + wget https://getcomposer.org/download/2.0.13/composer.phar --progress=dot:mega -O /usr/local/bin/composer + chmod a+x /usr/local/bin/composer + # Install valgrind echo "#! /bin/bash" > valgrind chmod ug+x valgrind sudo mv valgrind /usr/local/bin/valgrind # Test - php/tests/test.sh - (cd conformance && make test_php_c) + test_php_c } build_php7.3_mac() { @@ -548,14 +522,17 @@ build_php7.3_mac() { test ! -z "$PHP_FOLDER" export PATH="$PHP_FOLDER/bin:$PATH" + # Install Composer + wget https://getcomposer.org/download/2.0.13/composer.phar --progress=dot:mega -O /usr/local/bin/composer + chmod a+x /usr/local/bin/composer + # Install valgrind echo "#! /bin/bash" > valgrind chmod ug+x valgrind sudo mv valgrind /usr/local/bin/valgrind # Test - php/tests/test.sh - (cd conformance && make test_php_c) + test_php_c } build_php_compatibility() { @@ -568,137 +545,25 @@ build_php_multirequest() { php/tests/multirequest.sh } -build_php7.1() { - use_php 7.1 - pushd php - rm -rf vendor - composer update - composer test - popd - (cd conformance && make test_php) -} - -build_php7.1_c() { - use_php 7.1 - php/tests/test.sh - pushd conformance - make test_php_c - popd -} - -build_php7.1_mixed() { - use_php 7.1 - pushd php - rm -rf vendor - composer update - tests/compile_extension.sh - tests/generate_protos.sh - php -dextension=./ext/google/protobuf/modules/protobuf.so ./vendor/bin/phpunit - popd -} - -build_php7.1_zts_c() { - use_php_zts 7.1 - php/tests/test.sh - pushd conformance - make test_php_c - popd -} - -build_php7.4() { - use_php 7.4 - pushd php - rm -rf vendor - composer update - composer test - popd - (cd conformance && make test_php) -} - -build_php7.4_c() { - use_php 7.4 - php/tests/test.sh - pushd conformance - make test_php_c - popd -} - -build_php7.4_mixed() { - use_php 7.4 - pushd php - rm -rf vendor - composer update - tests/compile_extension.sh - tests/generate_protos.sh - php -dextension=./ext/google/protobuf/modules/protobuf.so ./vendor/bin/phpunit - popd -} - -build_php7.4_zts_c() { - use_php_zts 7.4 - php/tests/test.sh - pushd conformance - make test_php_c - popd -} - -build_php8.0() { - use_php 8.0 - pushd php - rm -rf vendor - composer update - composer test - popd - (cd conformance && make test_php) -} - -build_php8.0_c() { - use_php 8.0 - php/tests/test.sh - pushd conformance - make test_php_c - popd -} - -build_php8.0_c_64() { - build_php8.0_c true -} - -build_php8.0_mixed() { - use_php 8.0 - pushd php - rm -rf vendor - composer update - tests/compile_extension.sh - tests/generate_protos.sh - php -dextension=./ext/google/protobuf/modules/protobuf.so ./vendor/bin/phpunit - popd -} - build_php8.0_all() { - build_php8.0 - build_php8.0_c_64 - build_php8.0_mixed + build_php 8.0 + build_php_c 8.0 } build_php_all_32() { - build_php5.6 - build_php7.0 - build_php7.1 - build_php7.4 - build_php7.0_c $1 - build_php7.1_c $1 - build_php7.4_c $1 - build_php7.0_mixed - build_php7.1_mixed - build_php7.4_mixed - build_php7.0_zts_c $1 - build_php7.1_zts_c $1 - build_php7.4_zts_c $1 + build_php 7.0 + build_php 7.1 + build_php 7.4 + build_php_c 7.0 + build_php_c 7.1 + build_php_c 7.4 + build_php_c 7.1-zts + build_php_c 7.2-zts + build_php_c 7.5-zts } build_php_all() { - build_php_all_32 true + build_php_all_32 build_php_multirequest build_php_compatibility } @@ -737,13 +602,10 @@ Usage: $0 { cpp | ruby30 | jruby | ruby_all | - php7.0 | - php7.0_c | - php_compatibility | - php7.1 | - php7.1_c | php_all | - php8.0_all | + php_all_32 | + php7.0_mac | + php7.3_mac | dist_install | benchmark) "