aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.pylintrc10
-rw-r--r--.pylintrc-tests9
-rw-r--r--src/python/grpcio/grpc/_auth.py2
-rw-r--r--src/python/grpcio/grpc/_channel.py14
-rw-r--r--src/python/grpcio/grpc/_utilities.py3
-rw-r--r--src/python/grpcio_testing/grpc_testing/_server/_handler.py2
-rw-r--r--src/python/grpcio_tests/tests/_runner.py2
-rw-r--r--src/python/grpcio_tests/tests/protoc_plugin/_split_definitions_test.py8
-rw-r--r--src/python/grpcio_tests/tests/protoc_plugin/beta_python_plugin_test.py2
-rw-r--r--src/python/grpcio_tests/tests/qps/benchmark_client.py2
-rw-r--r--src/python/grpcio_tests/tests/qps/client_runner.py2
-rw-r--r--src/python/grpcio_tests/tests/qps/worker_server.py2
-rw-r--r--src/python/grpcio_tests/tests/stress/client.py4
-rw-r--r--src/python/grpcio_tests/tests/testing/_client_application.py4
-rw-r--r--src/python/grpcio_tests/tests/unit/_from_grpc_import_star.py2
-rw-r--r--templates/tools/dockerfile/test/sanity/Dockerfile.template22
-rwxr-xr-xtools/distrib/pylint_code.sh6
-rw-r--r--tools/dockerfile/test/sanity/Dockerfile38
-rwxr-xr-xtools/run_tests/artifacts/build_artifact_protoc.sh1
-rwxr-xr-xtools/run_tests/artifacts/build_artifact_ruby.sh2
-rwxr-xr-xtools/run_tests/artifacts/run_in_workspace.sh3
-rwxr-xr-xtools/run_tests/dockerize/build_and_run_docker.sh2
-rwxr-xr-xtools/run_tests/dockerize/build_docker_and_run_tests.sh4
-rwxr-xr-xtools/run_tests/dockerize/build_interop_image.sh2
-rwxr-xr-xtools/run_tests/dockerize/docker_run_tests.sh2
-rwxr-xr-xtools/run_tests/helper_scripts/run_grpc-node.sh2
-rwxr-xr-xtools/run_tests/helper_scripts/run_tests_in_workspace.sh3
-rwxr-xr-xtools/run_tests/interop/with_nvm.sh1
-rwxr-xr-xtools/run_tests/interop/with_rvm.sh1
-rwxr-xr-xtools/run_tests/performance/build_performance.sh1
-rwxr-xr-xtools/run_tests/performance/build_performance_go.sh3
-rwxr-xr-xtools/run_tests/performance/build_performance_node.sh1
-rwxr-xr-xtools/run_tests/performance/run_worker_go.sh3
-rwxr-xr-xtools/run_tests/performance/run_worker_node.sh1
-rwxr-xr-xtools/run_tests/performance/run_worker_php.sh1
-rwxr-xr-xtools/run_tests/performance/run_worker_ruby.sh1
36 files changed, 97 insertions, 71 deletions
diff --git a/.pylintrc b/.pylintrc
index 90e8989ffc..ba74decb04 100644
--- a/.pylintrc
+++ b/.pylintrc
@@ -1,3 +1,11 @@
+[MASTER]
+ignore=
+ src/python/grpcio/grpc/beta,
+ src/python/grpcio/grpc/framework,
+ src/python/grpcio/grpc/framework/common,
+ src/python/grpcio/grpc/framework/foundation,
+ src/python/grpcio/grpc/framework/interfaces,
+
[VARIABLES]
# TODO(https://github.com/PyCQA/pylint/issues/1345): How does the inspection
@@ -82,3 +90,5 @@ disable=
# if:/else: and for:/else:.
useless-else-on-loop,
no-else-return,
+ # NOTE(lidiz): Python 3 make object inheritance default, but not PY2
+ useless-object-inheritance,
diff --git a/.pylintrc-tests b/.pylintrc-tests
index e68755c674..d9cc4d107e 100644
--- a/.pylintrc-tests
+++ b/.pylintrc-tests
@@ -1,3 +1,10 @@
+[MASTER]
+ignore=
+ src/python/grpcio_tests/tests/unit/beta,
+ src/python/grpcio_tests/tests/unit/framework,
+ src/python/grpcio_tests/tests/unit/framework/common,
+ src/python/grpcio_tests/tests/unit/framework/foundation,
+
[VARIABLES]
# TODO(https://github.com/PyCQA/pylint/issues/1345): How does the inspection
@@ -115,3 +122,5 @@ disable=
# if:/else: and for:/else:.
useless-else-on-loop,
no-else-return,
+ # NOTE(lidiz): Python 3 make object inheritance default, but not PY2
+ useless-object-inheritance,
diff --git a/src/python/grpcio/grpc/_auth.py b/src/python/grpcio/grpc/_auth.py
index c17824563d..9b990f490d 100644
--- a/src/python/grpcio/grpc/_auth.py
+++ b/src/python/grpcio/grpc/_auth.py
@@ -46,7 +46,7 @@ class GoogleCallCredentials(grpc.AuthMetadataPlugin):
# Hack to determine if these are JWT creds and we need to pass
# additional_claims when getting a token
- self._is_jwt = 'additional_claims' in inspect.getargspec(
+ self._is_jwt = 'additional_claims' in inspect.getargspec( # pylint: disable=deprecated-method
credentials.get_access_token).args
def __call__(self, context, callback):
diff --git a/src/python/grpcio/grpc/_channel.py b/src/python/grpcio/grpc/_channel.py
index 96118badad..8051fb306c 100644
--- a/src/python/grpcio/grpc/_channel.py
+++ b/src/python/grpcio/grpc/_channel.py
@@ -526,7 +526,7 @@ class _UnaryUnaryMultiCallable(grpc.UnaryUnaryMultiCallable):
state, operations, deadline, rendezvous = self._prepare(
request, timeout, metadata, wait_for_ready)
if state is None:
- raise rendezvous
+ raise rendezvous # pylint: disable-msg=raising-bad-type
else:
call = self._channel.segregated_call(
cygrpc.PropagationConstants.GRPC_PROPAGATE_DEFAULTS,
@@ -537,7 +537,7 @@ class _UnaryUnaryMultiCallable(grpc.UnaryUnaryMultiCallable):
),), self._context)
event = call.next_event()
_handle_event(event, state, self._response_deserializer)
- return state, call,
+ return state, call
def __call__(self,
request,
@@ -568,7 +568,7 @@ class _UnaryUnaryMultiCallable(grpc.UnaryUnaryMultiCallable):
state, operations, deadline, rendezvous = self._prepare(
request, timeout, metadata, wait_for_ready)
if state is None:
- raise rendezvous
+ raise rendezvous # pylint: disable-msg=raising-bad-type
else:
event_handler = _event_handler(state, self._response_deserializer)
call = self._managed_call(
@@ -603,7 +603,7 @@ class _UnaryStreamMultiCallable(grpc.UnaryStreamMultiCallable):
initial_metadata_flags = _InitialMetadataFlags().with_wait_for_ready(
wait_for_ready)
if serialized_request is None:
- raise rendezvous
+ raise rendezvous # pylint: disable-msg=raising-bad-type
else:
state = _RPCState(_UNARY_STREAM_INITIAL_DUE, None, None, None, None)
operationses = (
@@ -660,7 +660,7 @@ class _StreamUnaryMultiCallable(grpc.StreamUnaryMultiCallable):
state.condition.notify_all()
if not state.due:
break
- return state, call,
+ return state, call
def __call__(self,
request_iterator,
@@ -755,10 +755,10 @@ class _InitialMetadataFlags(int):
def with_wait_for_ready(self, wait_for_ready):
if wait_for_ready is not None:
if wait_for_ready:
- self = self.__class__(self | cygrpc.InitialMetadataFlags.wait_for_ready | \
+ return self.__class__(self | cygrpc.InitialMetadataFlags.wait_for_ready | \
cygrpc.InitialMetadataFlags.wait_for_ready_explicitly_set)
elif not wait_for_ready:
- self = self.__class__(self & ~cygrpc.InitialMetadataFlags.wait_for_ready | \
+ return self.__class__(self & ~cygrpc.InitialMetadataFlags.wait_for_ready | \
cygrpc.InitialMetadataFlags.wait_for_ready_explicitly_set)
return self
diff --git a/src/python/grpcio/grpc/_utilities.py b/src/python/grpcio/grpc/_utilities.py
index d90b34bcbd..2938a38b44 100644
--- a/src/python/grpcio/grpc/_utilities.py
+++ b/src/python/grpcio/grpc/_utilities.py
@@ -132,15 +132,12 @@ class _ChannelReadyFuture(grpc.Future):
def result(self, timeout=None):
self._block(timeout)
- return None
def exception(self, timeout=None):
self._block(timeout)
- return None
def traceback(self, timeout=None):
self._block(timeout)
- return None
def add_done_callback(self, fn):
with self._condition:
diff --git a/src/python/grpcio_testing/grpc_testing/_server/_handler.py b/src/python/grpcio_testing/grpc_testing/_server/_handler.py
index 0e3404b0d0..100d8195f6 100644
--- a/src/python/grpcio_testing/grpc_testing/_server/_handler.py
+++ b/src/python/grpcio_testing/grpc_testing/_server/_handler.py
@@ -185,7 +185,7 @@ class _Handler(Handler):
elif self._code is None:
self._condition.wait()
else:
- return self._trailing_metadata, self._code, self._details,
+ return self._trailing_metadata, self._code, self._details
def expire(self):
with self._condition:
diff --git a/src/python/grpcio_tests/tests/_runner.py b/src/python/grpcio_tests/tests/_runner.py
index eaaa027e61..9ef0f17684 100644
--- a/src/python/grpcio_tests/tests/_runner.py
+++ b/src/python/grpcio_tests/tests/_runner.py
@@ -203,7 +203,7 @@ class Runner(object):
check_kill_self()
time.sleep(0)
case_thread.join()
- except:
+ except: # pylint: disable=try-except-raise
# re-raise the exception after forcing the with-block to end
raise
result.set_output(augmented_case.case, stdout_pipe.output(),
diff --git a/src/python/grpcio_tests/tests/protoc_plugin/_split_definitions_test.py b/src/python/grpcio_tests/tests/protoc_plugin/_split_definitions_test.py
index e21ea0010a..2b735526cb 100644
--- a/src/python/grpcio_tests/tests/protoc_plugin/_split_definitions_test.py
+++ b/src/python/grpcio_tests/tests/protoc_plugin/_split_definitions_test.py
@@ -144,7 +144,7 @@ class _ProtoBeforeGrpcProtocStyle(object):
absolute_proto_file_names)
pb2_grpc_protoc_exit_code = _protoc(
proto_path, None, 'grpc_2_0', python_out, absolute_proto_file_names)
- return pb2_protoc_exit_code, pb2_grpc_protoc_exit_code,
+ return pb2_protoc_exit_code, pb2_grpc_protoc_exit_code
class _GrpcBeforeProtoProtocStyle(object):
@@ -160,7 +160,7 @@ class _GrpcBeforeProtoProtocStyle(object):
proto_path, None, 'grpc_2_0', python_out, absolute_proto_file_names)
pb2_protoc_exit_code = _protoc(proto_path, python_out, None, None,
absolute_proto_file_names)
- return pb2_grpc_protoc_exit_code, pb2_protoc_exit_code,
+ return pb2_grpc_protoc_exit_code, pb2_protoc_exit_code
_PROTOC_STYLES = (
@@ -243,9 +243,9 @@ class _Test(six.with_metaclass(abc.ABCMeta, unittest.TestCase)):
def _services_modules(self):
if self.PROTOC_STYLE.grpc_in_pb2_expected():
- return self._services_pb2, self._services_pb2_grpc,
+ return self._services_pb2, self._services_pb2_grpc
else:
- return self._services_pb2_grpc,
+ return (self._services_pb2_grpc,)
def test_imported_attributes(self):
self._protoc()
diff --git a/src/python/grpcio_tests/tests/protoc_plugin/beta_python_plugin_test.py b/src/python/grpcio_tests/tests/protoc_plugin/beta_python_plugin_test.py
index b46e53315e..43c90af6a7 100644
--- a/src/python/grpcio_tests/tests/protoc_plugin/beta_python_plugin_test.py
+++ b/src/python/grpcio_tests/tests/protoc_plugin/beta_python_plugin_test.py
@@ -223,7 +223,7 @@ def _CreateService(payload_pb2, responses_pb2, service_pb2):
server.start()
channel = implementations.insecure_channel('localhost', port)
stub = getattr(service_pb2, STUB_FACTORY_IDENTIFIER)(channel)
- yield servicer_methods, stub,
+ yield servicer_methods, stub
server.stop(0)
diff --git a/src/python/grpcio_tests/tests/qps/benchmark_client.py b/src/python/grpcio_tests/tests/qps/benchmark_client.py
index 0488450740..fac0e44e5a 100644
--- a/src/python/grpcio_tests/tests/qps/benchmark_client.py
+++ b/src/python/grpcio_tests/tests/qps/benchmark_client.py
@@ -180,7 +180,7 @@ class StreamingSyncBenchmarkClient(BenchmarkClient):
self._streams = [
_SyncStream(self._stub, self._generic, self._request,
self._handle_response)
- for _ in xrange(config.outstanding_rpcs_per_channel)
+ for _ in range(config.outstanding_rpcs_per_channel)
]
self._curr_stream = 0
diff --git a/src/python/grpcio_tests/tests/qps/client_runner.py b/src/python/grpcio_tests/tests/qps/client_runner.py
index e79abab3c7..a57524c74e 100644
--- a/src/python/grpcio_tests/tests/qps/client_runner.py
+++ b/src/python/grpcio_tests/tests/qps/client_runner.py
@@ -77,7 +77,7 @@ class ClosedLoopClientRunner(ClientRunner):
def start(self):
self._is_running = True
self._client.start()
- for _ in xrange(self._request_count):
+ for _ in range(self._request_count):
self._client.send_request()
def stop(self):
diff --git a/src/python/grpcio_tests/tests/qps/worker_server.py b/src/python/grpcio_tests/tests/qps/worker_server.py
index 337a94b546..a03367ec63 100644
--- a/src/python/grpcio_tests/tests/qps/worker_server.py
+++ b/src/python/grpcio_tests/tests/qps/worker_server.py
@@ -109,7 +109,7 @@ class WorkerServer(worker_service_pb2_grpc.WorkerServiceServicer):
start_time = time.time()
# Create a client for each channel
- for i in xrange(config.client_channels):
+ for i in range(config.client_channels):
server = config.server_targets[i % len(config.server_targets)]
runner = self._create_client_runner(server, config, qps_data)
client_runners.append(runner)
diff --git a/src/python/grpcio_tests/tests/stress/client.py b/src/python/grpcio_tests/tests/stress/client.py
index 41f2e1b6c2..a318b308e6 100644
--- a/src/python/grpcio_tests/tests/stress/client.py
+++ b/src/python/grpcio_tests/tests/stress/client.py
@@ -132,9 +132,9 @@ def run_test(args):
server.start()
for test_server_target in test_server_targets:
- for _ in xrange(args.num_channels_per_server):
+ for _ in range(args.num_channels_per_server):
channel = _get_channel(test_server_target, args)
- for _ in xrange(args.num_stubs_per_channel):
+ for _ in range(args.num_stubs_per_channel):
stub = test_pb2_grpc.TestServiceStub(channel)
runner = test_runner.TestRunner(stub, test_cases, hist,
exception_queue, stop_event)
diff --git a/src/python/grpcio_tests/tests/testing/_client_application.py b/src/python/grpcio_tests/tests/testing/_client_application.py
index 3ddeba2373..4d42df0389 100644
--- a/src/python/grpcio_tests/tests/testing/_client_application.py
+++ b/src/python/grpcio_tests/tests/testing/_client_application.py
@@ -130,9 +130,9 @@ def _run_stream_stream(stub):
request_pipe = _Pipe()
response_iterator = stub.StreStre(iter(request_pipe))
request_pipe.add(_application_common.STREAM_STREAM_REQUEST)
- first_responses = next(response_iterator), next(response_iterator),
+ first_responses = next(response_iterator), next(response_iterator)
request_pipe.add(_application_common.STREAM_STREAM_REQUEST)
- second_responses = next(response_iterator), next(response_iterator),
+ second_responses = next(response_iterator), next(response_iterator)
request_pipe.close()
try:
next(response_iterator)
diff --git a/src/python/grpcio_tests/tests/unit/_from_grpc_import_star.py b/src/python/grpcio_tests/tests/unit/_from_grpc_import_star.py
index ad847ae03e..1ada25382d 100644
--- a/src/python/grpcio_tests/tests/unit/_from_grpc_import_star.py
+++ b/src/python/grpcio_tests/tests/unit/_from_grpc_import_star.py
@@ -14,7 +14,7 @@
_BEFORE_IMPORT = tuple(globals())
-from grpc import * # pylint: disable=wildcard-import
+from grpc import * # pylint: disable=wildcard-import,unused-wildcard-import
_AFTER_IMPORT = tuple(globals())
diff --git a/templates/tools/dockerfile/test/sanity/Dockerfile.template b/templates/tools/dockerfile/test/sanity/Dockerfile.template
index eac7f2ab01..a4f9183bea 100644
--- a/templates/tools/dockerfile/test/sanity/Dockerfile.template
+++ b/templates/tools/dockerfile/test/sanity/Dockerfile.template
@@ -14,28 +14,24 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- FROM debian:jessie
-
- <%include file="../../apt_get_basic.include"/>
- <%include file="../../gcp_api_libraries.include"/>
- <%include file="../../python_deps.include"/>
+ <%include file="../../python_stretch.include"/>
<%include file="../../cxx_deps.include"/>
#========================
# Sanity test dependencies
+ RUN apt-get update && apt-get -t testing install -y python3.7 python3-all-dev
+ RUN curl https://bootstrap.pypa.io/get-pip.py | python3.7
+ # Make Python 3.7 the default Python 3 version
+ RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1
RUN apt-get update && apt-get install -y ${"\\"}
- python-pip ${"\\"}
autoconf ${"\\"}
automake ${"\\"}
libtool ${"\\"}
curl ${"\\"}
- python-virtualenv ${"\\"}
- python-lxml ${"\\"}
shellcheck
- RUN pip install simplejson mako
-
+ RUN python2 -m pip install simplejson mako virtualenv lxml
+ RUN python3 -m pip install simplejson mako virtualenv lxml
+
<%include file="../../clang5.include"/>
- <%include file="../../run_tests_addons.include"/>
-
+
# Define the default command.
CMD ["bash"]
-
diff --git a/tools/distrib/pylint_code.sh b/tools/distrib/pylint_code.sh
index 8a5f7af6c6..0050777503 100755
--- a/tools/distrib/pylint_code.sh
+++ b/tools/distrib/pylint_code.sh
@@ -32,12 +32,12 @@ TEST_DIRS=(
)
VIRTUALENV=python_pylint_venv
-python -m virtualenv $VIRTUALENV
+python3 -m virtualenv $VIRTUALENV
PYTHON=$VIRTUALENV/bin/python
-$PYTHON -m pip install --upgrade pip==10.0.1
-$PYTHON -m pip install pylint==1.9.2
+$PYTHON -m pip install --upgrade pip==18.1
+$PYTHON -m pip install --upgrade pylint==2.2.2
EXIT=0
for dir in "${DIRS[@]}"; do
diff --git a/tools/dockerfile/test/sanity/Dockerfile b/tools/dockerfile/test/sanity/Dockerfile
index e6bdb4ee03..aeee02a50f 100644
--- a/tools/dockerfile/test/sanity/Dockerfile
+++ b/tools/dockerfile/test/sanity/Dockerfile
@@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-FROM debian:jessie
-
+FROM debian:stretch
+
# Install Git and basic packages.
RUN apt-get update && apt-get install -y \
autoconf \
@@ -53,20 +53,19 @@ RUN apt-get update && apt-get install -y time && apt-get clean
RUN apt-get update && apt-get install -y python-pip && apt-get clean
RUN pip install --upgrade google-api-python-client oauth2client
-#====================
-# Python dependencies
+# Install Python 2.7
+RUN apt-get update && apt-get install -y python2.7 python-all-dev
+RUN curl https://bootstrap.pypa.io/get-pip.py | python2.7
-# Install dependencies
+# Add Debian 'testing' repository
+RUN echo 'deb http://ftp.de.debian.org/debian testing main' >> /etc/apt/sources.list
+RUN echo 'APT::Default-Release "stable";' | tee -a /etc/apt/apt.conf.d/00local
-RUN apt-get update && apt-get install -y \
- python-all-dev \
- python3-all-dev \
- python-pip
-# Install Python packages from PyPI
-RUN pip install --upgrade pip==10.0.1
-RUN pip install virtualenv
-RUN pip install futures==2.2.0 enum34==1.0.4 protobuf==3.5.2.post1 six==1.10.0 twisted==17.5.0
+RUN mkdir /var/local/jenkins
+
+# Define the default command.
+CMD ["bash"]
#=================
# C++ dependencies
@@ -74,16 +73,18 @@ RUN apt-get update && apt-get -y install libgflags-dev libgtest-dev libc++-dev c
#========================
# Sanity test dependencies
+RUN apt-get update && apt-get -t testing install -y python3.7 python3-all-dev
+RUN curl https://bootstrap.pypa.io/get-pip.py | python3.7
+# Make Python 3.7 the default Python 3 version
+RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1
RUN apt-get update && apt-get install -y \
- python-pip \
autoconf \
automake \
libtool \
curl \
- python-virtualenv \
- python-lxml \
shellcheck
-RUN pip install simplejson mako
+RUN python2 -m pip install simplejson mako virtualenv lxml
+RUN python3 -m pip install simplejson mako virtualenv lxml
RUN apt-get update && apt-get -y install wget xz-utils
RUN wget http://releases.llvm.org/5.0.0/clang+llvm-5.0.0-linux-x86_64-ubuntu14.04.tar.xz
@@ -94,8 +95,5 @@ RUN ln -s /clang+llvm-5.0.0-linux-x86_64-ubuntu14.04/bin/clang-tidy /usr/local/b
ENV CLANG_TIDY=clang-tidy
-RUN mkdir /var/local/jenkins
-
-
# Define the default command.
CMD ["bash"]
diff --git a/tools/run_tests/artifacts/build_artifact_protoc.sh b/tools/run_tests/artifacts/build_artifact_protoc.sh
index 6d433f2dad..a5b6e2f348 100755
--- a/tools/run_tests/artifacts/build_artifact_protoc.sh
+++ b/tools/run_tests/artifacts/build_artifact_protoc.sh
@@ -14,6 +14,7 @@
# limitations under the License.
# Use devtoolset environment that has GCC 4.8 before set -ex
+# shellcheck disable=SC1091
source scl_source enable devtoolset-2
set -ex
diff --git a/tools/run_tests/artifacts/build_artifact_ruby.sh b/tools/run_tests/artifacts/build_artifact_ruby.sh
index 5ab4cf21b4..c910374376 100755
--- a/tools/run_tests/artifacts/build_artifact_ruby.sh
+++ b/tools/run_tests/artifacts/build_artifact_ruby.sh
@@ -18,7 +18,9 @@ SYSTEM=$(uname | cut -f 1 -d_)
cd "$(dirname "$0")/../../.."
set +ex
+# shellcheck disable=SC1091
[[ -s /etc/profile.d/rvm.sh ]] && . /etc/profile.d/rvm.sh
+# shellcheck disable=SC1090
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
set -ex
diff --git a/tools/run_tests/artifacts/run_in_workspace.sh b/tools/run_tests/artifacts/run_in_workspace.sh
index 20181e077c..f4719b0a4a 100755
--- a/tools/run_tests/artifacts/run_in_workspace.sh
+++ b/tools/run_tests/artifacts/run_in_workspace.sh
@@ -19,7 +19,8 @@
set -ex
cd "$(dirname "$0")/../../.."
-export repo_root=$(pwd)
+repo_root=$(pwd)
+export repo_root
# TODO: fix file to pass shellcheck
diff --git a/tools/run_tests/dockerize/build_and_run_docker.sh b/tools/run_tests/dockerize/build_and_run_docker.sh
index 3f01fbc7b7..9d0efc8b40 100755
--- a/tools/run_tests/dockerize/build_and_run_docker.sh
+++ b/tools/run_tests/dockerize/build_and_run_docker.sh
@@ -20,7 +20,7 @@ set -ex
cd "$(dirname "$0")/../../.."
git_root=$(pwd)
-cd -
+cd - # shellcheck disable=SC2103
# Inputs
# DOCKERFILE_DIR - Directory in which Dockerfile file is located.
diff --git a/tools/run_tests/dockerize/build_docker_and_run_tests.sh b/tools/run_tests/dockerize/build_docker_and_run_tests.sh
index 1741b3268b..a63e1be96d 100755
--- a/tools/run_tests/dockerize/build_docker_and_run_tests.sh
+++ b/tools/run_tests/dockerize/build_docker_and_run_tests.sh
@@ -20,7 +20,7 @@ set -ex
cd "$(dirname "$0")/../../.."
git_root=$(pwd)
-cd -
+cd - # shellcheck disable=SC2103
# Inputs
# DOCKERFILE_DIR - Directory in which Dockerfile file is located.
@@ -48,7 +48,7 @@ docker_instance_git_root=/var/local/jenkins/grpc
# Run tests inside docker
DOCKER_EXIT_CODE=0
# TODO: silence complaint about $TTY_FLAG expansion in some other way
-# shellcheck disable=SC2086
+# shellcheck disable=SC2086,SC2154
docker run \
--cap-add SYS_PTRACE \
-e "RUN_TESTS_COMMAND=$RUN_TESTS_COMMAND" \
diff --git a/tools/run_tests/dockerize/build_interop_image.sh b/tools/run_tests/dockerize/build_interop_image.sh
index 126dd4065e..0f88787639 100755
--- a/tools/run_tests/dockerize/build_interop_image.sh
+++ b/tools/run_tests/dockerize/build_interop_image.sh
@@ -16,7 +16,7 @@
# This script is invoked by run_interop_tests.py to build the docker image
# for interop testing. You should never need to call this script on your own.
-set -x
+set -ex
# Params:
# INTEROP_IMAGE - name of tag of the final interop image
diff --git a/tools/run_tests/dockerize/docker_run_tests.sh b/tools/run_tests/dockerize/docker_run_tests.sh
index b7686e48ba..2a3b6f53ef 100755
--- a/tools/run_tests/dockerize/docker_run_tests.sh
+++ b/tools/run_tests/dockerize/docker_run_tests.sh
@@ -18,7 +18,7 @@
set -e
-export CONFIG=$config
+export CONFIG=${config:-opt}
export ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer
export PATH=$PATH:/usr/bin/llvm-symbolizer
diff --git a/tools/run_tests/helper_scripts/run_grpc-node.sh b/tools/run_tests/helper_scripts/run_grpc-node.sh
index 747aae7fd5..d14753a4d5 100755
--- a/tools/run_tests/helper_scripts/run_grpc-node.sh
+++ b/tools/run_tests/helper_scripts/run_grpc-node.sh
@@ -16,6 +16,8 @@
# This script runs grpc/grpc-node tests with their grpc submodule updated
# to this reference
+set -ex
+
# cd to gRPC root directory
cd "$(dirname "$0")/../../.."
diff --git a/tools/run_tests/helper_scripts/run_tests_in_workspace.sh b/tools/run_tests/helper_scripts/run_tests_in_workspace.sh
index 790c041881..fa7a7aac0a 100755
--- a/tools/run_tests/helper_scripts/run_tests_in_workspace.sh
+++ b/tools/run_tests/helper_scripts/run_tests_in_workspace.sh
@@ -20,7 +20,8 @@
set -ex
cd "$(dirname "$0")/../../.."
-export repo_root="$(pwd)"
+repo_root="$(pwd)"
+export repo_root
rm -rf "${WORKSPACE_NAME}"
git clone . "${WORKSPACE_NAME}"
diff --git a/tools/run_tests/interop/with_nvm.sh b/tools/run_tests/interop/with_nvm.sh
index 887f9f6a9f..55f4b2b875 100755
--- a/tools/run_tests/interop/with_nvm.sh
+++ b/tools/run_tests/interop/with_nvm.sh
@@ -15,5 +15,6 @@
# limitations under the License.
# Makes sure NVM is loaded before executing the command passed as an argument
+# shellcheck disable=SC1090
source ~/.nvm/nvm.sh
"$@"
diff --git a/tools/run_tests/interop/with_rvm.sh b/tools/run_tests/interop/with_rvm.sh
index 41e6efcb56..82bce9da12 100755
--- a/tools/run_tests/interop/with_rvm.sh
+++ b/tools/run_tests/interop/with_rvm.sh
@@ -15,5 +15,6 @@
# limitations under the License.
# Makes sure RVM is loaded before executing the command passed as an argument
+# shellcheck disable=SC1091
source /usr/local/rvm/scripts/rvm
"$@"
diff --git a/tools/run_tests/performance/build_performance.sh b/tools/run_tests/performance/build_performance.sh
index ab6bffdc34..6c22e2d37d 100755
--- a/tools/run_tests/performance/build_performance.sh
+++ b/tools/run_tests/performance/build_performance.sh
@@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+# shellcheck disable=SC1090
source ~/.rvm/scripts/rvm
set -ex
diff --git a/tools/run_tests/performance/build_performance_go.sh b/tools/run_tests/performance/build_performance_go.sh
index 812728d4ce..3aa203a6ee 100755
--- a/tools/run_tests/performance/build_performance_go.sh
+++ b/tools/run_tests/performance/build_performance_go.sh
@@ -17,7 +17,8 @@ set -ex
cd "$(dirname "$0")/../../.."
-export GOPATH=$(pwd)/../gopath
+GOPATH=$(pwd)/../gopath
+export GOPATH
# Get grpc-go and the dependencies but get rid of the upstream/master version
go get google.golang.org/grpc
diff --git a/tools/run_tests/performance/build_performance_node.sh b/tools/run_tests/performance/build_performance_node.sh
index 12e0872264..b5b5d9a1a2 100755
--- a/tools/run_tests/performance/build_performance_node.sh
+++ b/tools/run_tests/performance/build_performance_node.sh
@@ -15,6 +15,7 @@
set +ex
+# shellcheck disable=SC1090
. "$HOME/.nvm/nvm.sh"
nvm install 10
diff --git a/tools/run_tests/performance/run_worker_go.sh b/tools/run_tests/performance/run_worker_go.sh
index f8e821a265..1127f4f25a 100755
--- a/tools/run_tests/performance/run_worker_go.sh
+++ b/tools/run_tests/performance/run_worker_go.sh
@@ -17,6 +17,7 @@ set -ex
cd "$(dirname "$0")/../../.."
-export GOPATH=$(pwd)/../gopath
+GOPATH=$(pwd)/../gopath
+export GOPATH
"${GOPATH}/bin/worker" "$@"
diff --git a/tools/run_tests/performance/run_worker_node.sh b/tools/run_tests/performance/run_worker_node.sh
index 3e5dd18edb..658cd50811 100755
--- a/tools/run_tests/performance/run_worker_node.sh
+++ b/tools/run_tests/performance/run_worker_node.sh
@@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+# shellcheck disable=SC1090
. "$HOME/.nvm/nvm.sh"
nvm use 10
diff --git a/tools/run_tests/performance/run_worker_php.sh b/tools/run_tests/performance/run_worker_php.sh
index 2fe2493e60..97292a9978 100755
--- a/tools/run_tests/performance/run_worker_php.sh
+++ b/tools/run_tests/performance/run_worker_php.sh
@@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+# shellcheck disable=SC1090
source ~/.rvm/scripts/rvm
set -ex
diff --git a/tools/run_tests/performance/run_worker_ruby.sh b/tools/run_tests/performance/run_worker_ruby.sh
index 729c5cec97..ed44846336 100755
--- a/tools/run_tests/performance/run_worker_ruby.sh
+++ b/tools/run_tests/performance/run_worker_ruby.sh
@@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+# shellcheck disable=SC1090
source ~/.rvm/scripts/rvm
set -ex