|
1 | 1 | # This module provides functions to support generating test targets compatible |
2 | 2 | # with BlazingMQ CI. |
3 | 3 | # |
4 | | -# add_bmq_test( TARGET ) |
| 4 | +# bmq_add_application_test( TARGET ) |
5 | 5 |
|
6 | 6 | include_guard() |
7 | 7 |
|
8 | | -# :: bmq_add_test ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
9 | | -# This function searches for the test drivers of a UOR-style TARGET within the |
10 | | -# `tests` directory of each package. For each component, it generates a target |
11 | | -# named ${UOR_component}.t for each component found. |
12 | | -function(bmq_add_test target) |
13 | | - cmake_parse_arguments(PARSE_ARGV 1 |
14 | | - "" |
15 | | - "SKIP_TESTS;NO_GEN_BDE_METADATA;NO_EMIT_PKG_CONFIG_FILE;COMPAT" |
16 | | - "SOURCE_DIR" |
17 | | - "CUSTOM_PACKAGES") |
18 | | - |
19 | | - find_package(BdeBuildSystem REQUIRED) |
20 | | - |
21 | | - # Get the name of the unit from the target |
22 | | - get_target_property(uor_name ${target} NAME) |
23 | | - |
24 | | - # Use the current source directory if none is specified |
25 | | - if(NOT _SOURCE_DIR) |
26 | | - set(_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) |
27 | | - endif() |
28 | | - |
29 | | - # Check that BDE metadata exists and load it |
30 | | - if(NOT DEFINED ${uor_name}_PACKAGES) |
31 | | - if(EXISTS ${_SOURCE_DIR}/group) |
32 | | - bbs_read_metadata(GROUP ${uor_name} |
33 | | - SOURCE_DIR ${_SOURCE_DIR} |
34 | | - CUSTOM_PACKAGES "${_CUSTOM_PACKAGES}") |
35 | | - else() |
36 | | - if(EXISTS ${_SOURCE_DIR}/package) |
37 | | - bbs_read_metadata(PACKAGE ${uor_name} |
38 | | - SOURCE_DIR ${_SOURCE_DIR}) |
39 | | - endif() |
40 | | - endif() |
41 | | - endif() |
42 | | - |
43 | | - # Each package in the groups |
44 | | - if(${uor_name}_PACKAGES) |
45 | | - foreach(pkg ${${uor_name}_PACKAGES}) |
46 | | - bbs_configure_target_tests(${pkg} |
47 | | - SOURCES ${${pkg}_TEST_SOURCES} |
48 | | - TEST_DEPS ${${pkg}_DEPENDS} |
49 | | - ${${pkg}_TEST_DEPENDS} |
50 | | - ${${uor_name}_PCDEPS} |
51 | | - ${${uor_name}_TEST_PCDEPS} |
52 | | - LABELS "unit;all" ${target} ${pkg}) |
53 | | - endforeach() |
54 | | - |
55 | | - set(import_test_deps ON) |
56 | | - |
57 | | - foreach(pkg ${${uor_name}_PACKAGES}) |
58 | | - if(${pkg}_TEST_TARGETS) |
59 | | - if(NOT TARGET ${target}.t) |
60 | | - add_custom_target(${target}.t) |
61 | | - endif() |
62 | | - |
63 | | - add_dependencies(${target}.t ${${pkg}_TEST_TARGETS}) |
64 | | - |
65 | | - if(import_test_deps) |
66 | | - # Import UOR test dependencies only once and only if we have at least |
67 | | - # one generated test target |
68 | | - bbs_import_target_dependencies(${target} ${${uor_name}_TEST_PCDEPS}) |
69 | | - set(import_test_deps OFF) |
70 | | - endif() |
71 | | - endif() |
72 | | - endforeach() |
73 | | - else() |
74 | | - # Configure standalone library ( no packages ) and tests from BDE metadata |
75 | | - bbs_configure_target_tests(${target} |
76 | | - SOURCES ${${uor_name}_TEST_SOURCES} |
77 | | - TEST_DEPS ${${uor_name}_PCDEPS} |
78 | | - ${${uor_name}_TEST_PCDEPS} |
79 | | - LABELS "unit;all" ${target}) |
80 | | - |
81 | | - if(${target}_TEST_TARGETS) |
82 | | - bbs_import_target_dependencies(${target} ${${uor_name}_TEST_PCDEPS}) |
83 | | - endif() |
84 | | - endif() |
85 | | -endfunction() |
86 | | - |
87 | 8 | # :: bmq_add_application_test ::::::::::::::::::::::::::::::::::::::::::::::::: |
88 | 9 | # This function searches for the test drivers of an 'application' TARGET. It |
89 | 10 | # expects existence of intermediate library '${uor_name}_lib' which is created |
|
0 commit comments