Alexei Frolov | c10c812 | 2019-11-01 16:31:19 -0700 | [diff] [blame] | 1 | # Copyright 2019 The Pigweed Authors |
| 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 | |
| 15 | import("$dir_pw_build/pw_executable.gni") |
Wyatt Hepler | b3fca3a | 2020-01-03 12:14:00 -0800 | [diff] [blame] | 16 | import("$dir_pw_unit_test/test.gni") |
Alexei Frolov | c10c812 | 2019-11-01 16:31:19 -0700 | [diff] [blame] | 17 | |
| 18 | config("default_config") { |
Alexei Frolov | 802c6e4 | 2019-12-17 15:24:35 -0800 | [diff] [blame] | 19 | include_dirs = [ |
| 20 | "public", |
| 21 | "public_overrides", |
| 22 | ] |
Alexei Frolov | c10c812 | 2019-11-01 16:31:19 -0700 | [diff] [blame] | 23 | } |
| 24 | |
| 25 | # pw_unit_test core library. |
| 26 | source_set("pw_unit_test") { |
Wyatt Hepler | 2119240 | 2020-01-15 15:40:51 -0800 | [diff] [blame] | 27 | public_configs = [ ":default_config" ] |
Alexei Frolov | c10c812 | 2019-11-01 16:31:19 -0700 | [diff] [blame] | 28 | public_deps = [ |
Wyatt Hepler | a55d4c7 | 2020-01-16 10:26:04 -0800 | [diff] [blame] | 29 | "$dir_pw_polyfill", |
Alexei Frolov | c10c812 | 2019-11-01 16:31:19 -0700 | [diff] [blame] | 30 | "$dir_pw_preprocessor", |
Wyatt Hepler | 8663e9c | 2019-11-20 13:58:29 -0800 | [diff] [blame] | 31 | "$dir_pw_string", |
Alexei Frolov | c10c812 | 2019-11-01 16:31:19 -0700 | [diff] [blame] | 32 | ] |
| 33 | public = [ |
Alexei Frolov | c10c812 | 2019-11-01 16:31:19 -0700 | [diff] [blame] | 34 | "public/pw_unit_test/event_handler.h", |
| 35 | "public/pw_unit_test/framework.h", |
Alexei Frolov | 802c6e4 | 2019-12-17 15:24:35 -0800 | [diff] [blame] | 36 | "public_overrides/gtest/gtest.h", |
Alexei Frolov | c10c812 | 2019-11-01 16:31:19 -0700 | [diff] [blame] | 37 | ] |
| 38 | sources = [ "framework.cc" ] + public |
| 39 | } |
| 40 | |
| 41 | # Library providing an event handler which outputs human-readable text. |
| 42 | source_set("simple_printing_event_handler") { |
| 43 | public_deps = [ |
| 44 | ":pw_unit_test", |
| 45 | "$dir_pw_preprocessor", |
| 46 | ] |
| 47 | public = [ |
| 48 | "public/pw_unit_test/simple_printing_event_handler.h", |
| 49 | ] |
| 50 | sources = [ "simple_printing_event_handler.cc" ] + public |
| 51 | } |
| 52 | |
| 53 | # Library providing a standard desktop main function for the pw_unit_test |
| 54 | # framework. Unit test files can link against this library to build runnable |
| 55 | # unit test executables. |
Keir Mierle | da0bccb | 2020-01-17 13:51:35 -0800 | [diff] [blame] | 56 | source_set("simple_printing_main") { |
Alexei Frolov | c10c812 | 2019-11-01 16:31:19 -0700 | [diff] [blame] | 57 | public_deps = [ |
| 58 | ":pw_unit_test", |
| 59 | ] |
| 60 | deps = [ |
| 61 | ":simple_printing_event_handler", |
Armando Montanez | d3ed0f4 | 2019-11-18 11:15:42 -0800 | [diff] [blame] | 62 | "$dir_pw_dumb_io", |
Alexei Frolov | c10c812 | 2019-11-01 16:31:19 -0700 | [diff] [blame] | 63 | ] |
| 64 | sources = [ |
Keir Mierle | da0bccb | 2020-01-17 13:51:35 -0800 | [diff] [blame] | 65 | "simple_printing_main.cc", |
Alexei Frolov | c10c812 | 2019-11-01 16:31:19 -0700 | [diff] [blame] | 66 | ] |
| 67 | } |
| 68 | |
Keir Mierle | da0bccb | 2020-01-17 13:51:35 -0800 | [diff] [blame] | 69 | # Library providing an event handler which logs using pw_log. |
| 70 | if (dir_pw_log_backend != "") { |
| 71 | source_set("logging_event_handler") { |
| 72 | public_deps = [ |
| 73 | ":pw_unit_test", |
| 74 | "$dir_pw_log", |
Keir Mierle | da0bccb | 2020-01-17 13:51:35 -0800 | [diff] [blame] | 75 | "$dir_pw_preprocessor", |
| 76 | ] |
| 77 | public = [ |
| 78 | "public/pw_unit_test/logging_event_handler.h", |
| 79 | ] |
| 80 | sources = [ "logging_event_handler.cc" ] + public |
| 81 | } |
| 82 | |
| 83 | source_set("logging_main") { |
| 84 | public_deps = [ |
| 85 | ":pw_unit_test", |
| 86 | ] |
| 87 | deps = [ |
| 88 | ":logging_event_handler", |
| 89 | "$dir_pw_dumb_io", |
| 90 | ] |
| 91 | sources = [ |
| 92 | "logging_main.cc", |
| 93 | ] |
| 94 | } |
| 95 | } |
| 96 | |
Wyatt Hepler | b3fca3a | 2020-01-03 12:14:00 -0800 | [diff] [blame] | 97 | pw_test("framework_test") { |
Alexei Frolov | c10c812 | 2019-11-01 16:31:19 -0700 | [diff] [blame] | 98 | sources = [ |
| 99 | "framework_test.cc", |
| 100 | ] |
| 101 | } |
Wyatt Hepler | b3fca3a | 2020-01-03 12:14:00 -0800 | [diff] [blame] | 102 | |
| 103 | pw_test_group("tests") { |
| 104 | tests = [ ":framework_test" ] |
| 105 | } |