Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
25abd7b7
Commit
25abd7b7
authored
May 05, 2017
by
Paul Yang
Committed by
GitHub
May 05, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add compatibility test for php. (#3041)
* Add compatibility test for php. * Revert API incompatible change.
parent
48339606
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
129 additions
and
4 deletions
+129
-4
.gitignore
.gitignore
+2
-0
Makefile.am
Makefile.am
+1
-0
pull_request_32.sh
jenkins/buildcmds/pull_request_32.sh
+1
-1
compatibility_test.sh
php/tests/compatibility_test.sh
+111
-0
test.sh
php/tests/test.sh
+2
-2
tests.sh
tests.sh
+12
-1
No files found.
.gitignore
View file @
25abd7b7
...
...
@@ -138,6 +138,8 @@ conformance/conformance-php-c
# php test output
composer.lock
php/tests/generated/
php/tests/old_protoc
php/tests/protobuf/
php/ext/google/protobuf/.libs/
php/ext/google/protobuf/Makefile.fragments
php/ext/google/protobuf/Makefile.global
...
...
Makefile.am
View file @
25abd7b7
...
...
@@ -651,6 +651,7 @@ php_EXTRA_DIST= \
php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php
\
php/tests/array_test.php
\
php/tests/autoload.php
\
php/tests/compatibility_test.sh
\
php/tests/encode_decode_test.php
\
php/tests/gdb_test.sh
\
php/tests/generated_class_test.php
\
...
...
jenkins/buildcmds/pull_request_32.sh
View file @
25abd7b7
...
...
@@ -12,5 +12,5 @@
export
DOCKERFILE_DIR
=
jenkins/docker32
export
DOCKER_RUN_SCRIPT
=
jenkins/pull_request_in_docker.sh
export
OUTPUT_DIR
=
testoutput
export
TEST_SET
=
"php_all"
export
TEST_SET
=
"php_all
_32
"
./jenkins/build_and_run_docker.sh
php/tests/compatibility_test.sh
0 → 100755
View file @
25abd7b7
#!/bin/bash
use_php
()
{
VERSION
=
$1
PHP
=
`
which php
`
PHP_CONFIG
=
`
which php-config
`
PHPIZE
=
`
which phpize
`
ln
-sfn
"/usr/local/php-
${
VERSION
}
/bin/php"
$PHP
ln
-sfn
"/usr/local/php-
${
VERSION
}
/bin/php-config"
$PHP_CONFIG
ln
-sfn
"/usr/local/php-
${
VERSION
}
/bin/phpize"
$PHPIZE
}
generate_proto
()
{
PROTOC1
=
$1
PROTOC2
=
$2
rm
-rf
generated
mkdir
generated
$PROTOC1
--php_out
=
generated proto/test_include.proto
$PROTOC2
--php_out
=
generated proto/test.proto proto/test_no_namespace.proto proto/test_prefix.proto
pushd
../../src
$PROTOC2
--php_out
=
../php/tests/generated google/protobuf/empty.proto
$PROTOC2
--php_out
=
../php/tests/generated
-I
../php/tests
-I
.
../php/tests/proto/test_import_descriptor_proto.proto
popd
}
set
-ex
# Change to the script's directory.
cd
$(
dirname
$0
)
# The old version of protobuf that we are testing compatibility against.
case
"
$1
"
in
""
|
3.3.0
)
OLD_VERSION
=
3.3.0
OLD_VERSION_PROTOC
=
http://repo1.maven.org/maven2/com/google/protobuf/protoc/3.3.0/protoc-3.3.0-linux-x86_64.exe
;;
*
)
echo
"[ERROR]: Unknown version number:
$1
"
exit
1
;;
esac
# Extract the latest protobuf version number.
VERSION_NUMBER
=
`
grep
"PHP_PROTOBUF_VERSION"
../ext/google/protobuf/protobuf.h |
sed
"s|#define PHP_PROTOBUF_VERSION
\"\(
.*
\)\"
|
\1
|"
`
echo
"Running compatibility tests between
$VERSION_NUMBER
and
$OLD_VERSION
"
# Check protoc
[
-f
../../src/protoc
]
||
{
echo
"[ERROR]: Please build protoc first."
exit
1
}
# Download old test.
rm
-rf
protobuf
git clone https://github.com/google/protobuf.git
pushd
protobuf
git checkout v
$OLD_VERSION
popd
# Build and copy the new runtime
use_php 5.5
pushd
../ext/google/protobuf
make clean
||
true
phpize
&&
./configure
&&
make
popd
rm
-rf
protobuf/php/ext
rm
-rf
protobuf/php/src
cp
-r
../ext protobuf/php/ext/
cp
-r
../src protobuf/php/src/
# Download old version protoc compiler (for linux)
wget
$OLD_VERSION_PROTOC
-O
old_protoc
chmod
+x old_protoc
NEW_PROTOC
=
`
pwd
`
/../../src/protoc
OLD_PROTOC
=
`
pwd
`
/old_protoc
cd
protobuf/php
cp
-r
/usr/local/vendor-5.5 vendor
wget https://phar.phpunit.de/phpunit-4.8.0.phar
-O
/usr/bin/phpunit
cd
tests
# Test A.1:
# proto set 1: use old version
# proto set 2 which may import protos in set 1: use old version
generate_proto
$OLD_PROTOC
$OLD_PROTOC
./test.sh
pushd
..
phpunit
popd
# Test A.2:
# proto set 1: use new version
# proto set 2 which may import protos in set 1: use old version
generate_proto
$NEW_PROTOC
$OLD_PROTOC
./test.sh
pushd
..
phpunit
popd
# Test A.3:
# proto set 1: use old version
# proto set 2 which may import protos in set 1: use new version
generate_proto
$OLD_PROTOC
$NEW_PROTOC
./test.sh
pushd
..
phpunit
popd
php/tests/test.sh
View file @
25abd7b7
...
...
@@ -2,10 +2,10 @@
# Compile c extension
pushd
../ext/google/protobuf/
make clean
make clean
||
true
set
-e
# Add following in configure for debug: --enable-debug CFLAGS='-g -O0'
phpize
&&
./configure
--enable-debug
CFLAGS
=
'-g -O0'
&&
make
phpize
&&
./configure
CFLAGS
=
'-g -O0'
&&
make
popd
tests
=(
array_test.php encode_decode_test.php generated_class_test.php map_field_test.php well_known_test.php
)
...
...
tests.sh
View file @
25abd7b7
...
...
@@ -545,7 +545,12 @@ build_php7.0_mac() {
popd
}
build_php_all
()
{
build_php_compatibility
()
{
internal_build_cpp
php/tests/compatibility_test.sh
}
build_php_all_32
()
{
build_php5.5
build_php5.6
build_php7.0
...
...
@@ -557,6 +562,11 @@ build_php_all() {
build_php7.0_zts_c
}
build_php_all
()
{
build_php_all_32
build_php_compatibility
}
# Note: travis currently does not support testing more than one language so the
# .travis.yml cheats and claims to only be cpp. If they add multiple language
# support, this should probably get updated to install steps and/or
...
...
@@ -595,6 +605,7 @@ Usage: $0 { cpp |
php5.6_c |
php7.0 |
php7.0_c |
php_compatibility |
php_all)
"
exit
1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment