blob: ac86f24f5100ef16fa11474673dc79b049021703 [file] [log] [blame]
William A. Kennington IIIef2c0b72022-08-24 15:12:53 -07001gtests = {
Patrick Williams6d592582025-02-01 08:37:30 -05002 'cancel': [stdplus_dep, gtest_main_dep],
3 'exception': [stdplus_dep, gtest_main_dep],
4 'function_view': [stdplus_dep, gtest_main_dep],
5 'handle/copyable': [stdplus_dep, gtest_main_dep],
6 'handle/managed': [stdplus_dep, gtest_main_dep],
7 'hash': [stdplus_dep, gtest_main_dep],
8 'hash/array': [stdplus_dep, gtest_main_dep],
9 'hash/tuple': [stdplus_dep, gtest_main_dep],
10 'net/addr/ether': [stdplus_dep, gtest_main_dep],
11 'net/addr/ip': [stdplus_dep, gtest_main_dep],
12 'net/addr/sock': [stdplus_dep, gtest_main_dep],
13 'net/addr/subnet': [stdplus_dep, gtest_main_dep],
14 'numeric/endian': [stdplus_dep, gtest_main_dep],
15 'numeric/str': [stdplus_dep, gtest_main_dep],
16 'pinned': [stdplus_dep, gtest_main_dep],
17 'print': [stdplus_dep, gtest_main_dep],
18 'raw': [stdplus_dep, gmock_dep, gtest_main_dep],
19 'signal': [stdplus_dep, gtest_main_dep],
20 'str/buf': [stdplus_dep, gtest_main_dep],
21 'str/cat': [stdplus_dep, gtest_main_dep],
22 'str/cexpr': [stdplus_dep, gtest_main_dep],
23 'str/conv': [stdplus_dep, gmock_dep, gtest_main_dep],
24 'str/maps': [stdplus_dep, gmock_dep, gtest_main_dep],
25 'util/cexec': [stdplus_dep, gtest_main_dep],
26 'variant': [stdplus_dep, gtest_main_dep],
27 'zstring': [stdplus_dep, gtest_main_dep],
28 'zstring_view': [stdplus_dep, gtest_main_dep],
William A. Kennington IIIef2c0b72022-08-24 15:12:53 -070029}
William A. Kennington IIId7acddd2022-07-13 16:41:11 -070030
William A. Kennington III5a528022021-04-28 12:52:43 -070031if has_dl
Patrick Williams6d592582025-02-01 08:37:30 -050032 gtests += {'dl': [stdplus_dl_dep, gtest_main_dep]}
William A. Kennington III5a528022021-04-28 12:52:43 -070033elif build_tests.enabled()
Patrick Williams6d592582025-02-01 08:37:30 -050034 error('Not testing libdl feature')
William A. Kennington III5a528022021-04-28 12:52:43 -070035else
Patrick Williams6d592582025-02-01 08:37:30 -050036 warning('Not testing libdl feature')
William A. Kennington III5a528022021-04-28 12:52:43 -070037endif
38
William A. Kennington IIIeac9d472020-08-03 13:57:14 -070039if has_fd
William A. Kennington IIIef2c0b72022-08-24 15:12:53 -070040 gtests += {
Patrick Williams6d592582025-02-01 08:37:30 -050041 'fd/dupable': [stdplus_fd_dep],
42 'fd/managed': [stdplus_fd_dep],
43 'fd/fmt': [stdplus_fd_dep, stdplus_dep, gtest_main_dep],
44 'fd/intf': [stdplus_fd_dep],
45 'fd/impl': [stdplus_fd_dep],
46 'fd/line': [stdplus_fd_dep, stdplus_dep, gmock_dep, gtest_main_dep],
47 'fd/mmap': [stdplus_fd_dep, gtest_main_dep],
48 'fd/mock': [stdplus_fd_dep, gmock_dep, gtest_main_dep],
49 'fd/ops': [stdplus_fd_dep, stdplus_dep, gmock_dep, gtest_main_dep],
William A. Kennington IIIef2c0b72022-08-24 15:12:53 -070050 }
Patrick Williams6d592582025-02-01 08:37:30 -050051 if has_gtest
52 gtests += {
53 'fd/atomic': [stdplus_fd_dep, stdplus_gtest_dep, gtest_main_dep],
54 }
55 elif build_tests.enabled()
56 error('Not testing fd/atomic feature')
57 else
58 warning('Not testing fd/atomic feature')
59 endif
William A. Kennington III45754242021-04-28 12:48:31 -070060elif build_tests.enabled()
Patrick Williams6d592582025-02-01 08:37:30 -050061 error('Not testing file descriptor feature')
William A. Kennington IIIeac9d472020-08-03 13:57:14 -070062else
Patrick Williams6d592582025-02-01 08:37:30 -050063 warning('Not testing file descriptor feature')
William A. Kennington IIIeac9d472020-08-03 13:57:14 -070064endif
65
William A. Kennington III5c20da22021-06-18 16:44:55 -070066if has_io_uring
Patrick Williams6d592582025-02-01 08:37:30 -050067 gtests += {
68 'io_uring': [
69 stdplus_io_uring_dep,
70 stdplus_dep,
71 gmock_dep,
72 gtest_main_dep,
73 ],
74 }
William A. Kennington III5c20da22021-06-18 16:44:55 -070075elif build_tests.enabled()
Patrick Williams6d592582025-02-01 08:37:30 -050076 error('Not testing io_uring feature')
William A. Kennington III5c20da22021-06-18 16:44:55 -070077else
Patrick Williams6d592582025-02-01 08:37:30 -050078 warning('Not testing io_uring feature')
William A. Kennington III5c20da22021-06-18 16:44:55 -070079endif
80
William A. Kennington III953de362022-07-13 17:32:55 -070081if has_gtest
Patrick Williams6d592582025-02-01 08:37:30 -050082 gtests += {'gtest/tmp': [stdplus_gtest_dep, gtest_main_dep]}
William A. Kennington III953de362022-07-13 17:32:55 -070083elif build_tests.enabled()
Patrick Williams6d592582025-02-01 08:37:30 -050084 error('Not testing gtest lib feature')
William A. Kennington III953de362022-07-13 17:32:55 -070085else
Patrick Williams6d592582025-02-01 08:37:30 -050086 warning('Not testing gtest lib feature')
William A. Kennington III953de362022-07-13 17:32:55 -070087endif
88
William A. Kennington IIIb4674602022-08-24 14:54:37 -070089add_test_setup(
Patrick Williams6d592582025-02-01 08:37:30 -050090 'stdplus',
91 exe_wrapper: run_with_tmp,
92 env: {'TMPTMPL': 'stdplus-test.XXXXXXXXXX'},
93 is_default: true,
94)
William A. Kennington IIIb4674602022-08-24 14:54:37 -070095
96add_test_setup(
Patrick Williams6d592582025-02-01 08:37:30 -050097 'valgrind',
98 exe_wrapper: [run_with_tmp, 'valgrind'],
99 env: {'TMPTMPL': 'stdplus-test.XXXXXXXXXX'},
100)
William A. Kennington IIIb4674602022-08-24 14:54:37 -0700101
William A. Kennington III953de362022-07-13 17:32:55 -0700102if gtest_dep.found() and gmock_dep.found()
Patrick Williams6d592582025-02-01 08:37:30 -0500103 foreach t, deps : gtests
104 test(
105 t,
106 executable(
107 t.underscorify(),
108 t + '.cpp',
109 build_by_default: false,
110 implicit_include_directories: false,
111 cpp_args: '-Wno-missing-braces',
112 dependencies: deps,
113 ),
114 )
115 endforeach
William A. Kennington III83af3fa2021-01-31 15:22:54 -0800116endif