1# Copyright (c) 2021-2023 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
14if (defined(ohos_lite)) {
15  import("//build/lite/config/component/lite_component.gni")
16  import("//build/lite/config/test.gni")
17  import("../../../../dsoftbus.gni")
18
19  if (ohos_build_type == "debug") {
20    unittest("SoftbusUtilsTest") {
21      output_extension = "bin"
22      output_dir = "$root_out_dir/tests/unittest/dsoftbus"
23      sources = [ "unittest/softbus_utils_test.cpp" ]
24      include_dirs = [ "$dsoftbus_root_path/core/common/include" ]
25      ldflags = [
26        "-lstdc++",
27        "-Wl,-rpath-link=$ohos_root_path/$root_out_dir",
28      ]
29      deps = [ "$dsoftbus_root_path/core/common:softbus_utils" ]
30      external_deps = [ "hilog:libhilog" ]
31    }
32  }
33} else {
34  import("//build/test.gni")
35  import("../../../../dsoftbus.gni")
36
37  module_output_path = "dsoftbus/common"
38  ohos_unittest("SoftbusUtilsTest") {
39    module_out_path = module_output_path
40    sources = [ "unittest/softbus_utils_test.cpp" ]
41    include_dirs = [ "$dsoftbus_root_path/core/common/include" ]
42    deps = [ "$dsoftbus_root_path/core/common:softbus_utils" ]
43    external_deps = [ "hilog:libhilog" ]
44  }
45
46  ohos_unittest("Sqlite3UtilsTest") {
47    module_out_path = module_output_path
48    sources = [ "unittest/sqlite3_utils_test.cpp" ]
49
50    include_dirs = [
51      "$dsoftbus_root_path/adapter/common/include",
52      "$dsoftbus_root_path/core/common/include",
53      "$dsoftbus_root_path/interfaces/kits/bus_center",
54      "$dsoftbus_root_path/interfaces/kits/common",
55    ]
56
57    deps = [
58      "$dsoftbus_root_path/adapter:softbus_adapter",
59      "$dsoftbus_root_path/core/common:softbus_utils",
60    ]
61    external_deps = [
62      "googletest:gtest_main",
63      "hilog:libhilog",
64      "sqlite:sqlite",
65    ]
66  }
67
68  group("unittest") {
69    testonly = true
70    deps = [
71      ":SoftbusUtilsTest",
72      ":Sqlite3UtilsTest",
73      "permission_state_test:PermissionStateTest",
74    ]
75  }
76}
77