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_ci#module_out_path = "$ark_root/assembler" 19b1994897Sopenharmony_ci 20b1994897Sopenharmony_ciconfig("module_private_config") { 21b1994897Sopenharmony_ci visibility = [ ":*" ] 22b1994897Sopenharmony_ci include_dirs = [ 23b1994897Sopenharmony_ci "$ark_root/assembler", 24b1994897Sopenharmony_ci "$target_gen_dir", 25b1994897Sopenharmony_ci "$target_gen_dir/include", 26b1994897Sopenharmony_ci "$root_gen_dir/libpandabase", 27b1994897Sopenharmony_ci "$ark_root", 28b1994897Sopenharmony_ci "$ark_root/plugins/ecmascript/assembler", 29b1994897Sopenharmony_ci ] 30b1994897Sopenharmony_ci 31b1994897Sopenharmony_ci defines = [ "PANDA_WITH_ECMASCRIPT" ] 32b1994897Sopenharmony_ci} 33b1994897Sopenharmony_ci 34b1994897Sopenharmony_ciassembler_test_js_files = [ "test_class_access_flags" ] 35b1994897Sopenharmony_ci 36b1994897Sopenharmony_citest_js_path = "//arkcompiler/runtime_core/assembler/tests/js/" 37b1994897Sopenharmony_ci 38b1994897Sopenharmony_ciforeach(file, assembler_test_js_files) { 39b1994897Sopenharmony_ci es2abc_gen_abc("gen_${file}_abc") { 40b1994897Sopenharmony_ci test_js = "${test_js_path}${file}.js" 41b1994897Sopenharmony_ci test_abc = "$target_out_dir/${file}.abc" 42b1994897Sopenharmony_ci 43b1994897Sopenharmony_ci src_js = rebase_path(test_js) 44b1994897Sopenharmony_ci dst_file = rebase_path(test_abc) 45b1994897Sopenharmony_ci 46b1994897Sopenharmony_ci extra_args = [ "--merge-abc" ] 47b1994897Sopenharmony_ci 48b1994897Sopenharmony_ci in_puts = [ test_js ] 49b1994897Sopenharmony_ci out_puts = [ test_abc ] 50b1994897Sopenharmony_ci } 51b1994897Sopenharmony_ci} 52b1994897Sopenharmony_ci 53b1994897Sopenharmony_cihost_unittest_action("AssemblerTest") { 54b1994897Sopenharmony_ci module_out_path = module_output_path 55b1994897Sopenharmony_ci 56b1994897Sopenharmony_ci sources = [ 57b1994897Sopenharmony_ci "annotation_test.cpp", 58b1994897Sopenharmony_ci "assembler_access_flag_test.cpp", 59b1994897Sopenharmony_ci "assembler_emitter_test.cpp", 60b1994897Sopenharmony_ci "assembler_ins_test.cpp", 61b1994897Sopenharmony_ci "assembler_lexer_test.cpp", 62b1994897Sopenharmony_ci "assembler_mangling_test.cpp", 63b1994897Sopenharmony_ci "assembler_parser_test.cpp", 64b1994897Sopenharmony_ci "ecmascript_meta_test.cpp", 65b1994897Sopenharmony_ci ] 66b1994897Sopenharmony_ci 67b1994897Sopenharmony_ci configs = [ 68b1994897Sopenharmony_ci ":module_private_config", 69b1994897Sopenharmony_ci "$ark_root:ark_config", 70b1994897Sopenharmony_ci "$ark_root/assembler:arkassembler_public_config", 71b1994897Sopenharmony_ci "$ark_root/libpandabase:arkbase_public_config", 72b1994897Sopenharmony_ci "$ark_root/libpandafile:arkfile_public_config", 73b1994897Sopenharmony_ci "$ark_root/compiler:arkcompiler_public_config", 74b1994897Sopenharmony_ci "$ark_root/bytecode_optimizer:bytecodeopt_public_config", 75b1994897Sopenharmony_ci sdk_libc_secshared_config, 76b1994897Sopenharmony_ci ] 77b1994897Sopenharmony_ci 78b1994897Sopenharmony_ci deps = [ 79b1994897Sopenharmony_ci "$ark_root/assembler:libarkassembler", 80b1994897Sopenharmony_ci "$ark_root/bytecode_optimizer:libarkbytecodeopt", 81b1994897Sopenharmony_ci "$ark_root/compiler:libarkcompiler", 82b1994897Sopenharmony_ci "$ark_root/libpandabase:libarkbase", 83b1994897Sopenharmony_ci "$ark_root/libpandafile:libarkfile", 84b1994897Sopenharmony_ci "$ark_root/libziparchive:libarkziparchive", 85b1994897Sopenharmony_ci "//third_party/googletest:gtest_main", 86b1994897Sopenharmony_ci ] 87b1994897Sopenharmony_ci 88b1994897Sopenharmony_ci external_deps = [ sdk_libc_secshared_dep ] 89b1994897Sopenharmony_ci test_abc_dir = rebase_path(target_out_dir) 90b1994897Sopenharmony_ci defines = [ "GRAPH_TEST_ABC_DIR=\"${test_abc_dir}/\"" ] 91b1994897Sopenharmony_ci foreach(file, assembler_test_js_files) { 92b1994897Sopenharmony_ci deps += [ ":gen_${file}_abc" ] 93b1994897Sopenharmony_ci } 94b1994897Sopenharmony_ci} 95b1994897Sopenharmony_ci 96b1994897Sopenharmony_cigroup("host_unittest") { 97b1994897Sopenharmony_ci testonly = true 98b1994897Sopenharmony_ci deps = [ ":AssemblerTestAction" ] 99b1994897Sopenharmony_ci} 100