aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/run_tests/sanity
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-02-23 17:13:38 -0800
committerGravatar Craig Tiller <ctiller@google.com>2016-02-23 17:13:38 -0800
commit4ea4599a50abb9188927846dc9f5449dbf5e8537 (patch)
tree3e2bb7c622c6e847aeff2c8d4ca0022cefabaa35 /tools/run_tests/sanity
parent19fa540100a1b9c28cb9ad6147d1e8d5f9659d82 (diff)
parent0c24f974155809ce8524793c036c24493185fea8 (diff)
Merge github.com:grpc/grpc into naming-crisis
Diffstat (limited to 'tools/run_tests/sanity')
-rwxr-xr-xtools/run_tests/sanity/check_submodules.sh1
-rwxr-xr-xtools/run_tests/sanity/check_version.py97
-rw-r--r--tools/run_tests/sanity/sanity_tests.yaml4
3 files changed, 101 insertions, 1 deletions
diff --git a/tools/run_tests/sanity/check_submodules.sh b/tools/run_tests/sanity/check_submodules.sh
index f49230e49a..c08b382638 100755
--- a/tools/run_tests/sanity/check_submodules.sh
+++ b/tools/run_tests/sanity/check_submodules.sh
@@ -44,6 +44,7 @@ cat << EOF | awk '{ print $1 }' | sort > $want_submodules
9f897b25800d2f54f5c442ef01a60721aeca6d87 third_party/boringssl (version_for_cocoapods_1.0-67-g9f897b2)
05b155ff59114735ec8cd089f669c4c3d8f59029 third_party/gflags (v2.1.0-45-g05b155f)
c99458533a9b4c743ed51537e25989ea55944908 third_party/googletest (release-1.7.0)
+ 5497a1dfc91a86965383cdd1652e348345400435 third_party/nanopb (nanopb-0.3.3-10-g5497a1d)
d5fb408ddc281ffcadeb08699e65bb694656d0bd third_party/protobuf (v3.0.0-beta-2)
50893291621658f355bc5b4d450a8d06a563053d third_party/zlib (v1.2.8)
EOF
diff --git a/tools/run_tests/sanity/check_version.py b/tools/run_tests/sanity/check_version.py
new file mode 100755
index 0000000000..41dd5efe38
--- /dev/null
+++ b/tools/run_tests/sanity/check_version.py
@@ -0,0 +1,97 @@
+#!/usr/bin/env python2.7
+
+# Copyright 2016, Google Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import sys
+import yaml
+import os
+import re
+import subprocess
+
+errors = 0
+
+os.chdir(os.path.join(os.path.dirname(sys.argv[0]), '../../..'))
+
+# hack import paths to pick up extra code
+sys.path.insert(0, os.path.abspath('tools/buildgen/plugins'))
+from expand_version import Version
+
+try:
+ branch_name = subprocess.check_output(
+ 'git rev-parse --abbrev-ref HEAD',
+ shell=True)
+except:
+ print 'WARNING: not a git repository'
+ branch_name = None
+
+if branch_name is not None:
+ m = re.match(r'^release-([0-9]+)_([0-9]+)$', branch_name)
+ if m:
+ print 'RELEASE branch'
+ # version number should align with the branched version
+ check_version = lambda version: (
+ version.major == int(m.group(1)) and
+ version.minor == int(m.group(2)))
+ warning = 'Version key "%%s" value "%%s" should have a major version %s and minor version %s' % (m.group(1), m.group(2))
+ elif re.match(r'^debian/.*$', branch_name):
+ # no additional version checks for debian branches
+ check_version = lambda version: True
+ else:
+ # all other branches should have a -dev tag
+ check_version = lambda version: version.tag == 'dev'
+ warning = 'Version key "%s" value "%s" should have a -dev tag'
+else:
+ check_version = lambda version: True
+
+with open('build.yaml', 'r') as f:
+ build_yaml = yaml.load(f.read())
+
+settings = build_yaml['settings']
+
+top_version = Version(settings['version'])
+if not check_version(top_version):
+ errors += 1
+ print warning % ('version', top_version)
+
+for tag, value in settings.iteritems():
+ if re.match(r'^[a-z]+_version$', tag):
+ value = Version(value)
+ if value.major != top_version.major:
+ errors += 1
+ print 'major version mismatch on %s: %d vs %d' % (tag, value.major, top_version.major)
+ if value.minor != top_version.minor:
+ errors += 1
+ print 'minor version mismatch on %s: %d vs %d' % (tag, value.minor, top_version.minor)
+ if not check_version(value):
+ errors += 1
+ print warning % (tag, value)
+
+sys.exit(errors)
+
diff --git a/tools/run_tests/sanity/sanity_tests.yaml b/tools/run_tests/sanity/sanity_tests.yaml
index 809e6ce645..cffc180fb0 100644
--- a/tools/run_tests/sanity/sanity_tests.yaml
+++ b/tools/run_tests/sanity/sanity_tests.yaml
@@ -1,9 +1,11 @@
# a set of tests that are run in parallel for sanity tests
+- script: tools/run_tests/sanity/check_cache_mk.sh
- script: tools/run_tests/sanity/check_sources_and_headers.py
- script: tools/run_tests/sanity/check_submodules.sh
-- script: tools/run_tests/sanity/check_cache_mk.sh
+- script: tools/run_tests/sanity/check_version.py
- script: tools/buildgen/generate_projects.sh -j 3
cpu_cost: 3
- script: tools/distrib/check_copyright.py
- script: tools/distrib/clang_format_code.sh
- script: tools/distrib/check_trailing_newlines.sh
+- script: tools/distrib/check_nanopb_output.sh