2 # Copyright 2017 gRPC authors.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
16 # Creates test cases for a language by running run_interop_test in manual mode
17 # and save the generated output under ./testcases/<lang>__<release>.
20 # LANG - The language.
21 # SKIP_TEST - If set, skip running the test cases for sanity.
22 # RELEASE - Create testcase for specific release, defautl to 'master'.
23 # KEEP_IMAGE - Do not clean local docker image created for the test cases.
27 cd $(dirname $0)/../..
29 CMDS_SH="${GRPC_ROOT}/interop_client_cmds.sh"
30 TESTCASES_DIR=${GRPC_ROOT}/tools/interop_matrix/testcases
32 echo "Create '$LANG' test cases for gRPC release '${RELEASE:=master}'"
36 [ -z "$testcase" ] && testcase=$CMDS_SH
37 echo "testcase: $testcase"
38 if [ -e $testcase ]; then
39 # The script should generate a line with "${docker_image:=...}".
40 eval docker_image=$(grep -oe '${docker_image:=.*}' $testcase)
41 if [ -z "$KEEP_IMAGE" ]; then
42 echo "Clean up docker_image $docker_image"
43 docker rmi -f $docker_image
45 echo "Kept docker_image $docker_image"
48 [ -e "$CMDS_SH" ] && rm $CMDS_SH
51 function createtests {
52 # Invoke run_interop_test in manual mode.
53 # TODO(adelez): Add cloud_gateways when we figure out how to skip them if not
55 if [ $1 == "cxx" ]; then
62 ${GRPC_ROOT}/tools/run_tests/run_interop_tests.py -l $client_lang --use_docker \
63 --cloud_to_prod --prod_servers default gateway_v4 --manual_run
66 # TODO(adelez): add test auth tests but do not run if not testing on GCE.
67 # Running the testcases as sanity unless we are asked to skip.
68 [ -z "$SKIP_TEST" ] && (echo "Running test cases: $CMDS_SH"; sh $CMDS_SH)
70 mkdir -p $TESTCASES_DIR
71 testcase=$TESTCASES_DIR/$1__$RELEASE
72 if [ -e $testcase ]; then
73 echo "Updating: $testcase"
74 diff $testcase $CMDS_SH || true
78 echo "Test cases created: $testcase"
81 if [ $LANG == "csharp" ]; then
83 createtests "csharpcoreclr"