github.com/sercand/please@v13.4.0+incompatible/test/cc_rules/gcc/BUILD (about)

     1  # So far just contains tests for the C++ build rules.
     2  
     3  cc_embed_binary(
     4      name = "embedded_file_1",
     5      src = "embedded_file_1.txt",
     6  )
     7  
     8  genrule(
     9      name = "embedded_file_3_gen",
    10      outs = ["embedded_file_3.txt"],
    11      cmd = "echo \"testing message 3\" > $OUT",
    12  )
    13  
    14  cc_embed_binary(
    15      name = "embedded_file_3",
    16      src = ":embedded_file_3_gen",
    17      deps = [":embedded_file_3_gen"],
    18  )
    19  
    20  cc_test(
    21      name = "embed_file_test",
    22      srcs = ["embed_file_test.cc"],
    23      deps = [
    24          ":embedded_file_1",
    25          ":embedded_file_3",
    26      ],
    27  )
    28  
    29  # This is a little chain of tests to exercise the cc_shared_object rule.
    30  cc_library(
    31      name = "embedded_files",
    32      srcs = ["embedded_files.cc"],
    33      hdrs = ["embedded_files.h"],
    34      deps = [
    35          ":embedded_file_1",
    36          ":embedded_file_3",
    37      ],
    38  )
    39  
    40  cc_shared_object(
    41      name = "so_test",
    42      srcs = ["so_test.cc"],
    43      linker_flags = ["-bundle -undefined dynamic_lookup"] if (CONFIG.OS == "darwin") else [],
    44      pkg_config_cflags = ["python3"],
    45      deps = [
    46          ":embedded_files",
    47      ],
    48  )
    49  
    50  # Used by Python build code as a convenient way of testing itself.
    51  python_library(
    52      name = "so_test_py",
    53      srcs = ["__init__.py"],
    54      resources = [":so_test"],
    55      visibility = ["//test/python_rules:zip_unsafe_test"],
    56      zip_safe = False,
    57  )
    58  
    59  python_test(
    60      name = "shared_object_test",
    61      srcs = ["shared_object_test.py"],
    62      labels = [
    63          "cc",
    64          "py3_pkg_config",
    65      ],
    66      zip_safe = False,
    67      deps = [
    68          ":so_test",
    69      ],
    70  )
    71  
    72  # Make sure we have at least one working cc_binary rule.
    73  cc_binary(
    74      name = "test_binary",
    75      srcs = ["test_binary.cc"],
    76      deps = [
    77          ":embedded_files",
    78      ],
    79  )
    80  
    81  gentest(
    82      name = "cc_binary_test",
    83      data = [":test_binary"],
    84      labels = ["cc"],
    85      no_test_output = True,
    86      test_cmd = "$(exe :test_binary)",
    87  )
    88  
    89  # Tests on the C family of functions.
    90  c_test(
    91      name = "c_test",
    92      srcs = ["test.c"],
    93  )