William A. Kennington III | ef2c0b7 | 2022-08-24 15:12:53 -0700 | [diff] [blame] | 1 | gtests = { |
| 2 | 'cancel': [stdplus_dep, gtest_main_dep], |
| 3 | 'exception': [stdplus_dep, gtest_main_dep], |
| 4 | 'handle/copyable': [stdplus_dep, gtest_main_dep], |
| 5 | 'handle/managed': [stdplus_dep, gtest_main_dep], |
William A. Kennington III | 403cda2 | 2022-12-12 15:52:35 -0800 | [diff] [blame] | 6 | 'hash': [stdplus_dep, gtest_main_dep], |
William A. Kennington III | 85149ee | 2023-01-03 18:15:47 -0800 | [diff] [blame] | 7 | 'hash/array': [stdplus_dep, gtest_main_dep], |
William A. Kennington III | b07a2eb | 2023-01-03 18:14:40 -0800 | [diff] [blame] | 8 | 'hash/tuple': [stdplus_dep, gtest_main_dep], |
William A. Kennington III | b25086a | 2023-01-09 18:53:29 -0800 | [diff] [blame] | 9 | 'net/addr/ether': [stdplus_dep, gtest_main_dep], |
William A. Kennington III | 9330c87 | 2023-01-04 15:41:53 -0800 | [diff] [blame] | 10 | 'net/addr/ip': [stdplus_dep, gtest_main_dep], |
William A. Kennington III | 14dd4eb | 2023-01-12 10:51:12 -0800 | [diff] [blame^] | 11 | 'net/addr/subnet': [stdplus_dep, gtest_main_dep], |
William A. Kennington III | 8c5f28c | 2022-12-07 01:21:36 -0800 | [diff] [blame] | 12 | 'numeric/endian': [stdplus_dep, gtest_main_dep], |
William A. Kennington III | cb9ddb6 | 2022-11-18 19:50:10 -0800 | [diff] [blame] | 13 | 'pinned': [stdplus_dep, gtest_main_dep], |
William A. Kennington III | ef2c0b7 | 2022-08-24 15:12:53 -0700 | [diff] [blame] | 14 | 'raw': [stdplus_dep, gmock_dep, gtest_main_dep], |
| 15 | 'signal': [stdplus_dep, gtest_main_dep], |
William A. Kennington III | 6047970 | 2022-12-07 02:55:24 -0800 | [diff] [blame] | 16 | 'str/cat': [stdplus_dep, gtest_main_dep], |
William A. Kennington III | 48a470a | 2022-12-10 17:09:59 -0800 | [diff] [blame] | 17 | 'str/cexpr': [stdplus_dep, gtest_main_dep], |
William A. Kennington III | 521475e | 2022-12-12 16:51:44 -0800 | [diff] [blame] | 18 | 'str/maps': [stdplus_dep, gmock_dep, gtest_main_dep], |
William A. Kennington III | ef2c0b7 | 2022-08-24 15:12:53 -0700 | [diff] [blame] | 19 | 'util/cexec': [stdplus_dep, gtest_main_dep], |
William A. Kennington III | db1bdbc | 2023-01-09 16:02:13 -0800 | [diff] [blame] | 20 | 'variant': [stdplus_dep, gtest_main_dep], |
William A. Kennington III | f2ddf51 | 2022-09-20 15:36:44 -0700 | [diff] [blame] | 21 | 'zstring': [stdplus_dep, gtest_main_dep], |
William A. Kennington III | 61a81bc | 2022-09-19 17:46:49 -0700 | [diff] [blame] | 22 | 'zstring_view': [stdplus_dep, gtest_main_dep], |
William A. Kennington III | ef2c0b7 | 2022-08-24 15:12:53 -0700 | [diff] [blame] | 23 | } |
William A. Kennington III | d7acddd | 2022-07-13 16:41:11 -0700 | [diff] [blame] | 24 | |
William A. Kennington III | 5a52802 | 2021-04-28 12:52:43 -0700 | [diff] [blame] | 25 | if has_dl |
William A. Kennington III | ef2c0b7 | 2022-08-24 15:12:53 -0700 | [diff] [blame] | 26 | gtests += { |
| 27 | 'dl': [stdplus_dl_dep, gtest_main_dep], |
| 28 | } |
William A. Kennington III | 5a52802 | 2021-04-28 12:52:43 -0700 | [diff] [blame] | 29 | elif build_tests.enabled() |
| 30 | error('Not testing libdl feature') |
| 31 | else |
| 32 | warning('Not testing libdl feature') |
| 33 | endif |
| 34 | |
William A. Kennington III | eac9d47 | 2020-08-03 13:57:14 -0700 | [diff] [blame] | 35 | if has_fd |
William A. Kennington III | ef2c0b7 | 2022-08-24 15:12:53 -0700 | [diff] [blame] | 36 | gtests += { |
| 37 | 'fd/dupable': [stdplus_fd_dep], |
| 38 | 'fd/managed': [stdplus_fd_dep], |
William A. Kennington III | aa4fcfc | 2022-08-23 16:35:10 -0700 | [diff] [blame] | 39 | 'fd/fmt': [stdplus_fd_dep, stdplus_dep, gtest_main_dep], |
William A. Kennington III | ef2c0b7 | 2022-08-24 15:12:53 -0700 | [diff] [blame] | 40 | 'fd/intf': [stdplus_fd_dep], |
| 41 | 'fd/impl': [stdplus_fd_dep], |
| 42 | 'fd/line': [stdplus_fd_dep, stdplus_dep, gmock_dep, gtest_main_dep], |
| 43 | 'fd/mmap': [stdplus_fd_dep, gtest_main_dep], |
| 44 | 'fd/mock': [stdplus_fd_dep, gmock_dep, gtest_main_dep], |
| 45 | 'fd/ops': [stdplus_fd_dep, gtest_main_dep], |
| 46 | } |
| 47 | if has_gtest |
| 48 | gtests += { |
William A. Kennington III | aa4fcfc | 2022-08-23 16:35:10 -0700 | [diff] [blame] | 49 | 'fd/atomic': [stdplus_fd_dep, stdplus_gtest_dep, gtest_main_dep], |
William A. Kennington III | ef2c0b7 | 2022-08-24 15:12:53 -0700 | [diff] [blame] | 50 | } |
| 51 | elif build_tests.enabled() |
William A. Kennington III | aa4fcfc | 2022-08-23 16:35:10 -0700 | [diff] [blame] | 52 | error('Not testing fd/atomic feature') |
William A. Kennington III | ef2c0b7 | 2022-08-24 15:12:53 -0700 | [diff] [blame] | 53 | else |
William A. Kennington III | aa4fcfc | 2022-08-23 16:35:10 -0700 | [diff] [blame] | 54 | warning('Not testing fd/atomic feature') |
William A. Kennington III | ef2c0b7 | 2022-08-24 15:12:53 -0700 | [diff] [blame] | 55 | endif |
William A. Kennington III | 4575424 | 2021-04-28 12:48:31 -0700 | [diff] [blame] | 56 | elif build_tests.enabled() |
| 57 | error('Not testing file descriptor feature') |
William A. Kennington III | eac9d47 | 2020-08-03 13:57:14 -0700 | [diff] [blame] | 58 | else |
| 59 | warning('Not testing file descriptor feature') |
| 60 | endif |
| 61 | |
William A. Kennington III | 5c20da2 | 2021-06-18 16:44:55 -0700 | [diff] [blame] | 62 | if has_io_uring |
William A. Kennington III | ef2c0b7 | 2022-08-24 15:12:53 -0700 | [diff] [blame] | 63 | gtests += { |
| 64 | 'io_uring': [stdplus_io_uring_dep, stdplus_dep, gmock_dep, gtest_main_dep], |
| 65 | } |
William A. Kennington III | 5c20da2 | 2021-06-18 16:44:55 -0700 | [diff] [blame] | 66 | elif build_tests.enabled() |
| 67 | error('Not testing io_uring feature') |
| 68 | else |
| 69 | warning('Not testing io_uring feature') |
| 70 | endif |
| 71 | |
William A. Kennington III | 953de36 | 2022-07-13 17:32:55 -0700 | [diff] [blame] | 72 | if has_gtest |
William A. Kennington III | ef2c0b7 | 2022-08-24 15:12:53 -0700 | [diff] [blame] | 73 | gtests += { |
| 74 | 'gtest/tmp': [stdplus_gtest_dep, gtest_main_dep], |
| 75 | } |
William A. Kennington III | 953de36 | 2022-07-13 17:32:55 -0700 | [diff] [blame] | 76 | elif build_tests.enabled() |
| 77 | error('Not testing gtest lib feature') |
| 78 | else |
| 79 | warning('Not testing gtest lib feature') |
| 80 | endif |
| 81 | |
William A. Kennington III | b467460 | 2022-08-24 14:54:37 -0700 | [diff] [blame] | 82 | add_test_setup( |
| 83 | 'stdplus', |
| 84 | exe_wrapper: run_with_tmp, |
| 85 | env: {'TMPTMPL': 'stdplus-test.XXXXXXXXXX'}, |
| 86 | is_default: true) |
| 87 | |
| 88 | add_test_setup( |
| 89 | 'valgrind', |
| 90 | exe_wrapper: [run_with_tmp, 'valgrind'], |
| 91 | env: {'TMPTMPL': 'stdplus-test.XXXXXXXXXX'}) |
| 92 | |
William A. Kennington III | 953de36 | 2022-07-13 17:32:55 -0700 | [diff] [blame] | 93 | if gtest_dep.found() and gmock_dep.found() |
William A. Kennington III | ef2c0b7 | 2022-08-24 15:12:53 -0700 | [diff] [blame] | 94 | foreach t, deps : gtests |
William A. Kennington III | 953de36 | 2022-07-13 17:32:55 -0700 | [diff] [blame] | 95 | test( |
| 96 | t, |
William A. Kennington III | b467460 | 2022-08-24 14:54:37 -0700 | [diff] [blame] | 97 | executable( |
William A. Kennington III | 953de36 | 2022-07-13 17:32:55 -0700 | [diff] [blame] | 98 | t.underscorify(), t + '.cpp', |
| 99 | build_by_default: false, |
| 100 | implicit_include_directories: false, |
William A. Kennington III | ef2c0b7 | 2022-08-24 15:12:53 -0700 | [diff] [blame] | 101 | dependencies: deps)) |
William A. Kennington III | 83af3fa | 2021-01-31 15:22:54 -0800 | [diff] [blame] | 102 | endforeach |
| 103 | endif |