• 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.
13import("//build/ohos.gni")
14import("//build/test.gni")
15
16if (is_standard_system || ark_standalone_build) {
17  _icu_path_ = "thirdparty/icu"
18} else {
19  _icu_path_ = "global/i18n"
20}
21module_output_path = "third_party/jerryscript"
22
23template("host_unittest_action") {
24  _target_name_ = "${target_name}"
25
26  # unittest for phone running
27  ohos_unittest(_target_name_) {
28    forward_variables_from(invoker, "*")
29  }
30
31  _module_out_path_ = invoker.module_out_path
32
33  # unittest for host running
34  action("${_target_name_}Action") {
35    testonly = true
36
37    _host_test_target_ = ":${_target_name_}(${host_toolchain})"
38    _root_out_dir_ = get_label_info(_host_test_target_, "root_out_dir")
39
40    deps = [ _host_test_target_ ]
41
42    script = "//third_party/jerryscript/tools/run_jerry_tdd_executable.py"
43    args = [
44      "--script-file",
45      rebase_path(_root_out_dir_) +
46          "/tests/unittest/${_module_out_path_}/${_target_name_}",
47      "--expect-output",
48      "0",
49      "--env-path",
50      rebase_path(_root_out_dir_) + "/third_party/jerryscript:",
51      "--timeout-limit",
52      "1200",
53    ]
54
55    inputs = [
56      "$_root_out_dir_/tests/unittest/${_module_out_path_}/${_target_name_}",
57    ]
58    outputs = [ "$target_out_dir/${_target_name_}/" ]
59  }
60}
61