Wyatt Hepler | 0412a7d | 2020-01-28 16:27:32 -0800 | [diff] [blame] | 1 | # Copyright 2020 The Pigweed Authors |
Alexei Frolov | 1a82c14 | 2019-10-31 17:37:12 -0700 | [diff] [blame] | 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| 4 | # use this file except in compliance with the License. You may obtain a copy of |
| 5 | # the License at |
| 6 | # |
| 7 | # https://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | # License for the specific language governing permissions and limitations under |
| 13 | # the License. |
| 14 | |
Wyatt Hepler | edf6f29 | 2019-11-25 18:52:21 -0800 | [diff] [blame] | 15 | import("$dir_pw_unit_test/test.gni") |
| 16 | |
Armando Montanez | 04c56ae | 2019-12-12 14:34:05 -0800 | [diff] [blame] | 17 | # By default, Pigweed will build this target when invoking ninja. |
| 18 | group("default") { |
Alexei Frolov | 799be5d | 2020-01-09 15:54:39 -0800 | [diff] [blame] | 19 | deps = [] |
| 20 | if (defined(pw_is_docs_target) && pw_is_docs_target) { |
| 21 | deps += [ "$dir_pigweed/docs" ] |
Keir Mierle | e2f5d0f | 2019-12-16 11:36:22 -0800 | [diff] [blame] | 22 | } else { |
Alexei Frolov | 799be5d | 2020-01-09 15:54:39 -0800 | [diff] [blame] | 23 | if (pw_automatic_test_runner == "") { |
| 24 | # Without a test runner defined, build the tests but don't run them. |
| 25 | deps += [ ":pw_module_tests" ] |
| 26 | } else { |
| 27 | # With a test runner, depend on the run targets so they run with the build. |
| 28 | deps += [ ":pw_module_tests_run" ] |
| 29 | } |
Keir Mierle | e2f5d0f | 2019-12-16 11:36:22 -0800 | [diff] [blame] | 30 | } |
Alexei Frolov | ca9cf60 | 2019-12-26 13:00:03 -0800 | [diff] [blame] | 31 | if (pw_build_host_tools) { |
| 32 | deps += [ ":host_tools" ] |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | group("host_tools") { |
| 37 | deps = [ |
| 38 | "$dir_pw_target_runner/go:simple_client", |
| 39 | "$dir_pw_target_runner/go:simple_server", |
| 40 | ] |
Armando Montanez | 04c56ae | 2019-12-12 14:34:05 -0800 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | group("pw_facades") { |
| 44 | deps = [ |
Armando Montanez | 5104cd6 | 2019-12-10 14:36:43 -0800 | [diff] [blame] | 45 | "$dir_pw_cpu_exception", |
Armando Montanez | f7a5a74 | 2020-03-02 14:58:59 -0800 | [diff] [blame] | 46 | "$dir_pw_sys_io", |
Armando Montanez | 04c56ae | 2019-12-12 14:34:05 -0800 | [diff] [blame] | 47 | ] |
| 48 | } |
| 49 | |
| 50 | # All Pigweed modules that can be built using gn. This is not built by default. |
Alexei Frolov | 1a82c14 | 2019-10-31 17:37:12 -0700 | [diff] [blame] | 51 | group("pw_modules") { |
| 52 | deps = [ |
Alexei Frolov | 0efdb11 | 2019-11-14 17:22:08 -0800 | [diff] [blame] | 53 | "$dir_pigweed/docs", |
Jamie Garside | 558e144 | 2020-03-27 17:05:55 +0000 | [diff] [blame] | 54 | "$dir_pw_allocator", |
Wyatt Hepler | b8b01e3 | 2020-01-08 18:33:40 -0800 | [diff] [blame] | 55 | "$dir_pw_base64", |
Wyatt Hepler | 92ccb66 | 2020-01-21 18:28:41 -0800 | [diff] [blame] | 56 | "$dir_pw_checksum", |
Wyatt Hepler | c542a5d | 2020-01-15 15:43:10 -0800 | [diff] [blame] | 57 | "$dir_pw_polyfill", |
Alexei Frolov | c10c812 | 2019-11-01 16:31:19 -0700 | [diff] [blame] | 58 | "$dir_pw_preprocessor", |
Alexei Frolov | bbf164c | 2019-12-16 12:51:59 -0800 | [diff] [blame] | 59 | "$dir_pw_protobuf", |
Alexei Frolov | 41b32d3 | 2019-11-13 17:22:03 -0800 | [diff] [blame] | 60 | "$dir_pw_result", |
Wyatt Hepler | 7710565 | 2019-11-06 17:50:03 -0800 | [diff] [blame] | 61 | "$dir_pw_span", |
Alexei Frolov | 1a82c14 | 2019-10-31 17:37:12 -0700 | [diff] [blame] | 62 | "$dir_pw_status", |
Wyatt Hepler | 48db4d6 | 2019-11-11 10:32:45 -0800 | [diff] [blame] | 63 | "$dir_pw_string", |
Alexei Frolov | c10c812 | 2019-11-01 16:31:19 -0700 | [diff] [blame] | 64 | "$dir_pw_unit_test", |
Alexei Frolov | 82d3cb3 | 2019-11-27 14:38:39 -0800 | [diff] [blame] | 65 | "$dir_pw_varint", |
Alexei Frolov | 1a82c14 | 2019-10-31 17:37:12 -0700 | [diff] [blame] | 66 | ] |
Alexei Frolov | 8c4b752 | 2020-01-31 11:15:57 -0800 | [diff] [blame] | 67 | |
Alexei Frolov | 8c4b752 | 2020-01-31 11:15:57 -0800 | [diff] [blame] | 68 | if (host_os != "win") { |
| 69 | deps += [ |
Rob Mohr | 2156c0a | 2020-02-07 10:06:53 -0800 | [diff] [blame] | 70 | # TODO(frolv): Remove these two when new KVS is ready. |
Alexei Frolov | 8c4b752 | 2020-01-31 11:15:57 -0800 | [diff] [blame] | 71 | "$dir_pw_kvs", |
| 72 | "$dir_pw_minimal_cpp_stdlib", |
Rob Mohr | a68755a | 2020-02-07 09:28:16 -0800 | [diff] [blame] | 73 | |
Rob Mohr | 2156c0a | 2020-02-07 10:06:53 -0800 | [diff] [blame] | 74 | # TODO(pwbug/111): Remove this when building successfully on Windows. |
| 75 | "$dir_pw_tokenizer", |
| 76 | ] |
Alexei Frolov | 8c4b752 | 2020-01-31 11:15:57 -0800 | [diff] [blame] | 77 | } |
Alexei Frolov | 1a82c14 | 2019-10-31 17:37:12 -0700 | [diff] [blame] | 78 | } |
Alexei Frolov | 925fb8f | 2019-11-05 16:32:30 -0800 | [diff] [blame] | 79 | |
| 80 | # Targets for all module unit test groups. |
Wyatt Hepler | edf6f29 | 2019-11-25 18:52:21 -0800 | [diff] [blame] | 81 | pw_test_group("pw_module_tests") { |
| 82 | group_deps = [ |
Jamie Garside | 558e144 | 2020-03-27 17:05:55 +0000 | [diff] [blame] | 83 | "$dir_pw_allocator:tests", |
Keir Mierle | 3cee879 | 2020-01-22 17:08:13 -0800 | [diff] [blame] | 84 | "$dir_pw_assert:tests", |
Wyatt Hepler | b8b01e3 | 2020-01-08 18:33:40 -0800 | [diff] [blame] | 85 | "$dir_pw_base64:tests", |
Wyatt Hepler | 92ccb66 | 2020-01-21 18:28:41 -0800 | [diff] [blame] | 86 | "$dir_pw_checksum:tests", |
Wyatt Hepler | 76293e3 | 2020-02-07 18:07:19 -0800 | [diff] [blame] | 87 | "$dir_pw_containers:tests", |
Aaron Green | f3c3d2b | 2020-04-02 23:12:31 -0700 | [diff] [blame] | 88 | "$dir_pw_fuzzer:tests", |
Keir Mierle | af5e358 | 2019-12-30 13:11:05 -0800 | [diff] [blame] | 89 | "$dir_pw_log:tests", |
Wyatt Hepler | cb725c1 | 2020-05-01 11:05:01 -0700 | [diff] [blame] | 90 | "$dir_pw_log_tokenized:tests", |
Wyatt Hepler | c542a5d | 2020-01-15 15:43:10 -0800 | [diff] [blame] | 91 | "$dir_pw_polyfill:tests", |
Alexei Frolov | a454c68 | 2019-11-19 10:55:07 -0800 | [diff] [blame] | 92 | "$dir_pw_preprocessor:tests", |
Alexei Frolov | bbf164c | 2019-12-16 12:51:59 -0800 | [diff] [blame] | 93 | "$dir_pw_protobuf:tests", |
Alexei Frolov | f39cd8b | 2020-04-13 17:59:20 -0700 | [diff] [blame] | 94 | "$dir_pw_protobuf_compiler:tests", |
Alexei Frolov | 41b32d3 | 2019-11-13 17:22:03 -0800 | [diff] [blame] | 95 | "$dir_pw_result:tests", |
Keir Mierle | 866cff4 | 2020-04-28 22:24:44 -0700 | [diff] [blame] | 96 | "$dir_pw_ring_buffer:tests", |
Alexei Frolov | 26e3ae6 | 2020-05-04 17:06:17 -0700 | [diff] [blame] | 97 | "$dir_pw_rpc:tests", |
Alexei Frolov | a454c68 | 2019-11-19 10:55:07 -0800 | [diff] [blame] | 98 | "$dir_pw_span:tests", |
| 99 | "$dir_pw_status:tests", |
| 100 | "$dir_pw_string:tests", |
Armando Montanez | 870a86b | 2020-05-26 10:54:38 -0700 | [diff] [blame] | 101 | "$dir_pw_tokenizer:tests", |
Wyatt Hepler | b3fca3a | 2020-01-03 12:14:00 -0800 | [diff] [blame] | 102 | "$dir_pw_unit_test:tests", |
Alexei Frolov | 82d3cb3 | 2019-11-27 14:38:39 -0800 | [diff] [blame] | 103 | "$dir_pw_varint:tests", |
Alexei Frolov | 925fb8f | 2019-11-05 16:32:30 -0800 | [diff] [blame] | 104 | ] |
Armando Montanez | 5104cd6 | 2019-12-10 14:36:43 -0800 | [diff] [blame] | 105 | |
| 106 | # TODO(pwbug/17): Re-think when Pigweed config system is added. |
| 107 | if (dir_pw_cpu_exception_backend == dir_pw_cpu_exception_armv7m) { |
| 108 | group_deps += [ "$dir_pw_cpu_exception_armv7m:tests" ] |
| 109 | } |
Alexei Frolov | 8c4b752 | 2020-01-31 11:15:57 -0800 | [diff] [blame] | 110 | |
Armando Montanez | 870a86b | 2020-05-26 10:54:38 -0700 | [diff] [blame] | 111 | if (pw_build_host_tools) { |
| 112 | # TODO(pwbug/196): KVS tests are not compatible with device builds as they |
| 113 | # use features such as std::map and are computationally expensive. Solving |
| 114 | # this requires a more complex capabilities-based build and configuration |
| 115 | # system which allowing enabling specific tests for targets that support |
| 116 | # them and modifying test parameters for different targets. |
| 117 | # |
| 118 | # Checking for pw_build_host_tools (which is only set by the host) is a |
| 119 | # temporary fix until the problem can be properly solved. |
| 120 | group_deps += [ "$dir_pw_kvs:tests" ] |
| 121 | } |
| 122 | |
Alexei Frolov | 8c4b752 | 2020-01-31 11:15:57 -0800 | [diff] [blame] | 123 | if (host_os != "win") { |
Armando Montanez | 870a86b | 2020-05-26 10:54:38 -0700 | [diff] [blame] | 124 | # TODO(amontanez): pw_minimal_cpp_stdlib tests do not build on windows. |
| 125 | group_deps += [ "$dir_pw_minimal_cpp_stdlib:tests" ] |
Alexei Frolov | 8c4b752 | 2020-01-31 11:15:57 -0800 | [diff] [blame] | 126 | } |
Alexei Frolov | 925fb8f | 2019-11-05 16:32:30 -0800 | [diff] [blame] | 127 | } |