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