Debian Codegraph @

test/distrib/bazel/test_single_bazel_version.sh

raw
1 #!/usr/bin/env bash
2 # Copyright 2021 The gRPC authors.
3 #
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
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
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.
15
16 set -ex
17
18 if [ "$#" != "1" ] ; then
19 echo "Must supply bazel version to be tested." >/dev/stderr
20 exit 1
21 fi
22
23 VERSION="$1"
24
25 cd "$(dirname "$0")"/../../..
26
27 EXCLUDED_TARGETS=(
28 # iOS platform fails the analysis phase since there is no toolchain available
29 # for it.
30 "-//src/objective-c/..."
31 "-//third_party/objective_c/..."
32
33 # This could be a legitmate failure due to bitrot.
34 "-//src/proto/grpc/testing:test_gen_proto"
35
36 # This appears to be a legitimately broken BUILD file. There's a reference to
37 # a non-existent "link_dynamic_library.sh".
38 "-//third_party/toolchains/rbe_windows_bazel_5.2.0_vs2019:all"
39
40 # TODO(jtattermusch): add back once fixed
41 "-//examples/android/binder/..."
42 )
43
44 TEST_DIRECTORIES=(
45 "cpp"
46 "python"
47 )
48
49 FAILED_TESTS=""
50
51 export OVERRIDE_BAZEL_VERSION="$VERSION"
52 # when running under bazel docker image, the workspace is read only.
53 export OVERRIDE_BAZEL_WRAPPER_DOWNLOAD_DIR=/tmp
54 bazel build -- //... "${EXCLUDED_TARGETS[@]}" || FAILED_TESTS="${FAILED_TESTS}Build "
55
56 for TEST_DIRECTORY in "${TEST_DIRECTORIES[@]}"; do
57 pushd "test/distrib/bazel/$TEST_DIRECTORY/"
58
59 bazel test --test_output=all //:all || FAILED_TESTS="${FAILED_TESTS}${TEST_DIRECTORY} Distribtest"
60
61 popd
62 done
63
64 if [ "$FAILED_TESTS" != "" ]
65 then
66 echo "Failed tests at version ${VERSION}: ${FAILED_TESTS}"
67 exit 1
68 fi