• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021 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_frontend/es2panda/es2abc_config.gni")
15import("//arkcompiler/ets_runtime/js_runtime_config.gni")
16import("$build_root/test.gni")
17
18if (is_standard_system || ark_standalone_build) {
19  _icu_path_ = "thirdparty/icu"
20} else {
21  _icu_path_ = "global/i18n"
22}
23
24template("host_unittest_action") {
25  _target_name_ = "${target_name}"
26
27  # unittest for running on OpenHarmony device
28  ohos_unittest(_target_name_) {
29    resource_config_file =
30        "//arkcompiler/toolchain/test/resource/tooling/ohos_test.xml"
31    forward_variables_from(invoker, "*")
32  }
33
34  _module_out_path_ = invoker.module_out_path
35
36  # unittest for running on host
37  action("${_target_name_}Action") {
38    testonly = true
39
40    _host_test_target_ = ":${_target_name_}(${host_toolchain})"
41    _root_out_dir_ = get_label_info(_host_test_target_, "root_out_dir")
42
43    deps = [ _host_test_target_ ]
44
45    script = "//arkcompiler/ets_runtime/script/run_ark_executable.py"
46
47    args = [
48      "--script-file",
49      rebase_path(_root_out_dir_) +
50          "/tests/unittest/${_module_out_path_}/${_target_name_}",
51      "--expect-output",
52      "0",
53      "--env-path",
54      rebase_path(_root_out_dir_) + "/arkcompiler/ets_runtime:" +
55          rebase_path(_root_out_dir_) + "/test/test:" +
56          rebase_path(_root_out_dir_) + "/${_icu_path_}:" +
57          rebase_path(_root_out_dir_) + "/thirdparty/cjson:" +
58          rebase_path(_root_out_dir_) + "/thirdparty/libuv:" +
59          rebase_path(_root_out_dir_) + "/security/huks:" +
60          rebase_path(_root_out_dir_) + "/thirdparty/zlib:" +
61          rebase_path("//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"),
62      "--timeout-limit",
63      "1200",
64    ]
65
66    inputs = [
67      "$_root_out_dir_/tests/unittest/${_module_out_path_}/${_target_name_}",
68    ]
69    outputs = [ "$target_out_dir/${_target_name_}/" ]
70  }
71}
72