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], |
| 6 | 'raw': [stdplus_dep, gmock_dep, gtest_main_dep], |
| 7 | 'signal': [stdplus_dep, gtest_main_dep], |
| 8 | 'util/cexec': [stdplus_dep, gtest_main_dep], |
| 9 | 'util/string': [stdplus_dep, gtest_main_dep], |
| 10 | } |
William A. Kennington III | d7acddd | 2022-07-13 16:41:11 -0700 | [diff] [blame] | 11 | |
William A. Kennington III | 5a52802 | 2021-04-28 12:52:43 -0700 | [diff] [blame] | 12 | if has_dl |
William A. Kennington III | ef2c0b7 | 2022-08-24 15:12:53 -0700 | [diff] [blame] | 13 | gtests += { |
| 14 | 'dl': [stdplus_dl_dep, gtest_main_dep], |
| 15 | } |
William A. Kennington III | 5a52802 | 2021-04-28 12:52:43 -0700 | [diff] [blame] | 16 | elif build_tests.enabled() |
| 17 | error('Not testing libdl feature') |
| 18 | else |
| 19 | warning('Not testing libdl feature') |
| 20 | endif |
| 21 | |
William A. Kennington III | eac9d47 | 2020-08-03 13:57:14 -0700 | [diff] [blame] | 22 | if has_fd |
William A. Kennington III | ef2c0b7 | 2022-08-24 15:12:53 -0700 | [diff] [blame] | 23 | gtests += { |
| 24 | 'fd/dupable': [stdplus_fd_dep], |
| 25 | 'fd/managed': [stdplus_fd_dep], |
William A. Kennington III | aa4fcfc | 2022-08-23 16:35:10 -0700 | [diff] [blame^] | 26 | 'fd/fmt': [stdplus_fd_dep, stdplus_dep, gtest_main_dep], |
William A. Kennington III | ef2c0b7 | 2022-08-24 15:12:53 -0700 | [diff] [blame] | 27 | 'fd/intf': [stdplus_fd_dep], |
| 28 | 'fd/impl': [stdplus_fd_dep], |
| 29 | 'fd/line': [stdplus_fd_dep, stdplus_dep, gmock_dep, gtest_main_dep], |
| 30 | 'fd/mmap': [stdplus_fd_dep, gtest_main_dep], |
| 31 | 'fd/mock': [stdplus_fd_dep, gmock_dep, gtest_main_dep], |
| 32 | 'fd/ops': [stdplus_fd_dep, gtest_main_dep], |
| 33 | } |
| 34 | if has_gtest |
| 35 | gtests += { |
William A. Kennington III | aa4fcfc | 2022-08-23 16:35:10 -0700 | [diff] [blame^] | 36 | '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] | 37 | } |
| 38 | elif build_tests.enabled() |
William A. Kennington III | aa4fcfc | 2022-08-23 16:35:10 -0700 | [diff] [blame^] | 39 | error('Not testing fd/atomic feature') |
William A. Kennington III | ef2c0b7 | 2022-08-24 15:12:53 -0700 | [diff] [blame] | 40 | else |
William A. Kennington III | aa4fcfc | 2022-08-23 16:35:10 -0700 | [diff] [blame^] | 41 | warning('Not testing fd/atomic feature') |
William A. Kennington III | ef2c0b7 | 2022-08-24 15:12:53 -0700 | [diff] [blame] | 42 | endif |
William A. Kennington III | 4575424 | 2021-04-28 12:48:31 -0700 | [diff] [blame] | 43 | elif build_tests.enabled() |
| 44 | error('Not testing file descriptor feature') |
William A. Kennington III | eac9d47 | 2020-08-03 13:57:14 -0700 | [diff] [blame] | 45 | else |
| 46 | warning('Not testing file descriptor feature') |
| 47 | endif |
| 48 | |
William A. Kennington III | 5c20da2 | 2021-06-18 16:44:55 -0700 | [diff] [blame] | 49 | if has_io_uring |
William A. Kennington III | ef2c0b7 | 2022-08-24 15:12:53 -0700 | [diff] [blame] | 50 | gtests += { |
| 51 | 'io_uring': [stdplus_io_uring_dep, stdplus_dep, gmock_dep, gtest_main_dep], |
| 52 | } |
William A. Kennington III | 5c20da2 | 2021-06-18 16:44:55 -0700 | [diff] [blame] | 53 | elif build_tests.enabled() |
| 54 | error('Not testing io_uring feature') |
| 55 | else |
| 56 | warning('Not testing io_uring feature') |
| 57 | endif |
| 58 | |
William A. Kennington III | 953de36 | 2022-07-13 17:32:55 -0700 | [diff] [blame] | 59 | if has_gtest |
William A. Kennington III | ef2c0b7 | 2022-08-24 15:12:53 -0700 | [diff] [blame] | 60 | gtests += { |
| 61 | 'gtest/tmp': [stdplus_gtest_dep, gtest_main_dep], |
| 62 | } |
William A. Kennington III | 953de36 | 2022-07-13 17:32:55 -0700 | [diff] [blame] | 63 | elif build_tests.enabled() |
| 64 | error('Not testing gtest lib feature') |
| 65 | else |
| 66 | warning('Not testing gtest lib feature') |
| 67 | endif |
| 68 | |
William A. Kennington III | b467460 | 2022-08-24 14:54:37 -0700 | [diff] [blame] | 69 | add_test_setup( |
| 70 | 'stdplus', |
| 71 | exe_wrapper: run_with_tmp, |
| 72 | env: {'TMPTMPL': 'stdplus-test.XXXXXXXXXX'}, |
| 73 | is_default: true) |
| 74 | |
| 75 | add_test_setup( |
| 76 | 'valgrind', |
| 77 | exe_wrapper: [run_with_tmp, 'valgrind'], |
| 78 | env: {'TMPTMPL': 'stdplus-test.XXXXXXXXXX'}) |
| 79 | |
William A. Kennington III | 953de36 | 2022-07-13 17:32:55 -0700 | [diff] [blame] | 80 | if gtest_dep.found() and gmock_dep.found() |
William A. Kennington III | ef2c0b7 | 2022-08-24 15:12:53 -0700 | [diff] [blame] | 81 | foreach t, deps : gtests |
William A. Kennington III | 953de36 | 2022-07-13 17:32:55 -0700 | [diff] [blame] | 82 | test( |
| 83 | t, |
William A. Kennington III | b467460 | 2022-08-24 14:54:37 -0700 | [diff] [blame] | 84 | executable( |
William A. Kennington III | 953de36 | 2022-07-13 17:32:55 -0700 | [diff] [blame] | 85 | t.underscorify(), t + '.cpp', |
| 86 | build_by_default: false, |
| 87 | implicit_include_directories: false, |
William A. Kennington III | ef2c0b7 | 2022-08-24 15:12:53 -0700 | [diff] [blame] | 88 | dependencies: deps)) |
William A. Kennington III | 83af3fa | 2021-01-31 15:22:54 -0800 | [diff] [blame] | 89 | endforeach |
| 90 | endif |