• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2024 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("//arkcompiler/runtime_core/ark_config.gni")
15import("$ark_root/tests/test_helper.gni")
16
17panda_guard_test_configs = [ "$ark_root/panda_guard:panda_guard_public_config" ]
18
19panda_guard_test_deps = [ "$ark_root/panda_guard:panda_guard_static" ]
20
21panda_guard_include_dirs = [ "$ark_root/panda_guard/tests" ]
22
23action("update_unittest_config") {
24  script = "$ark_root/panda_guard/tests/script/update_test_config_json.py"
25  args = [
26    "--project-dir",
27    rebase_path("$ark_root/panda_guard"),
28  ]
29  outputs = [ "${target_out_dir}/panda_guard_unittest_json_update" ]
30}
31
32host_unittest_action("PandaGuardUnitTest") {
33  module_out_path = "$ark_root"
34  sources = [
35    "unittest/guard_args_parser_test.cpp",
36    "unittest/guard_context_test.cpp",
37    "unittest/guard_name_cache_test.cpp",
38    "unittest/guard_options_test.cpp",
39    "unittest/name_generator_test.cpp",
40    "unittest/string_util_test.cpp",
41    "util/test_util.cpp",
42  ]
43  include_dirs = panda_guard_include_dirs
44  configs = panda_guard_test_configs
45  configs += [
46    "$ark_root:ark_config",
47    "$ark_root/assembler:arkassembler_public_config",
48    "$ark_root/libpandabase:arkbase_public_config",
49    "$ark_root/libpandafile:arkfile_public_config",
50    "$ark_root/compiler:arkcompiler_public_config",
51  ]
52  deps = panda_guard_test_deps
53  unit_test_dir = rebase_path("$ark_root/panda_guard/tests/unittest/")
54  defines = [ "PANDA_GUARD_UNIT_TEST_DIR=\"${unit_test_dir}/\"" ]
55
56  deps += [ ":update_unittest_config" ]
57
58  external_deps = [ sdk_libc_secshared_dep ]
59}
60
61group("host_unittest") {
62  testonly = true
63  deps = [ ":PandaGuardUnitTestAction" ]
64}
65