1load("@rules_testing//lib:util.bzl", "util") 2load("//cc/toolchains:action_type_config.bzl", "cc_action_type_config") 3load("//cc/toolchains:args.bzl", "cc_args") 4load("//cc/toolchains:feature.bzl", "cc_feature") 5load("//cc/toolchains:feature_set.bzl", "cc_feature_set") 6load("//cc/toolchains:tool.bzl", "cc_tool") 7load("//cc/toolchains/impl:external_feature.bzl", "cc_external_feature") 8load("//cc/toolchains/impl:toolchain_config.bzl", "cc_legacy_file_group", "cc_toolchain_config") 9load("//tests/rule_based_toolchain:analysis_test_suite.bzl", "analysis_test_suite") 10load(":toolchain_config_test.bzl", "TARGETS", "TESTS") 11 12util.helper_target( 13 cc_feature_set, 14 name = "all_simple_features", 15 all_of = [ 16 ":simple_feature", 17 "simple_feature2", 18 ], 19) 20 21util.helper_target( 22 cc_external_feature, 23 name = "builtin_feature", 24 feature_name = "builtin_feature", 25 overridable = True, 26) 27 28util.helper_target( 29 cc_args, 30 name = "c_compile_args", 31 actions = ["//tests/rule_based_toolchain/actions:c_compile"], 32 args = ["c_compile_args"], 33 data = ["//tests/rule_based_toolchain/testdata:file1"], 34) 35 36util.helper_target( 37 cc_args, 38 name = "cpp_compile_args", 39 actions = ["//tests/rule_based_toolchain/actions:cpp_compile"], 40 args = ["cpp_compile_args"], 41 env = {"CPP_COMPILE": "1"}, 42) 43 44util.helper_target( 45 cc_toolchain_config, 46 name = "collects_files_toolchain_config", 47 action_type_configs = [":compile_config"], 48 args = [":c_compile_args"], 49 compiler = "gcc-4.1.1", 50 skip_experimental_flag_validation_for_test = True, 51 target_cpu = "k8", 52 target_libc = "glibc-2.2.2", 53 target_system_name = "local", 54 toolchain_features = [":compile_feature"], 55) 56 57util.helper_target( 58 cc_legacy_file_group, 59 name = "collects_files_c_compile", 60 actions = ["//tests/rule_based_toolchain/actions:c_compile"], 61 config = ":collects_files_toolchain_config", 62) 63 64util.helper_target( 65 cc_legacy_file_group, 66 name = "collects_files_cpp_compile", 67 actions = ["//tests/rule_based_toolchain/actions:cpp_compile"], 68 config = ":collects_files_toolchain_config", 69) 70 71util.helper_target( 72 cc_args, 73 name = "compile_args", 74 actions = ["//tests/rule_based_toolchain/actions:all_compile"], 75 args = ["compile_args"], 76 data = ["//tests/rule_based_toolchain/testdata:file2"], 77) 78 79util.helper_target( 80 cc_action_type_config, 81 name = "compile_config", 82 action_types = ["//tests/rule_based_toolchain/actions:all_compile"], 83 args = [":cpp_compile_args"], 84 tools = [ 85 "//tests/rule_based_toolchain/tool:wrapped_tool", 86 ], 87) 88 89util.helper_target( 90 cc_feature, 91 name = "compile_feature", 92 args = [":compile_args"], 93 enabled = True, 94 feature_name = "compile_feature", 95) 96 97util.helper_target( 98 cc_action_type_config, 99 name = "c_compile_config", 100 action_types = ["//tests/rule_based_toolchain/actions:c_compile"], 101 implies = [":simple_feature"], 102 tools = [ 103 "//tests/rule_based_toolchain/tool:wrapped_tool", 104 ], 105) 106 107util.helper_target( 108 cc_feature, 109 name = "implies_simple_feature", 110 args = [":c_compile_args"], 111 enabled = True, 112 feature_name = "implies", 113 implies = [":simple_feature"], 114) 115 116util.helper_target( 117 cc_feature, 118 name = "overrides_feature", 119 args = [":c_compile_args"], 120 enabled = True, 121 overrides = ":builtin_feature", 122) 123 124util.helper_target( 125 cc_args, 126 name = "requires_all_simple_args", 127 actions = ["//tests/rule_based_toolchain/actions:c_compile"], 128 args = ["--foo"], 129 requires_any_of = [":all_simple_features"], 130) 131 132util.helper_target( 133 cc_feature, 134 name = "requires_all_simple_feature", 135 args = [":c_compile_args"], 136 enabled = True, 137 feature_name = "requires_any_simple", 138 requires_any_of = [":all_simple_features"], 139) 140 141util.helper_target( 142 cc_tool, 143 name = "requires_all_simple_tool", 144 src = "//tests/rule_based_toolchain/testdata:bin_wrapper.sh", 145 requires_any_of = [":all_simple_features"], 146) 147 148util.helper_target( 149 cc_action_type_config, 150 name = "requires_all_simple_action_type_config", 151 action_types = ["//tests/rule_based_toolchain/actions:c_compile"], 152 tools = [":requires_all_simple_tool"], 153) 154 155util.helper_target( 156 cc_feature, 157 name = "requires_any_simple_feature", 158 args = [":c_compile_args"], 159 enabled = True, 160 feature_name = "requires_any_simple", 161 requires_any_of = [ 162 ":simple_feature", 163 ":simple_feature2", 164 ], 165) 166 167util.helper_target( 168 cc_feature, 169 name = "same_feature_name", 170 args = [":c_compile_args"], 171 enabled = False, 172 feature_name = "simple_feature", 173 visibility = ["//tests/rule_based_toolchain:__subpackages__"], 174) 175 176util.helper_target( 177 cc_feature, 178 name = "simple_feature", 179 args = [":c_compile_args"], 180 enabled = False, 181 feature_name = "simple_feature", 182) 183 184util.helper_target( 185 cc_feature, 186 name = "simple_feature2", 187 args = [":c_compile_args"], 188 enabled = False, 189 feature_name = "simple_feature2", 190 visibility = ["//tests/rule_based_toolchain:__subpackages__"], 191) 192 193analysis_test_suite( 194 name = "test_suite", 195 targets = TARGETS, 196 tests = TESTS, 197) 198