1#!/bin/bash 2# 3# Build file to set up and run tests 4set -ex 5 6# Install the latest Bazel version available 7use_bazel.sh latest 8bazel version 9 10# Print bazel testlogs to stdout when tests failed. 11function print_test_logs { 12 # TODO(yannic): Only print logs of failing tests. 13 testlogs_dir=$(bazel info bazel-testlogs) 14 testlogs=$(find "${testlogs_dir}" -name "*.log") 15 for log in $testlogs; do 16 cat "${log}" 17 done 18} 19 20# Change to repo root 21cd $(dirname $0)/../../.. 22 23git submodule update --init --recursive 24 25trap print_test_logs EXIT 26bazel test --copt=-Werror --host_copt=-Werror \ 27 //:build_files_updated_unittest \ 28 //java/... \ 29 //:protoc \ 30 //:protobuf \ 31 //:protobuf_python \ 32 //:protobuf_test \ 33 @com_google_protobuf//:cc_proto_blacklist_test 34trap - EXIT 35 36cd examples 37bazel build //... 38