blob: d8d1ad1e45f1836b2868f32cd5781437e43d45da [file] [log] [blame]
Keir Mierle3cee8792020-01-22 17:08:13 -08001# Copyright 2020 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
Keir Mierle3cee8792020-01-22 17:08:13 -080018import("$dir_pw_build/facade.gni")
19import("$dir_pw_docgen/docs.gni")
20import("$dir_pw_unit_test/test.gni")
Alexei Frolov4c0428a2020-06-10 10:46:04 -070021declare_args() {
22 # Backend for the pw_assert module.
23 pw_assert_BACKEND = ""
24}
25
Keir Mierle3cee8792020-01-22 17:08:13 -080026config("default_config") {
27 include_dirs = [ "public" ]
28}
29
30pw_facade("pw_assert") {
Alexei Frolov4c0428a2020-06-10 10:46:04 -070031 backend = pw_assert_BACKEND
Keir Mierle3cee8792020-01-22 17:08:13 -080032 public_configs = [ ":default_config" ]
Keir Mierled1211ed2020-04-03 13:20:46 -070033 public = [
34 "public/pw_assert/assert.h",
35 "public/pw_assert/internal/assert_impl.h",
36 ]
Rob Mohra0ba54f2020-02-27 11:43:49 -080037 public_deps = [ dir_pw_preprocessor ]
Keir Mierle3cee8792020-01-22 17:08:13 -080038}
39
40pw_test_group("tests") {
Armando Montanezceb66f52020-06-04 12:56:38 -070041 tests = [
42 ":assert_backend_compile_test",
43 ":assert_facade_test",
44 ]
Keir Mierle3cee8792020-01-22 17:08:13 -080045}
46
Keir Mierle8d2a84f2020-04-14 22:00:00 -070047# The assert facade test doesn't require a backend since a fake one is
48# provided. However, since this doesn't depend on the backend it re-includes
49# the facade headers.
50pw_test("assert_facade_test") {
51 configs = [ ":default_config" ] # For internal/assert_impl.h
52 sources = [
53 "assert_facade_test.cc",
54 "fake_backend.cc",
55 "public/pw_assert/internal/assert_impl.h",
56 "pw_assert_test/fake_backend.h",
57 ]
Keir Mierle0fa7f7d2020-05-07 12:34:00 -070058 deps = [ dir_pw_status ]
Alexei Frolov844ff0f2020-05-06 12:15:29 -070059
60 # TODO(frolv): Fix this test on the QEMU target.
Alexei Frolov4c0428a2020-06-10 10:46:04 -070061 enable_if = pw_build_EXECUTABLE_TARGET_TYPE != "lm3s6965evb_executable"
Keir Mierle8d2a84f2020-04-14 22:00:00 -070062}
63
Armando Montanezceb66f52020-06-04 12:56:38 -070064pw_test("assert_backend_compile_test") {
Alexei Frolov4c0428a2020-06-10 10:46:04 -070065 enable_if = pw_assert_BACKEND != ""
Armando Montanezceb66f52020-06-04 12:56:38 -070066 deps = [
67 ":pw_assert",
Keir Mierle0fa7f7d2020-05-07 12:34:00 -070068 dir_pw_status,
Alexei Frolov4c0428a2020-06-10 10:46:04 -070069 pw_assert_BACKEND,
Armando Montanezceb66f52020-06-04 12:56:38 -070070 ]
71 sources = [
Armando Montanezceb66f52020-06-04 12:56:38 -070072 "assert_backend_compile_test.cc",
Michael Spanga99220e2020-06-11 20:07:16 -040073 "assert_backend_compile_test_c.c",
Armando Montanezceb66f52020-06-04 12:56:38 -070074 ]
Keir Mierle3cee8792020-01-22 17:08:13 -080075}
76
77pw_doc_group("docs") {
Rob Mohra0ba54f2020-02-27 11:43:49 -080078 sources = [ "docs.rst" ]
Keir Mierle3cee8792020-01-22 17:08:13 -080079}