diff --git a/tools/jenkins/run_jenkins.sh b/tools/jenkins/run_jenkins.sh index f4fdbc44218..93cf82d2607 100755 --- a/tools/jenkins/run_jenkins.sh +++ b/tools/jenkins/run_jenkins.sh @@ -92,7 +92,9 @@ then docker cp $DOCKER_CID:/var/local/git/grpc/report.xml $git_root sleep 4 docker rm $DOCKER_CID || true - +elif [ "$platform" == "interop" ] +then + python tools/run_tests/run_interops.py --language=$language elif [ "$platform" == "windows" ] then echo "building $language on Windows" diff --git a/tools/run_tests/jobset.py b/tools/run_tests/jobset.py index 46137f01f40..ec25b476102 100755 --- a/tools/run_tests/jobset.py +++ b/tools/run_tests/jobset.py @@ -206,7 +206,7 @@ class Job(object): do_newline=self._newline_on_success or self._travis) if self._bin_hash: update_cache.finished(self._spec.identity(), self._bin_hash) - elif self._state == _RUNNING and time.time() - self._start > 600: + elif self._state == _RUNNING and time.time() - self._start > 900: self._tempfile.seek(0) stdout = self._tempfile.read() filtered_stdout = filter(lambda x: x in string.printable, stdout.decode(errors='ignore')) diff --git a/tools/run_tests/run_interops.py b/tools/run_tests/run_interops.py new file mode 100755 index 00000000000..1cf268526dc --- /dev/null +++ b/tools/run_tests/run_interops.py @@ -0,0 +1,36 @@ +import argparse +import xml.etree.cElementTree as ET +import jobset + +argp = argparse.ArgumentParser(description='Run interop tests.') +argp.add_argument('-l', '--language', + choices=['build_only', 'c++'], + nargs='+', + default=['build_only']) +args = argp.parse_args() + +# build job +build_steps = 'tools/run_tests/run_interops_build.sh' +build_job = jobset.JobSpec(cmdline=build_steps, shortname='build') + +# test jobs +_TESTS = ['large_unary', 'empty_unary', 'ping_pong', 'client_streaming', 'server_streaming'] +jobs = [] +jobNumber = 0 +for lang in args.language: + for test in _TESTS: + test_job = jobset.JobSpec(cmdline=['tools/run_tests/run_interops_test.sh', '%s' % lang, '%s' % test], shortname=test) + jobs.append(test_job) + jobNumber+=1 + +root = ET.Element('testsuites') +testsuite = ET.SubElement(root, 'testsuite', id='1', package='grpc', name='tests') + +# always do the build of docker first, and then all the tests can run in parallel +jobset.run([build_job], maxjobs=1, xml_report=testsuite) +jobset.run(jobs, maxjobs=jobNumber, xml_report=testsuite) + +tree = ET.ElementTree(root) +tree.write('report.xml', encoding='UTF-8') + + diff --git a/tools/run_tests/run_interops_build.sh b/tools/run_tests/run_interops_build.sh new file mode 100755 index 00000000000..bbe36eed620 --- /dev/null +++ b/tools/run_tests/run_interops_build.sh @@ -0,0 +1,46 @@ +#!/bin/sh + +# Copyright 2015, 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. + +set -e + +#clean up any old docker files +sudo docker rmi -f grpc/cxx || true +sudo docker rmi -f grpc/base || true +sudo docker rmi -f 0.0.0.0:5000/grpc/base || true + +#prepare building by pulling down base images and necessary files +sudo docker pull 0.0.0.0:5000/grpc/base +sudo docker tag -f 0.0.0.0:5000/grpc/base grpc/base +gsutil cp -R gs://docker-interop-images/admin/service_account tools/dockerfile/grpc_cxx +gsutil cp -R gs://docker-interop-images/admin/cacerts tools/dockerfile/grpc_cxx + +#build docker file, add more languages later +sudo docker build --no-cache -t grpc/cxx tools/dockerfile/grpc_cxx diff --git a/tools/run_tests/run_interops_test.sh b/tools/run_tests/run_interops_test.sh new file mode 100755 index 00000000000..1d0eedad85a --- /dev/null +++ b/tools/run_tests/run_interops_test.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +# Copyright 2015, 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. + +language=$1 +test_case=$2 + +set -e +if [ "$language" = "c++" ] +then + sudo docker run grpc/cxx /var/local/git/grpc/bins/opt/interop_client --enable_ssl --use_prod_roots --server_host_override=grpc-test.sandbox.google.com --server_host=grpc-test.sandbox.google.com --server_port=443 --test_case=$test_case +else + echo "interop testss not added for $language" + exit 1 +fi +