• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2021 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//build/ohos.gni")
15import("//build/test.gni")
16import("../ts.gni")
17
18if (target == "sdkdemotest") {
19  ohos_unittest("trace_streamer_sdk_ut") {
20    sources = [ "unittest/sdk_api_test.cpp" ]
21    deps = [
22      "${PREBUILTS}/protos:ts_proto_data_cpp",
23      "${THIRD_PARTY}/googletest:gtest",
24      "${THIRD_PARTY}/googletest:gtest_main",
25      "${THIRD_PARTY}/protobuf:protobuf_lite_static",
26      "${THIRD_PARTY}/protobuf:protobuf_static",
27      "${THIRD_PARTY}/sqlite:sqlite",
28      "../:trace_streamer_sdk",
29    ]
30    include_dirs = [
31      "../base",
32      "../sdk",
33      "..",
34      "../trace_streamer",
35      "../filter",
36      "../table",
37      "../trace_data",
38      "../include",
39      "../plugin",
40      "../rpc",
41      "./",
42      "../parser",
43      "../cfg",
44      "${PREBUILTS}/emsdk/emsdk/emscripten/system/include",
45      "${THIRD_PARTY}/sqlite/include",
46      "${OHOS_PROTO_GEN}",
47      "${OHOS_PROTO_GEN}/types/plugins/mock_data",
48      "${THIRD_PARTY}/googletest/googletest/include/gtest",
49      "${THIRD_PARTY}/protobuf/src",
50      "${THIRD_PARTY}/json/single_include/nlohmann",
51    ]
52    cflags = [
53      "-Wno-inconsistent-missing-override",
54      "-Dprivate=public",  #allow test code access private members
55      "-fprofile-arcs",
56      "-ftest-coverage",
57      "-Wno-unused-command-line-argument",
58      "-Wno-format",
59      "-Wno-unused-const-variable",
60      "-Wno-unused-variable",
61      "-Wno-used-but-marked-unused",
62    ]
63    ldflags = [
64      "-fprofile-arcs",
65      "-ftest-coverage",
66      "--coverage",
67    ]
68    cflags += [
69      # clang coverage options:
70      "--coverage",
71      "-mllvm",
72      "-limited-coverage-experimental=true",
73      "-fno-use-cxa-atexit",
74      "-DUT_MAC",
75    ]
76    if (is_macx) {
77      lib_dirs = [ "/usr/local/opt/llvm/lib" ]
78    }
79    libs = [ "LLVMCore" ]
80  }
81}
82
83# this is the dest for ohos.build
84if (target == "sdkdemotest") {
85  group("sdkunittest") {
86    testonly = true
87    deps = [ ":trace_streamer_sdk_ut" ]
88  }
89}
90