blob: 4283c1438ffebbe4256655c599675881f72b6361 [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 ]
Rob Mohra0ba54f2020-02-27 11:43:49 -080047 public = [ "public/pw_unit_test/simple_printing_event_handler.h" ]
Alexei Frolovc10c8122019-11-01 16:31:19 -070048 sources = [ "simple_printing_event_handler.cc" ] + public
49}
50
51# Library providing a standard desktop main function for the pw_unit_test
52# framework. Unit test files can link against this library to build runnable
53# unit test executables.
Keir Mierleda0bccb2020-01-17 13:51:35 -080054source_set("simple_printing_main") {
Rob Mohra0ba54f2020-02-27 11:43:49 -080055 public_deps = [ ":pw_unit_test" ]
Alexei Frolovc10c8122019-11-01 16:31:19 -070056 deps = [
57 ":simple_printing_event_handler",
Armando Montanezf7a5a742020-03-02 14:58:59 -080058 "$dir_pw_sys_io",
Alexei Frolovc10c8122019-11-01 16:31:19 -070059 ]
Rob Mohra0ba54f2020-02-27 11:43:49 -080060 sources = [ "simple_printing_main.cc" ]
Alexei Frolovc10c8122019-11-01 16:31:19 -070061}
62
Keir Mierleda0bccb2020-01-17 13:51:35 -080063# Library providing an event handler which logs using pw_log.
64if (dir_pw_log_backend != "") {
65 source_set("logging_event_handler") {
66 public_deps = [
67 ":pw_unit_test",
68 "$dir_pw_log",
Keir Mierleda0bccb2020-01-17 13:51:35 -080069 "$dir_pw_preprocessor",
70 ]
Rob Mohra0ba54f2020-02-27 11:43:49 -080071 public = [ "public/pw_unit_test/logging_event_handler.h" ]
Keir Mierleda0bccb2020-01-17 13:51:35 -080072 sources = [ "logging_event_handler.cc" ] + public
73 }
74
75 source_set("logging_main") {
Rob Mohra0ba54f2020-02-27 11:43:49 -080076 public_deps = [ ":pw_unit_test" ]
Keir Mierleda0bccb2020-01-17 13:51:35 -080077 deps = [
78 ":logging_event_handler",
Armando Montanezf7a5a742020-03-02 14:58:59 -080079 "$dir_pw_sys_io",
Keir Mierleda0bccb2020-01-17 13:51:35 -080080 ]
Rob Mohra0ba54f2020-02-27 11:43:49 -080081 sources = [ "logging_main.cc" ]
Keir Mierleda0bccb2020-01-17 13:51:35 -080082 }
83}
84
Wyatt Heplerb3fca3a2020-01-03 12:14:00 -080085pw_test("framework_test") {
Rob Mohra0ba54f2020-02-27 11:43:49 -080086 sources = [ "framework_test.cc" ]
Alexei Frolovc10c8122019-11-01 16:31:19 -070087}
Wyatt Heplerb3fca3a2020-01-03 12:14:00 -080088
89pw_test_group("tests") {
90 tests = [ ":framework_test" ]
91}