xref: /openbmc/bmcweb/test/meson.build (revision 6cbd6c41ab77ac60b8b902040e023ecf3f1391e1)
1
2srcfiles_unittest = files(
3    'http/crow_getroutes_test.cpp',
4    'http/http2_connection_test.cpp',
5    'http/http_body_test.cpp',
6    'http/http_connection_test.cpp',
7    'http/http_response_test.cpp',
8    'http/mutual_tls.cpp',
9    'http/parsing_test.cpp',
10    'http/router_test.cpp',
11    'http/server_sent_event_test.cpp',
12    'http/utility_test.cpp',
13    'http/verb_test.cpp',
14    'http/zstd_decompressor_test.cpp',
15    'include/async_resolve_test.cpp',
16    'include/credential_pipe_test.cpp',
17    'include/dbus_privileges_test.cpp',
18    'include/http_utility_test.cpp',
19    'include/human_sort_test.cpp',
20    'include/json_html_serializer.cpp',
21    'include/multipart_test.cpp',
22    'include/ossl_random.cpp',
23    'include/sessions_test.cpp',
24    'include/ssl_key_handler_test.cpp',
25    'include/str_utility_test.cpp',
26    'redfish-core/include/dbus_log_watcher_test.cpp',
27    'redfish-core/include/event_log_test.cpp',
28    'redfish-core/include/event_matches_filter_test.cpp',
29    'redfish-core/include/filter_expr_executor_test.cpp',
30    'redfish-core/include/filter_expr_parser_test.cpp',
31    'redfish-core/include/privileges_test.cpp',
32    'redfish-core/include/redfish_aggregator_test.cpp',
33    'redfish-core/include/redfish_oem_routing_test.cpp',
34    'redfish-core/include/redfish_test.cpp',
35    'redfish-core/include/registries_test.cpp',
36    'redfish-core/include/submit_test_event_test.cpp',
37    'redfish-core/include/utils/dbus_utils.cpp',
38    'redfish-core/include/utils/error_code_test.cpp',
39    'redfish-core/include/utils/hex_utils_test.cpp',
40    'redfish-core/include/utils/ip_utils_test.cpp',
41    'redfish-core/include/utils/json_utils_test.cpp',
42    'redfish-core/include/utils/query_param_test.cpp',
43    'redfish-core/include/utils/sensor_utils_test.cpp',
44    'redfish-core/include/utils/stl_utils_test.cpp',
45    'redfish-core/include/utils/systems_utils_test.cpp',
46    'redfish-core/include/utils/time_utils_test.cpp',
47    'redfish-core/lib/chassis_test.cpp',
48    'redfish-core/lib/ethernet_test.cpp',
49    'redfish-core/lib/log_services_dump_test.cpp',
50    'redfish-core/lib/manager_diagnostic_data_test.cpp',
51    'redfish-core/lib/metadata_test.cpp',
52    'redfish-core/lib/power_subsystem_test.cpp',
53    'redfish-core/lib/service_root_test.cpp',
54    'redfish-core/lib/system_test.cpp',
55    'redfish-core/lib/systems_logservices_postcode.cpp',
56    'redfish-core/lib/thermal_subsystem_test.cpp',
57    'redfish-core/lib/update_service_test.cpp',
58) + test_sources
59
60if (get_option('tests').allowed())
61    gtest = dependency(
62        'gtest_main',
63        main: true,
64        version: '>=1.15.0',
65        required: true,
66    )
67    gmock = dependency('gmock', required: true)
68    gtestlib = static_library('gtestlib', dependencies: [gtest, gmock])
69    gtestdep = declare_dependency(
70        link_with: gtestlib,
71        dependencies: [
72            gtest.partial_dependency(includes: true),
73            gmock.partial_dependency(includes: true),
74        ],
75    )
76    # generate the test executable
77    foreach test_src : srcfiles_unittest
78        test_bin = executable(
79            fs.stem(test_src),
80            test_src,
81            link_with: bmcweblib,
82            include_directories: [incdir, include_directories('..')],
83            install_dir: bindir,
84            dependencies: bmcweb_dependencies + [gtestdep],
85        )
86        test(fs.stem(test_src), test_bin, protocol: 'gtest')
87    endforeach
88endif
89