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 extra_args = [ "--source-file=${file}" ] 52 53 in_puts = [ test_js ] 54 out_puts = [ test_abc ] 55 } 56} 57 58foreach(file, verifier_test_ts_files) { 59 es2abc_gen_abc("gen_${file}_abc") { 60 test_ts = "${test_ts_path}${file}.ts" 61 test_abc = "$target_out_dir/${file}.abc" 62 63 src_js = rebase_path(test_ts) 64 dst_file = rebase_path(test_abc) 65 66 extra_args = [ "--source-file=${file}" ] 67 68 in_puts = [ test_ts ] 69 out_puts = [ test_abc ] 70 } 71} 72 73host_unittest_action("VerifierTest") { 74 module_out_path = module_output_path 75 76 sources = [ 77 "utils.cpp", 78 "verify_checksum_test.cpp", 79 "verify_constant_pool_tests.cpp", 80 "verify_register_index_test.cpp", 81 ] 82 83 include_dirs = [ "$ark_root/verifier" ] 84 85 configs = verifier_test_configs 86 87 deps = verifier_test_deps 88 test_abc_dir = rebase_path(target_out_dir) 89 defines = [ "GRAPH_TEST_ABC_DIR=\"${test_abc_dir}/\"" ] 90 foreach(file, verifier_test_js_files) { 91 deps += [ ":gen_${file}_abc" ] 92 } 93 foreach(file, verifier_test_ts_files) { 94 deps += [ ":gen_${file}_abc" ] 95 } 96} 97 98group("host_unittest") { 99 testonly = true 100 deps = [ ":VerifierTestAction" ] 101} 102