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 = "arkcompiler/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    "$ark_root/assembler:arkassembler_public_config",
57    "$ark_root/libpandafile:arkfile_public_config",
58  ]
59
60  deps = [
61    "//arkcompiler/ets_runtime:libark_jsruntime_test",
62    "//arkcompiler/runtime_core/assembler:libarkassembler_static",
63    sdk_libc_secshared_dep,
64  ]
65
66  foreach(file, test_js_files) {
67    deps += [ ":gen_${file}_abc" ]
68  }
69
70  if (is_ohos && is_standard_system) {
71    test_abc_dir = "/data/test"
72  } else {
73    test_abc_dir = rebase_path(target_out_dir)
74  }
75
76  test_js_dir = rebase_path(test_js_path)
77
78  defines = [
79    "DEBUGGER_ABC_DIR=\"${test_abc_dir}/\"",
80    "DEBUGGER_JS_DIR=\"${test_js_dir}\"",
81  ]
82
83  # hiviewdfx libraries
84  external_deps = hiviewdfx_ext_deps
85  deps += hiviewdfx_deps
86}
87
88group("unittest") {
89  testonly = true
90
91  # deps file
92  deps = [ ":RuntimeDebuggerTest" ]
93}
94
95group("host_unittest") {
96  testonly = true
97
98  # deps file
99  deps = [ ":RuntimeDebuggerTestAction" ]
100}
101