github.phpd.cn/thought-machine/please@v12.2.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      pkg_config_libs = ['python3'],
    44      deps = [
    45          ':embedded_files',
    46      ],
    47  )
    48  
    49  # Used by Python build code as a convenient way of testing itself.
    50  python_library(
    51      name = 'so_test_py',
    52      srcs = ['__init__.py'],
    53      resources = [':so_test'],
    54      zip_safe = False,
    55      visibility = ['//test/python_rules/...'],
    56  )
    57  
    58  python_test(
    59      name = 'shared_object_test',
    60      srcs = ['shared_object_test.py'],
    61      labels = ['cc'],
    62      zip_safe = False,
    63      deps = [
    64          ':so_test',
    65      ],
    66  )
    67  
    68  # Make sure we have at least one working cc_binary rule.
    69  cc_binary(
    70      name = 'test_binary',
    71      srcs = ['test_binary.cc'],
    72      deps = [
    73          ':embedded_files',
    74      ],
    75  )
    76  
    77  gentest(
    78      name = 'cc_binary_test',
    79      data = [':test_binary'],
    80      labels = ['cc'],
    81      no_test_output = True,
    82      test_cmd = '$(exe :test_binary)',
    83  )
    84  
    85  # Tests on the C family of functions.
    86  c_test(
    87      name = 'c_test',
    88      srcs = ['test.c'],
    89  )