From d1eeb852fcbe46b29a3bc47001e997d79358d9f8 Mon Sep 17 00:00:00 2001 From: Jie Luo Date: Wed, 31 Jul 2019 17:49:26 -0700 Subject: [PATCH] compatibility test between last released and current for java python php (#6441) * compatibility tests between last released and the current version --- csharp/compatibility_tests/v3.0.0/test.sh | 26 ++--------------- java/compatibility_tests/v2.5.0/test.sh | 34 ++--------------------- php/tests/compatibility_test.sh | 18 ++++-------- python/compatibility_tests/v2.5.0/test.sh | 34 ++--------------------- tests.sh | 11 ++++++-- update_compatibility_version.py | 21 ++++---------- 6 files changed, 28 insertions(+), 116 deletions(-) diff --git a/csharp/compatibility_tests/v3.0.0/test.sh b/csharp/compatibility_tests/v3.0.0/test.sh index 7c6df4fcc8..4ee88fc8e9 100755 --- a/csharp/compatibility_tests/v3.0.0/test.sh +++ b/csharp/compatibility_tests/v3.0.0/test.sh @@ -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" diff --git a/java/compatibility_tests/v2.5.0/test.sh b/java/compatibility_tests/v2.5.0/test.sh index 860437809c..f67dc7616a 100755 --- a/java/compatibility_tests/v2.5.0/test.sh +++ b/java/compatibility_tests/v2.5.0/test.sh @@ -17,41 +17,13 @@ TEST_VERSION=`grep "^ .*" pom.xml | sed "s| \(.*\) # 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 "^ .*" ../../pom.xml | sed "s| \(.*\)|\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 ] || { diff --git a/php/tests/compatibility_test.sh b/php/tests/compatibility_test.sh index f4af52471b..8e1a75092b 100755 --- a/php/tests/compatibility_test.sh +++ b/php/tests/compatibility_test.sh @@ -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 ] || { diff --git a/python/compatibility_tests/v2.5.0/test.sh b/python/compatibility_tests/v2.5.0/test.sh index 78c16ad1ca..fb3e545f41 100755 --- a/python/compatibility_tests/v2.5.0/test.sh +++ b/python/compatibility_tests/v2.5.0/test.sh @@ -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 ] || { diff --git a/tests.sh b/tests.sh index 27db44424b..c0255beb0e 100755 --- a/tests.sh +++ b/tests.sh @@ -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() { diff --git a/update_compatibility_version.py b/update_compatibility_version.py index 7e11151996..574a41538e 100644 --- a/update_compatibility_version.py +++ b/update_compatibility_version.py @@ -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()