Alexei Frolov | 8024679 | 2020-11-05 21:12:45 -0800 | [diff] [blame] | 1 | # Copyright 2020 The Pigweed Authors |
Alexei Frolov | c10c812 | 2019-11-01 16:31:19 -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 | |
Armando Montanez | fb3d3fb | 2020-06-09 18:12:12 -0700 | [diff] [blame] | 15 | import("//build_overrides/pigweed.gni") |
| 16 | |
Alexei Frolov | edd2f14 | 2020-06-09 19:11:27 -0700 | [diff] [blame] | 17 | import("$dir_pw_build/target_types.gni") |
Alexei Frolov | ea39552 | 2020-03-13 13:35:07 -0700 | [diff] [blame] | 18 | import("$dir_pw_docgen/docs.gni") |
Alexei Frolov | 8024679 | 2020-11-05 21:12:45 -0800 | [diff] [blame] | 19 | import("$dir_pw_protobuf_compiler/proto.gni") |
Wyatt Hepler | b3fca3a | 2020-01-03 12:14:00 -0800 | [diff] [blame] | 20 | import("$dir_pw_unit_test/test.gni") |
Wyatt Hepler | d49f8fe | 2020-10-15 10:13:47 -0700 | [diff] [blame] | 21 | |
Alexei Frolov | c10c812 | 2019-11-01 16:31:19 -0700 | [diff] [blame] | 22 | config("default_config") { |
Alexei Frolov | 802c6e4 | 2019-12-17 15:24:35 -0800 | [diff] [blame] | 23 | include_dirs = [ |
| 24 | "public", |
| 25 | "public_overrides", |
| 26 | ] |
Alexei Frolov | c10c812 | 2019-11-01 16:31:19 -0700 | [diff] [blame] | 27 | } |
| 28 | |
| 29 | # pw_unit_test core library. |
Alexei Frolov | edd2f14 | 2020-06-09 19:11:27 -0700 | [diff] [blame] | 30 | pw_source_set("pw_unit_test") { |
Wyatt Hepler | 2119240 | 2020-01-15 15:40:51 -0800 | [diff] [blame] | 31 | public_configs = [ ":default_config" ] |
Alexei Frolov | c10c812 | 2019-11-01 16:31:19 -0700 | [diff] [blame] | 32 | public_deps = [ |
Alexei Frolov | 47a4304 | 2021-04-06 14:19:55 -0700 | [diff] [blame] | 33 | dir_pw_polyfill, |
| 34 | dir_pw_preprocessor, |
| 35 | dir_pw_string, |
Alexei Frolov | c10c812 | 2019-11-01 16:31:19 -0700 | [diff] [blame] | 36 | ] |
| 37 | public = [ |
Alexei Frolov | c10c812 | 2019-11-01 16:31:19 -0700 | [diff] [blame] | 38 | "public/pw_unit_test/event_handler.h", |
| 39 | "public/pw_unit_test/framework.h", |
Alexei Frolov | 802c6e4 | 2019-12-17 15:24:35 -0800 | [diff] [blame] | 40 | "public_overrides/gtest/gtest.h", |
Alexei Frolov | c10c812 | 2019-11-01 16:31:19 -0700 | [diff] [blame] | 41 | ] |
Wyatt Hepler | 7e3f1d9 | 2020-08-07 14:09:03 -0700 | [diff] [blame] | 42 | sources = [ "framework.cc" ] |
Alexei Frolov | c10c812 | 2019-11-01 16:31:19 -0700 | [diff] [blame] | 43 | } |
| 44 | |
| 45 | # Library providing an event handler which outputs human-readable text. |
Alexei Frolov | edd2f14 | 2020-06-09 19:11:27 -0700 | [diff] [blame] | 46 | pw_source_set("simple_printing_event_handler") { |
Alexei Frolov | c10c812 | 2019-11-01 16:31:19 -0700 | [diff] [blame] | 47 | public_deps = [ |
| 48 | ":pw_unit_test", |
| 49 | "$dir_pw_preprocessor", |
| 50 | ] |
Rob Mohr | a0ba54f | 2020-02-27 11:43:49 -0800 | [diff] [blame] | 51 | public = [ "public/pw_unit_test/simple_printing_event_handler.h" ] |
Wyatt Hepler | 7e3f1d9 | 2020-08-07 14:09:03 -0700 | [diff] [blame] | 52 | sources = [ "simple_printing_event_handler.cc" ] |
Alexei Frolov | c10c812 | 2019-11-01 16:31:19 -0700 | [diff] [blame] | 53 | } |
| 54 | |
| 55 | # Library providing a standard desktop main function for the pw_unit_test |
| 56 | # framework. Unit test files can link against this library to build runnable |
| 57 | # unit test executables. |
Alexei Frolov | edd2f14 | 2020-06-09 19:11:27 -0700 | [diff] [blame] | 58 | pw_source_set("simple_printing_main") { |
Rob Mohr | a0ba54f | 2020-02-27 11:43:49 -0800 | [diff] [blame] | 59 | public_deps = [ ":pw_unit_test" ] |
Alexei Frolov | c10c812 | 2019-11-01 16:31:19 -0700 | [diff] [blame] | 60 | deps = [ |
| 61 | ":simple_printing_event_handler", |
Armando Montanez | f7a5a74 | 2020-03-02 14:58:59 -0800 | [diff] [blame] | 62 | "$dir_pw_sys_io", |
Alexei Frolov | c10c812 | 2019-11-01 16:31:19 -0700 | [diff] [blame] | 63 | ] |
Rob Mohr | a0ba54f | 2020-02-27 11:43:49 -0800 | [diff] [blame] | 64 | sources = [ "simple_printing_main.cc" ] |
Alexei Frolov | c10c812 | 2019-11-01 16:31:19 -0700 | [diff] [blame] | 65 | } |
| 66 | |
Keir Mierle | da0bccb | 2020-01-17 13:51:35 -0800 | [diff] [blame] | 67 | # Library providing an event handler which logs using pw_log. |
Alexei Frolov | 4c0428a | 2020-06-10 10:46:04 -0700 | [diff] [blame] | 68 | pw_source_set("logging_event_handler") { |
| 69 | public_deps = [ |
| 70 | ":pw_unit_test", |
| 71 | "$dir_pw_log", |
| 72 | "$dir_pw_preprocessor", |
| 73 | ] |
| 74 | public = [ "public/pw_unit_test/logging_event_handler.h" ] |
Wyatt Hepler | 7e3f1d9 | 2020-08-07 14:09:03 -0700 | [diff] [blame] | 75 | sources = [ "logging_event_handler.cc" ] |
Alexei Frolov | 4c0428a | 2020-06-10 10:46:04 -0700 | [diff] [blame] | 76 | } |
Keir Mierle | da0bccb | 2020-01-17 13:51:35 -0800 | [diff] [blame] | 77 | |
Alexei Frolov | 4c0428a | 2020-06-10 10:46:04 -0700 | [diff] [blame] | 78 | pw_source_set("logging_main") { |
| 79 | public_deps = [ ":pw_unit_test" ] |
| 80 | deps = [ |
| 81 | ":logging_event_handler", |
| 82 | "$dir_pw_sys_io", |
| 83 | ] |
| 84 | sources = [ "logging_main.cc" ] |
Keir Mierle | da0bccb | 2020-01-17 13:51:35 -0800 | [diff] [blame] | 85 | } |
| 86 | |
Alexei Frolov | 8024679 | 2020-11-05 21:12:45 -0800 | [diff] [blame] | 87 | pw_source_set("rpc_service") { |
| 88 | public_configs = [ ":default_config" ] |
| 89 | public_deps = [ |
| 90 | ":pw_unit_test", |
| 91 | ":unit_test_proto.pwpb", |
| 92 | ":unit_test_proto.raw_rpc", |
Alexei Frolov | 47a4304 | 2021-04-06 14:19:55 -0700 | [diff] [blame] | 93 | "$dir_pw_containers:vector", |
Alexei Frolov | 8024679 | 2020-11-05 21:12:45 -0800 | [diff] [blame] | 94 | ] |
| 95 | deps = [ dir_pw_log ] |
| 96 | public = [ |
| 97 | "public/pw_unit_test/internal/rpc_event_handler.h", |
| 98 | "public/pw_unit_test/unit_test_service.h", |
| 99 | ] |
| 100 | sources = [ |
| 101 | "rpc_event_handler.cc", |
| 102 | "unit_test_service.cc", |
| 103 | ] |
| 104 | } |
| 105 | |
| 106 | pw_source_set("rpc_main") { |
| 107 | public_deps = [ ":pw_unit_test" ] |
| 108 | deps = [ |
| 109 | ":rpc_service", |
Alexei Frolov | eb94e96 | 2020-12-29 16:15:40 -0800 | [diff] [blame] | 110 | "$dir_pw_rpc/system_server", |
Alexei Frolov | 8024679 | 2020-11-05 21:12:45 -0800 | [diff] [blame] | 111 | dir_pw_log, |
| 112 | ] |
| 113 | sources = [ "rpc_main.cc" ] |
| 114 | } |
| 115 | |
| 116 | pw_proto_library("unit_test_proto") { |
| 117 | sources = [ "pw_unit_test_proto/unit_test.proto" ] |
| 118 | } |
| 119 | |
| 120 | pw_doc_group("docs") { |
| 121 | sources = [ "docs.rst" ] |
| 122 | } |
| 123 | |
Wyatt Hepler | b3fca3a | 2020-01-03 12:14:00 -0800 | [diff] [blame] | 124 | pw_test("framework_test") { |
Rob Mohr | a0ba54f | 2020-02-27 11:43:49 -0800 | [diff] [blame] | 125 | sources = [ "framework_test.cc" ] |
Alexei Frolov | c10c812 | 2019-11-01 16:31:19 -0700 | [diff] [blame] | 126 | } |
Wyatt Hepler | b3fca3a | 2020-01-03 12:14:00 -0800 | [diff] [blame] | 127 | |
| 128 | pw_test_group("tests") { |
| 129 | tests = [ ":framework_test" ] |
| 130 | } |