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