Skip to content
Permalink
Browse files

compatibility test between last released and current for java python …

…php (#6441)


* compatibility tests between last released and the current version
  • Loading branch information...
anandolee committed Aug 1, 2019
1 parent 5db5c26 commit d1eeb852fcbe46b29a3bc47001e997d79358d9f8
@@ -34,35 +34,13 @@ cd $(dirname $0)
# these tests).
TEST_VERSION=3.0.0

LAST_RELEASED=3.9.0

# The old version of protobuf that we are testing compatibility against. This
# is usually the same as TEST_VERSION (i.e., we use the tests extracted from
# that version to test compatibility of the newest runtime against it), but it
# is also possible to use this same test set to test the compatibiilty of the
# latest version against other versions.
case "$1" in
""|3.0.0)
OLD_VERSION=3.0.0
OLD_VERSION_PROTOC=http://repo1.maven.org/maven2/com/google/protobuf/protoc/3.0.0/protoc-3.0.0-linux-x86_64.exe
;;
3.0.2)
OLD_VERSION=3.0.2
OLD_VERSION_PROTOC=http://repo1.maven.org/maven2/com/google/protobuf/protoc/3.0.2/protoc-3.0.2-linux-x86_64.exe
;;
3.1.0)
OLD_VERSION=3.1.0
OLD_VERSION_PROTOC=http://repo1.maven.org/maven2/com/google/protobuf/protoc/3.1.0/protoc-3.1.0-linux-x86_64.exe
;;
$LAST_RELEASED)
OLD_VERSION=$LAST_RELEASED
OLD_VERSION_PROTOC=http://repo1.maven.org/maven2/com/google/protobuf/protoc/$OLD_VERSION/protoc-$OLD_VERSION-linux-x86_64.exe
;;
*)
echo "[ERROR]: Unknown version number: $1"
exit 1
;;
esac
OLD_VERSION=$1
OLD_VERSION_PROTOC=http://repo1.maven.org/maven2/com/google/protobuf/protoc/$OLD_VERSION/protoc-$OLD_VERSION-linux-x86_64.exe

echo "Running compatibility tests with $OLD_VERSION"

@@ -17,41 +17,13 @@ TEST_VERSION=`grep "^ <version>.*</version>" pom.xml | sed "s| <version>\(.*\)
# that version to test compatibility of the newest runtime against it), but it
# is also possible to use this same test set to test the compatibiilty of the
# latest version against other versions.
case "$1" in
""|2.5.0)
OLD_VERSION=2.5.0
OLD_VERSION_PROTOC=https://github.com/xfxyjwf/protobuf-compiler-release/raw/master/v2.5.0/linux/protoc
;;
2.6.1)
OLD_VERSION=2.6.1
OLD_VERSION_PROTOC=https://repo1.maven.org/maven2/com/google/protobuf/protoc/2.6.1-build2/protoc-2.6.1-build2-linux-x86_64.exe
;;
3.0.0-beta-1)
OLD_VERSION=3.0.0-beta-1
OLD_VERSION_PROTOC=https://repo1.maven.org/maven2/com/google/protobuf/protoc/3.0.0-beta-1/protoc-3.0.0-beta-1-linux-x86_64.exe
;;
3.0.0-beta-2)
OLD_VERSION=3.0.0-beta-2
OLD_VERSION_PROTOC=https://repo1.maven.org/maven2/com/google/protobuf/protoc/3.0.0-beta-2/protoc-3.0.0-beta-2-linux-x86_64.exe
;;
3.0.0-beta-3)
OLD_VERSION=3.0.0-beta-3
OLD_VERSION_PROTOC=https://repo1.maven.org/maven2/com/google/protobuf/protoc/3.0.0-beta-3/protoc-3.0.0-beta-3-linux-x86_64.exe
;;
3.0.0-beta-4)
OLD_VERSION=3.0.0-beta-4
OLD_VERSION_PROTOC=https://repo1.maven.org/maven2/com/google/protobuf/protoc/3.0.0-beta-4/protoc-3.0.0-beta-4-linux-x86_64.exe
;;
*)
echo "[ERROR]: Unknown version number: $1"
exit 1
;;
esac
OLD_VERSION=$1
OLD_VERSION_PROTOC=https://repo1.maven.org/maven2/com/google/protobuf/protoc/$OLD_VERSION/protoc-$OLD_VERSION-linux-x86_64.exe

# Extract the latest protobuf version number.
VERSION_NUMBER=`grep "^ <version>.*</version>" ../../pom.xml | sed "s| <version>\(.*\)</version>|\1|"`

echo "Running compatibility tests between $VERSION_NUMBER and $OLD_VERSION"
echo "Running compatibility tests between current $VERSION_NUMBER and released $OLD_VERSION"

# Check protoc
[ -f ../../../src/protoc ] || {
@@ -21,6 +21,8 @@ function generate_proto() {

$PROTOC1 --php_out=generated proto/test_include.proto
$PROTOC2 --php_out=generated \
-I../../src -I. \
proto/empty/echo.proto \
proto/test.proto \
proto/test_no_namespace.proto \
proto/test_prefix.proto \
@@ -34,6 +36,7 @@ function generate_proto() {
proto/test_reserved_message_upper.proto \
proto/test_service.proto \
proto/test_service_namespace.proto \
proto/test_wrapper_type_setters.proto \
proto/test_descriptors.proto

pushd ../../src
@@ -67,22 +70,13 @@ 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.5.0)
OLD_VERSION=3.5.0
OLD_VERSION_PROTOC=http://repo1.maven.org/maven2/com/google/protobuf/protoc/$OLD_VERSION/protoc-$OLD_VERSION-linux-x86_64.exe
;;
*)
echo "[ERROR]: Unknown version number: $1"
exit 1
;;
esac
OLD_VERSION=$1
OLD_VERSION_PROTOC=http://repo1.maven.org/maven2/com/google/protobuf/protoc/$OLD_VERSION/protoc-$OLD_VERSION-linux-x86_64.exe

# 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"
echo "Running compatibility tests between current $VERSION_NUMBER and released $OLD_VERSION"

# Check protoc
[ -f ../../src/protoc ] || {
@@ -14,41 +14,13 @@ TEST_VERSION=2.5.0
# that version to test compatibility of the newest runtime against it), but it
# is also possible to use this same test set to test the compatibiilty of the
# latest version against other versions.
case "$1" in
""|2.5.0)
OLD_VERSION=2.5.0
OLD_VERSION_PROTOC=https://github.com/xfxyjwf/protobuf-compiler-release/raw/master/v2.5.0/linux/protoc
;;
2.6.1)
OLD_VERSION=2.6.1
OLD_VERSION_PROTOC=http://repo1.maven.org/maven2/com/google/protobuf/protoc/2.6.1-build2/protoc-2.6.1-build2-linux-x86_64.exe
;;
3.0.0-beta-1)
OLD_VERSION=3.0.0-beta-1
OLD_VERSION_PROTOC=http://repo1.maven.org/maven2/com/google/protobuf/protoc/3.0.0-beta-1/protoc-3.0.0-beta-1-linux-x86_64.exe
;;
3.0.0-beta-2)
OLD_VERSION=3.0.0-beta-2
OLD_VERSION_PROTOC=http://repo1.maven.org/maven2/com/google/protobuf/protoc/3.0.0-beta-2/protoc-3.0.0-beta-2-linux-x86_64.exe
;;
3.0.0-beta-3)
OLD_VERSION=3.0.0-beta-3
OLD_VERSION_PROTOC=http://repo1.maven.org/maven2/com/google/protobuf/protoc/3.0.0-beta-3/protoc-3.0.0-beta-3-linux-x86_64.exe
;;
3.0.0-beta-4)
OLD_VERSION=3.0.0-beta-4
OLD_VERSION_PROTOC=http://repo1.maven.org/maven2/com/google/protobuf/protoc/3.0.0-beta-4/protoc-3.0.0-beta-4-linux-x86_64.exe
;;
*)
echo "[ERROR]: Unknown version number: $1"
exit 1
;;
esac
OLD_VERSION=$1
OLD_VERSION_PROTOC=http://repo1.maven.org/maven2/com/google/protobuf/protoc/$OLD_VERSION/protoc-$OLD_VERSION-linux-x86_64.exe

# Extract the latest protobuf version number.
VERSION_NUMBER=`grep "^__version__ = '.*'" ../../google/protobuf/__init__.py | sed "s|__version__ = '\(.*\)'|\1|"`

echo "Running compatibility tests between $VERSION_NUMBER and $OLD_VERSION"
echo "Running compatibility tests between current $VERSION_NUMBER and released $OLD_VERSION"

# Check protoc
[ -f ../../../src/protoc ] || {
@@ -6,6 +6,8 @@

# For when some other test needs the C++ main build, including protoc and
# libprotobuf.
LAST_RELEASED=3.9.0

internal_build_cpp() {
if [ -f src/protoc ]; then
# Already built.
@@ -148,7 +150,6 @@ build_csharp() {
# Run csharp compatibility test between 3.0.0 and the current version.
csharp/compatibility_tests/v3.0.0/test.sh 3.0.0

LAST_RELEASED=3.9.0
# Run csharp compatibility test between last released and the current version.
csharp/compatibility_tests/v3.0.0/test.sh $LAST_RELEASED
}
@@ -233,6 +234,9 @@ build_java_compatibility() {
# 3.0.0-beta-4 and the current version.
cd java/compatibility_tests/v2.5.0
./test.sh 3.0.0-beta-4

# Test the last released and current version.
./test.sh $LAST_RELEASED
}
build_java_linkage_monitor() {
# Linkage Monitor checks compatibility with other Google libraries
@@ -406,6 +410,9 @@ build_python_compatibility() {
./test.sh 2.5.0
# Test between 3.0.0-beta-1 and the current version.
./test.sh 3.0.0-beta-1

# Test between last released and current version.
./test.sh $LAST_RELEASED
}

build_ruby23() {
@@ -662,7 +669,7 @@ build_php7.0_mac() {

build_php_compatibility() {
internal_build_cpp
php/tests/compatibility_test.sh
php/tests/compatibility_test.sh $LAST_RELEASED
}

build_php7.1() {
@@ -49,20 +49,9 @@ def RewriteTextFile(filename, line_rewriter):
f.close()


def UpdateCsharp():
RewriteTextFile('csharp/compatibility_tests/v3.0.0/test.sh',
lambda line : re.sub(
r'LAST_RELEASED=.*$',
'LAST_RELEASED=%s' % NEW_VERSION,
line))
RewriteTextFile('tests.sh',
lambda line : re.sub(
r'LAST_RELEASED=.*$',
'LAST_RELEASED=%s' % NEW_VERSION,
line))

def UpdateTests():
RewriteTextFile('tests.sh',
lambda line : re.sub(
r'LAST_RELEASED=.*$',
'LAST_RELEASED=%s' % NEW_VERSION,
line))


UpdateCsharp()
UpdateTests()

0 comments on commit d1eeb85

Please sign in to comment.
You can’t perform that action at this time.