blob: e4eb1d05c93b5abf098b24bc0110a3852e10f7c9 [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
15import("$dir_pw_build/pw_executable.gni")
Wyatt Heplerb3fca3a2020-01-03 12:14:00 -080016import("$dir_pw_unit_test/test.gni")
Alexei Frolovc10c8122019-11-01 16:31:19 -070017
18config("default_config") {
Alexei Frolov802c6e42019-12-17 15:24:35 -080019 include_dirs = [
20 "public",
21 "public_overrides",
22 ]
Alexei Frolovc10c8122019-11-01 16:31:19 -070023}
24
25# pw_unit_test core library.
26source_set("pw_unit_test") {
Wyatt Hepler21192402020-01-15 15:40:51 -080027 public_configs = [ ":default_config" ]
Alexei Frolovc10c8122019-11-01 16:31:19 -070028 public_deps = [
Wyatt Heplera55d4c72020-01-16 10:26:04 -080029 "$dir_pw_polyfill",
Alexei Frolovc10c8122019-11-01 16:31:19 -070030 "$dir_pw_preprocessor",
Wyatt Hepler8663e9c2019-11-20 13:58:29 -080031 "$dir_pw_string",
Alexei Frolovc10c8122019-11-01 16:31:19 -070032 ]
33 public = [
Alexei Frolovc10c8122019-11-01 16:31:19 -070034 "public/pw_unit_test/event_handler.h",
35 "public/pw_unit_test/framework.h",
Alexei Frolov802c6e42019-12-17 15:24:35 -080036 "public_overrides/gtest/gtest.h",
Alexei Frolovc10c8122019-11-01 16:31:19 -070037 ]
38 sources = [ "framework.cc" ] + public
39}
40
41# Library providing an event handler which outputs human-readable text.
42source_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 Mierleda0bccb2020-01-17 13:51:35 -080056source_set("simple_printing_main") {
Alexei Frolovc10c8122019-11-01 16:31:19 -070057 public_deps = [
58 ":pw_unit_test",
59 ]
60 deps = [
61 ":simple_printing_event_handler",
Armando Montanezd3ed0f42019-11-18 11:15:42 -080062 "$dir_pw_dumb_io",
Alexei Frolovc10c8122019-11-01 16:31:19 -070063 ]
64 sources = [
Keir Mierleda0bccb2020-01-17 13:51:35 -080065 "simple_printing_main.cc",
Alexei Frolovc10c8122019-11-01 16:31:19 -070066 ]
67}
68
Keir Mierleda0bccb2020-01-17 13:51:35 -080069# Library providing an event handler which logs using pw_log.
70if (dir_pw_log_backend != "") {
71 source_set("logging_event_handler") {
72 public_deps = [
73 ":pw_unit_test",
74 "$dir_pw_log",
Keir Mierleda0bccb2020-01-17 13:51:35 -080075 "$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 Heplerb3fca3a2020-01-03 12:14:00 -080097pw_test("framework_test") {
Alexei Frolovc10c8122019-11-01 16:31:19 -070098 sources = [
99 "framework_test.cc",
100 ]
101}
Wyatt Heplerb3fca3a2020-01-03 12:14:00 -0800102
103pw_test_group("tests") {
104 tests = [ ":framework_test" ]
105}