• 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_frontend/es2panda/es2abc_config.gni")
15import("//arkcompiler/runtime_core/ark_config.gni")
16import("$ark_root/tests/test_helper.gni")
17
18module_out_path = "$ark_root/bytecode_optimizer"
19
20bcopt_test_config = [
21  "$ark_root:ark_config",
22  "$ark_root/assembler:arkassembler_public_config",
23  "$ark_root/libpandabase:arkbase_public_config",
24  "$ark_root/libpandafile:arkfile_public_config",
25  "$ark_root/compiler:arkcompiler_public_config",
26  "$ark_root/bytecode_optimizer:bytecodeopt_public_config",
27  sdk_libc_secshared_config,
28]
29
30bcopt_test_deps = [
31  "$ark_root/assembler:libarkassembler",
32  "$ark_root/bytecode_optimizer:libarkbytecodeopt",
33  "$ark_root/compiler:libarkcompiler",
34  "$ark_root/libpandabase:libarkbase",
35  "$ark_root/libpandafile:libarkfile",
36  "$ark_root/libziparchive:libarkziparchive",
37  sdk_libc_secshared_dep,
38]
39
40test_js_path = "//arkcompiler/runtime_core/bytecode_optimizer/tests/js/"
41graph_test_js_files = [
42  "codegenTryCatch",
43  "optimizeTryCatch",
44]
45
46foreach(file, graph_test_js_files) {
47  es2abc_gen_abc("gen_${file}_abc") {
48    test_js = "${test_js_path}${file}.js"
49    test_abc = "$target_out_dir/${file}.abc"
50
51    src_js = rebase_path(test_js)
52    dst_file = rebase_path(test_abc)
53
54    in_puts = [ test_js ]
55    out_puts = [ test_abc ]
56  }
57}
58
59host_unittest_action("BytecodeOptimizerTest") {
60  module_out_path = module_output_path
61  sources = [
62    "bcopt_type_adaption_test.cpp",
63    "codegen_test.cpp",
64    "excluded_keys_test.cpp",
65    "optimize_bytecode_test.cpp",
66    "reg_encoder_test.cpp",
67  ]
68  configs = bcopt_test_config
69  deps = bcopt_test_deps
70  test_abc_dir = rebase_path(target_out_dir)
71
72  defines = [ "GRAPH_TEST_ABC_DIR=\"${test_abc_dir}/\"" ]
73
74  foreach(file, graph_test_js_files) {
75    deps += [ ":gen_${file}_abc" ]
76  }
77
78  defines += [
79    "ARK_INTRINSIC_SET",
80    "ENABLE_BYTECODE_OPT",
81    "PANDA_WITH_ECMASCRIPT",
82  ]
83}
84
85group("host_unittest") {
86  testonly = true
87  deps = [ ":BytecodeOptimizerTestAction" ]
88}
89