• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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("//build/config/components/ets_frontend/es2abc_config.gni")
15import("//arkcompiler/runtime_core/ark_config.gni")
16import("$ark_root/tests/test_helper.gni")
17
18verifier_test_configs = [
19  "$ark_root:ark_config",
20  "$ark_root/libpandabase:arkbase_public_config",
21  "$ark_root/libpandafile:arkfile_public_config",
22]
23
24verifier_test_deps = [
25  "$ark_root/libpandabase:libarkbase_static",
26  "$ark_root/libpandafile:libarkfile_static",
27  "$ark_root/verifier:libarkverifier",
28]
29
30verifier_test_js_files = [
31  "test_checksum",
32  "test_constant_pool",
33  "test_register_index",
34  "test_constant_pool_content",
35]
36
37verifier_test_ts_files = [ "test_literal_array" ]
38
39test_js_path = "//arkcompiler/runtime_core/verifier/tests/js/"
40test_ts_path = "//arkcompiler/runtime_core/verifier/tests/ts/"
41
42foreach(file, verifier_test_js_files) {
43  es2abc_gen_abc("gen_${file}_abc") {
44    test_js = "${test_js_path}${file}.js"
45    test_abc = "$target_out_dir/${file}.abc"
46
47    src_js = rebase_path(test_js)
48    dst_file = rebase_path(test_abc)
49
50    extra_args = [ "--source-file=${file}" ]
51
52    in_puts = [ test_js ]
53    out_puts = [ test_abc ]
54  }
55}
56
57foreach(file, verifier_test_ts_files) {
58  es2abc_gen_abc("gen_${file}_abc") {
59    test_ts = "${test_ts_path}${file}.ts"
60    test_abc = "$target_out_dir/${file}.abc"
61
62    src_js = rebase_path(test_ts)
63    dst_file = rebase_path(test_abc)
64
65    extra_args = [ "--source-file=${file}" ]
66
67    in_puts = [ test_ts ]
68    out_puts = [ test_abc ]
69  }
70}
71
72host_unittest_action("VerifierTest") {
73  module_out_path = module_output_path
74
75  sources = [
76    "utils.cpp",
77    "verify_checksum_test.cpp",
78    "verify_constant_pool_tests.cpp",
79    "verify_register_index_test.cpp",
80  ]
81
82  include_dirs = [ "$ark_root/verifier" ]
83
84  configs = verifier_test_configs
85  external_deps = [ sdk_libc_secshared_dep ]
86  deps = verifier_test_deps
87  test_abc_dir = rebase_path(target_out_dir)
88  defines = [ "GRAPH_TEST_ABC_DIR=\"${test_abc_dir}/\"" ]
89  foreach(file, verifier_test_js_files) {
90    deps += [ ":gen_${file}_abc" ]
91  }
92  foreach(file, verifier_test_ts_files) {
93    deps += [ ":gen_${file}_abc" ]
94  }
95}
96
97group("host_unittest") {
98  testonly = true
99  deps = [ ":VerifierTestAction" ]
100}
101