1b1994897Sopenharmony_ci# Copyright (c) 2023 Huawei Device Co., Ltd.
2b1994897Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
3b1994897Sopenharmony_ci# you may not use this file except in compliance with the License.
4b1994897Sopenharmony_ci# You may obtain a copy of the License at
5b1994897Sopenharmony_ci#
6b1994897Sopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0
7b1994897Sopenharmony_ci#
8b1994897Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
9b1994897Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
10b1994897Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11b1994897Sopenharmony_ci# See the License for the specific language governing permissions and
12b1994897Sopenharmony_ci# limitations under the License.
13b1994897Sopenharmony_ci
14b1994897Sopenharmony_ciimport("//arkcompiler/ets_frontend/es2panda/es2abc_config.gni")
15b1994897Sopenharmony_ciimport("//arkcompiler/runtime_core/ark_config.gni")
16b1994897Sopenharmony_ciimport("$ark_root/tests/test_helper.gni")
17b1994897Sopenharmony_ci
18b1994897Sopenharmony_civerifier_test_configs = [
19b1994897Sopenharmony_ci  "$ark_root:ark_config",
20b1994897Sopenharmony_ci  "$ark_root/libpandabase:arkbase_public_config",
21b1994897Sopenharmony_ci  "$ark_root/libpandafile:arkfile_public_config",
22b1994897Sopenharmony_ci  sdk_libc_secshared_config,
23b1994897Sopenharmony_ci]
24b1994897Sopenharmony_ci
25b1994897Sopenharmony_civerifier_test_deps = [
26b1994897Sopenharmony_ci  "$ark_root/libpandabase:libarkbase_static",
27b1994897Sopenharmony_ci  "$ark_root/libpandafile:libarkfile_static",
28b1994897Sopenharmony_ci  "$ark_root/verifier:libarkverifier",
29b1994897Sopenharmony_ci]
30b1994897Sopenharmony_ci
31b1994897Sopenharmony_civerifier_test_js_files = [
32b1994897Sopenharmony_ci  "test_checksum",
33b1994897Sopenharmony_ci  "test_constant_pool",
34b1994897Sopenharmony_ci  "test_register_index",
35b1994897Sopenharmony_ci  "test_constant_pool_content",
36b1994897Sopenharmony_ci]
37b1994897Sopenharmony_ci
38b1994897Sopenharmony_civerifier_test_ts_files = [ "test_literal_array" ]
39b1994897Sopenharmony_ci
40b1994897Sopenharmony_citest_js_path = "//arkcompiler/runtime_core/verifier/tests/js/"
41b1994897Sopenharmony_citest_ts_path = "//arkcompiler/runtime_core/verifier/tests/ts/"
42b1994897Sopenharmony_ci
43b1994897Sopenharmony_ciforeach(file, verifier_test_js_files) {
44b1994897Sopenharmony_ci  es2abc_gen_abc("gen_${file}_abc") {
45b1994897Sopenharmony_ci    test_js = "${test_js_path}${file}.js"
46b1994897Sopenharmony_ci    test_abc = "$target_out_dir/${file}.abc"
47b1994897Sopenharmony_ci
48b1994897Sopenharmony_ci    src_js = rebase_path(test_js)
49b1994897Sopenharmony_ci    dst_file = rebase_path(test_abc)
50b1994897Sopenharmony_ci
51b1994897Sopenharmony_ci    in_puts = [ test_js ]
52b1994897Sopenharmony_ci    out_puts = [ test_abc ]
53b1994897Sopenharmony_ci  }
54b1994897Sopenharmony_ci}
55b1994897Sopenharmony_ci
56b1994897Sopenharmony_ciforeach(file, verifier_test_ts_files) {
57b1994897Sopenharmony_ci  es2abc_gen_abc("gen_${file}_abc") {
58b1994897Sopenharmony_ci    test_ts = "${test_ts_path}${file}.ts"
59b1994897Sopenharmony_ci    test_abc = "$target_out_dir/${file}.abc"
60b1994897Sopenharmony_ci
61b1994897Sopenharmony_ci    src_js = rebase_path(test_ts)
62b1994897Sopenharmony_ci    dst_file = rebase_path(test_abc)
63b1994897Sopenharmony_ci
64b1994897Sopenharmony_ci    in_puts = [ test_ts ]
65b1994897Sopenharmony_ci    out_puts = [ test_abc ]
66b1994897Sopenharmony_ci  }
67b1994897Sopenharmony_ci}
68b1994897Sopenharmony_ci
69b1994897Sopenharmony_cihost_unittest_action("VerifierTest") {
70b1994897Sopenharmony_ci  module_out_path = module_output_path
71b1994897Sopenharmony_ci
72b1994897Sopenharmony_ci  sources = [
73b1994897Sopenharmony_ci    "utils.cpp",
74b1994897Sopenharmony_ci    "verify_checksum_test.cpp",
75b1994897Sopenharmony_ci    "verify_constant_pool_tests.cpp",
76b1994897Sopenharmony_ci    "verify_register_index_test.cpp",
77b1994897Sopenharmony_ci  ]
78b1994897Sopenharmony_ci
79b1994897Sopenharmony_ci  include_dirs = [ "$ark_root/verifier" ]
80b1994897Sopenharmony_ci
81b1994897Sopenharmony_ci  configs = verifier_test_configs
82b1994897Sopenharmony_ci
83b1994897Sopenharmony_ci  deps = verifier_test_deps
84b1994897Sopenharmony_ci  test_abc_dir = rebase_path(target_out_dir)
85b1994897Sopenharmony_ci  defines = [ "GRAPH_TEST_ABC_DIR=\"${test_abc_dir}/\"" ]
86b1994897Sopenharmony_ci  foreach(file, verifier_test_js_files) {
87b1994897Sopenharmony_ci    deps += [ ":gen_${file}_abc" ]
88b1994897Sopenharmony_ci  }
89b1994897Sopenharmony_ci  foreach(file, verifier_test_ts_files) {
90b1994897Sopenharmony_ci    deps += [ ":gen_${file}_abc" ]
91b1994897Sopenharmony_ci  }
92b1994897Sopenharmony_ci}
93b1994897Sopenharmony_ci
94b1994897Sopenharmony_cigroup("host_unittest") {
95b1994897Sopenharmony_ci  testonly = true
96b1994897Sopenharmony_ci  deps = [ ":VerifierTestAction" ]
97b1994897Sopenharmony_ci}
98