1# Copyright 2024 The Bazel Authors. All rights reserved. 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14"""Tests for actions for the rule based toolchain.""" 15 16load( 17 "//cc/toolchains:cc_toolchain_info.bzl", 18 "ActionTypeInfo", 19 "ActionTypeSetInfo", 20) 21 22visibility("private") 23 24def _test_action_types_impl(env, targets): 25 env.expect.that_target(targets.c_compile).provider(ActionTypeInfo) \ 26 .name().equals("c_compile") 27 env.expect.that_target(targets.cpp_compile).provider(ActionTypeSetInfo) \ 28 .actions().contains_exactly([targets.cpp_compile.label]) 29 env.expect.that_target(targets.all_compile).provider(ActionTypeSetInfo) \ 30 .actions().contains_exactly([ 31 targets.c_compile.label, 32 targets.cpp_compile.label, 33 ]) 34 35TARGETS = [ 36 ":c_compile", 37 ":cpp_compile", 38 ":all_compile", 39] 40 41TESTS = { 42 "actions_test": _test_action_types_impl, 43} 44