blob: b411a085ea834a5e637691d23033328d73b9f6a8 [file] [log] [blame]
Brian Silverman7d89e282021-11-17 17:36:54 -08001#!/bin/bash
2# Copyright 2018 The Bazel 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
16set -euo pipefail
17
18toolchain_name=""
19
20while getopts "t:h" opt; do
21 case "$opt" in
22 "t") toolchain_name="$OPTARG";;
23 "h") echo "Usage:"
24 echo "-t - Toolchain name to use for testing; default is llvm_toolchain"
25 exit 2
26 ;;
27 "?") echo "invalid option: -$OPTARG"; exit 1;;
28 esac
29done
30
31source "$(dirname "${BASH_SOURCE[0]}")/bazel.sh"
32"${bazel}" version
33
34set -x
35test_args=(
36 --extra_toolchains="${toolchain_name}"
37 --copt=-v
38 --linkopt=-Wl,-t
39)
40if [[ "${TEST_MIGRATION:-}" ]]; then
41 # We can not use bazelisk to test migration because bazelisk does not allow
42 # us to selectively ignore a migration flag.
43 test_args+=("--all_incompatible_changes")
44 # This flag is not quite ready -- https://github.com/bazelbuild/bazel/issues/7347
45 test_args+=("--incompatible_disallow_struct_provider_syntax=false")
46 # the rules_rust repo included in the WORKSPACE is currently incompatible with
47 # '--incompatible_no_rule_outputs_param=true', setting this to false for now.
48 test_args+=("--incompatible_no_rule_outputs_param=false")
49fi
50"${bazel}" --bazelrc=/dev/null test "${common_test_args[@]}" "${test_args[@]}" //tests:all