Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add csharp compatibility tests between last released and the current version #6407

Merged
merged 5 commits into from
Jul 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions csharp/compatibility_tests/v3.0.0/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ 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
Expand All @@ -52,6 +54,10 @@ case "$1" in
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
Expand Down
4 changes: 4 additions & 0 deletions tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ 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
}

build_golang() {
Expand Down
68 changes: 68 additions & 0 deletions update_compatibility_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/usr/bin/env python
# Usage: ./update_compatibility_version.py <MAJOR>.<MINOR>.<MICRO> [<RC version>]
#
# Example:
# ./update_compatibility_version.py 3.7.1

import datetime
import re
import sys
from xml.dom import minidom

if len(sys.argv) < 2 or len(sys.argv) > 3:
print """
[ERROR] Please specify a version.

./update_version.py <MAJOR>.<MINOR>.<MICRO> [<RC version>]

Example:
./update_version.py 3.7.1 2
"""
exit(1)

NEW_VERSION = sys.argv[1]
NEW_VERSION_INFO = NEW_VERSION.split('.')
if len(NEW_VERSION_INFO) != 3:
print """
[ERROR] Version must be in the format <MAJOR>.<MINOR>.<MICRO>

Example:
./update_version.py 3.7.3
"""
exit(1)

if len(sys.argv) > 2:
RC_VERSION = int(sys.argv[2])
# Do not update compatibility versions for rc release
if RC_VERSION != 0:
exit(0)

def RewriteTextFile(filename, line_rewriter):
lines = open(filename, 'r').readlines()
updated_lines = []
for line in lines:
updated_lines.append(line_rewriter(line))
if lines == updated_lines:
print '%s was not updated. Please double check.' % filename
f = open(filename, 'w')
f.write(''.join(updated_lines))
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))

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


UpdateCsharp()
UpdateTests()