blob: 5184919994efb948aad3944db09881db61db473a [file] [log] [blame]
Alexei Frolovc10c8122019-11-01 16:31:19 -07001# 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
Armando Montanezfb3d3fb2020-06-09 18:12:12 -070015# gn-format disable
16import("//build_overrides/pigweed.gni")
17
Alexei Frolovedd2f142020-06-09 19:11:27 -070018import("$dir_pw_build/target_types.gni")
Alexei Frolovea395522020-03-13 13:35:07 -070019import("$dir_pw_docgen/docs.gni")
Wyatt Heplerb3fca3a2020-01-03 12:14:00 -080020import("$dir_pw_unit_test/test.gni")
Alexei Frolovc10c8122019-11-01 16:31:19 -070021config("default_config") {
Alexei Frolov802c6e42019-12-17 15:24:35 -080022 include_dirs = [
23 "public",
24 "public_overrides",
25 ]
Alexei Frolovc10c8122019-11-01 16:31:19 -070026}
27
28# pw_unit_test core library.
Alexei Frolovedd2f142020-06-09 19:11:27 -070029pw_source_set("pw_unit_test") {
Wyatt Hepler21192402020-01-15 15:40:51 -080030 public_configs = [ ":default_config" ]
Alexei Frolovc10c8122019-11-01 16:31:19 -070031 public_deps = [
Wyatt Heplera55d4c72020-01-16 10:26:04 -080032 "$dir_pw_polyfill",
Alexei Frolovc10c8122019-11-01 16:31:19 -070033 "$dir_pw_preprocessor",
Wyatt Hepler8663e9c2019-11-20 13:58:29 -080034 "$dir_pw_string",
Alexei Frolovc10c8122019-11-01 16:31:19 -070035 ]
36 public = [
Alexei Frolovc10c8122019-11-01 16:31:19 -070037 "public/pw_unit_test/event_handler.h",
38 "public/pw_unit_test/framework.h",
Alexei Frolov802c6e42019-12-17 15:24:35 -080039 "public_overrides/gtest/gtest.h",
Alexei Frolovc10c8122019-11-01 16:31:19 -070040 ]
41 sources = [ "framework.cc" ] + public
42}
43
44# Library providing an event handler which outputs human-readable text.
Alexei Frolovedd2f142020-06-09 19:11:27 -070045pw_source_set("simple_printing_event_handler") {
Alexei Frolovc10c8122019-11-01 16:31:19 -070046 public_deps = [
47 ":pw_unit_test",
48 "$dir_pw_preprocessor",
49 ]
Rob Mohra0ba54f2020-02-27 11:43:49 -080050 public = [ "public/pw_unit_test/simple_printing_event_handler.h" ]
Alexei Frolovc10c8122019-11-01 16:31:19 -070051 sources = [ "simple_printing_event_handler.cc" ] + public
52}
53
54# Library providing a standard desktop main function for the pw_unit_test
55# framework. Unit test files can link against this library to build runnable
56# unit test executables.
Alexei Frolovedd2f142020-06-09 19:11:27 -070057pw_source_set("simple_printing_main") {
Rob Mohra0ba54f2020-02-27 11:43:49 -080058 public_deps = [ ":pw_unit_test" ]
Alexei Frolovc10c8122019-11-01 16:31:19 -070059 deps = [
60 ":simple_printing_event_handler",
Armando Montanezf7a5a742020-03-02 14:58:59 -080061 "$dir_pw_sys_io",
Alexei Frolovc10c8122019-11-01 16:31:19 -070062 ]
Rob Mohra0ba54f2020-02-27 11:43:49 -080063 sources = [ "simple_printing_main.cc" ]
Alexei Frolovc10c8122019-11-01 16:31:19 -070064}
65
Alexei Frolovea395522020-03-13 13:35:07 -070066pw_doc_group("docs") {
67 sources = [ "docs.rst" ]
68}
69
Keir Mierleda0bccb2020-01-17 13:51:35 -080070# Library providing an event handler which logs using pw_log.
Alexei Frolov4c0428a2020-06-10 10:46:04 -070071pw_source_set("logging_event_handler") {
72 public_deps = [
73 ":pw_unit_test",
74 "$dir_pw_log",
75 "$dir_pw_preprocessor",
76 ]
77 public = [ "public/pw_unit_test/logging_event_handler.h" ]
78 sources = [ "logging_event_handler.cc" ] + public
79}
Keir Mierleda0bccb2020-01-17 13:51:35 -080080
Alexei Frolov4c0428a2020-06-10 10:46:04 -070081pw_source_set("logging_main") {
82 public_deps = [ ":pw_unit_test" ]
83 deps = [
84 ":logging_event_handler",
85 "$dir_pw_sys_io",
86 ]
87 sources = [ "logging_main.cc" ]
Keir Mierleda0bccb2020-01-17 13:51:35 -080088}
89
Wyatt Heplerb3fca3a2020-01-03 12:14:00 -080090pw_test("framework_test") {
Rob Mohra0ba54f2020-02-27 11:43:49 -080091 sources = [ "framework_test.cc" ]
Alexei Frolovc10c8122019-11-01 16:31:19 -070092}
Wyatt Heplerb3fca3a2020-01-03 12:14:00 -080093
94pw_test_group("tests") {
95 tests = [ ":framework_test" ]
96}