1# Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved. 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 "${THIRD_PARTY}/googletest:gtest", 23 "${THIRD_PARTY}/googletest:gtest_main", 24 "${THIRD_PARTY}/protobuf:protobuf_lite_static", 25 "${THIRD_PARTY}/protobuf:protobuf_static", 26 "${THIRD_PARTY}/sqlite:sqlite", 27 "../:trace_streamer_sdk", 28 ] 29 include_dirs = [ 30 "${SRC}/base", 31 "../sdk", 32 "..", 33 "../trace_streamer", 34 "../filter", 35 "../table", 36 "../trace_data", 37 "../include", 38 "../plugin", 39 "../rpc", 40 "./", 41 "../parser", 42 "../cfg", 43 "${THIRD_PARTY}/sqlite/include", 44 "${OHOS_PROTO_GEN}", 45 "${OHOS_PROTO_GEN}/types/plugins/mock_data", 46 "${THIRD_PARTY}/googletest/googletest/include/gtest", 47 "${THIRD_PARTY}/protobuf/src", 48 "${THIRD_PARTY}/json/single_include/nlohmann", 49 ] 50 cflags = [ 51 "-Wno-inconsistent-missing-override", 52 "-Dprivate=public", #allow test code access private members 53 "-fprofile-arcs", 54 "-ftest-coverage", 55 "-Wno-unused-command-line-argument", 56 "-Wno-format", 57 "-Wno-unused-const-variable", 58 "-Wno-unused-variable", 59 "-Wno-used-but-marked-unused", 60 ] 61 ldflags = [ 62 "-fprofile-arcs", 63 "-ftest-coverage", 64 "--coverage", 65 ] 66 cflags += [ 67 # clang coverage options: 68 "--coverage", 69 "-mllvm", 70 "-limited-coverage-experimental=true", 71 "-fno-use-cxa-atexit", 72 "-DIS_UT", 73 ] 74 if (is_mac) { 75 lib_dirs = [ "/usr/local/opt/llvm/lib" ] 76 } 77 libs = [ "LLVMCore" ] 78 } 79} 80 81# this is the dest for ohos.build 82if (target == "sdkdemotest") { 83 group("sdkunittest") { 84 testonly = true 85 deps = [ ":trace_streamer_sdk_ut" ] 86 } 87} 88