• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2022 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/ets_runtime/js_runtime_config.gni")
15import("//arkcompiler/ets_runtime/test/test_helper.gni")
16
17test_js_path =
18    "//arkcompiler/ets_runtime/ecmascript/debugger/tests/single_file/"
19
20test_js_files = [
21  "base/index",
22  "patch/index",
23]
24
25module_output_path = "ets_runtime/ets_runtime"
26
27foreach(file, test_js_files) {
28  es2abc_gen_abc("gen_${file}_abc") {
29    test_js = "${test_js_path}${file}.js"
30    test_abc = "$target_out_dir/single_file/${file}.abc"
31
32    # Only targets in this file can depend on this.
33    extra_visibility = [ ":*" ]
34    src_js = rebase_path(test_js)
35    dst_file = rebase_path(test_abc)
36    extra_args = [ "--module" ]
37    extra_args += [ "--merge-abc" ]
38
39    in_puts = [ test_js ]
40    out_puts = [ test_abc ]
41  }
42}
43
44host_unittest_action("RuntimeDebuggerTest") {
45  module_out_path = module_output_path
46
47  sources = [
48    # test file
49    "dropframe_manager_test.cpp",
50    "hot_reload_manager_test.cpp",
51    "js_debugger_test.cpp",
52  ]
53
54  configs = [
55    "//arkcompiler/ets_runtime:ecma_test_config",
56  ]
57
58  if (ark_standalone_build || is_arkui_x) {
59    configs += [
60      "$ark_root/assembler:arkassembler_public_config",
61      "$ark_root/libpandafile:arkfile_public_config",
62    ]
63  }
64
65  deps = [
66    "$js_root:libark_jsruntime_test",
67  ]
68
69  foreach(file, test_js_files) {
70    deps += [ ":gen_${file}_abc" ]
71  }
72
73  if (is_ohos && is_standard_system) {
74    test_abc_dir = "/data/test"
75  } else {
76    test_abc_dir = rebase_path(target_out_dir)
77  }
78
79  test_js_dir = rebase_path(test_js_path)
80
81  defines = [
82    "DEBUGGER_ABC_DIR=\"${test_abc_dir}/\"",
83    "DEBUGGER_JS_DIR=\"${test_js_dir}\"",
84  ]
85
86  # hiviewdfx libraries
87  external_deps = hiviewdfx_ext_deps
88  external_deps += [ "runtime_core:libarkassembler_static" ]
89  if (!ark_standalone_build && !is_arkui_x) {
90    external_deps += [
91      "runtime_core:arkassembler_public_headers",
92      "runtime_core:arkfile_public_headers",
93    ]
94  }
95  deps += hiviewdfx_deps
96}
97
98group("unittest") {
99  testonly = true
100
101  # deps file
102  deps = [ ":RuntimeDebuggerTest" ]
103}
104
105group("host_unittest") {
106  testonly = true
107
108  # deps file
109  deps = [ ":RuntimeDebuggerTestAction" ]
110}
111