1# Copyright (c) 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
14import("//arkcompiler/ets_runtime/js_runtime_config.gni")
15import("//arkcompiler/ets_runtime/test/test_helper.gni")
16
17test_js_path = "//arkcompiler/ets_runtime/test/executiontest/js/"
18
19test_js_files = [
20  "termination_1",
21  "termination_2",
22  "termination_3",
23  "termination_4",
24  "termination_5",
25  "termination_6",
26]
27
28foreach(file, test_js_files) {
29  es2abc_gen_abc("gen_${file}_abc") {
30    test_js = "${test_js_path}${file}.js"
31    test_abc = "$target_out_dir/${file}.abc"
32
33    # Only targets in this file can depend on this.
34    extra_visibility = [ ":*" ]
35    src_js = rebase_path(test_js)
36    dst_file = rebase_path(test_abc)
37    extra_args = []
38    extra_args += [ "--module" ]
39    extra_args += [ "--merge-abc" ]
40    in_puts = [ test_js ]
41    out_puts = [ test_abc ]
42  }
43}
44
45module_output_path = "arkcompiler/ets_runtime"
46
47host_unittest_action("ThreadTerminationTest") {
48  module_out_path = module_output_path
49
50  sources = [
51    # test file
52    "thread_termination_test.cpp",
53  ]
54
55  configs = [
56    "$js_root:ecma_test_config",
57    "$ark_root/assembler:arkassembler_public_config",
58    "$ark_root/libpandafile:arkfile_public_config",
59  ]
60
61  deps = [
62    "$ark_root/assembler:libarkassembler_static",
63    "$js_root:libark_jsruntime_test",
64    sdk_libc_secshared_dep,
65  ]
66
67  foreach(file, test_js_files) {
68    deps += [ ":gen_${file}_abc" ]
69  }
70
71  if (is_ohos && is_standard_system) {
72    test_abc_dir = "/data/test"
73  } else {
74    test_abc_dir = rebase_path(target_out_dir)
75  }
76  defines = [ "MODULE_ABC_PATH=\"${test_abc_dir}/\"" ]
77
78  # hiviewdfx libraries
79  external_deps = hiviewdfx_ext_deps
80  deps += hiviewdfx_deps
81}
82
83group("ark_execution_test") {
84  testonly = true
85
86  # deps file
87  deps = []
88}
89
90group("host_unittest") {
91  testonly = true
92
93  # deps file
94  deps = [ ":ThreadTerminationTestAction" ]
95}
96