# Copyright (c) 2023 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//arkcompiler/ets_frontend/es2panda/es2abc_config.gni") import("//arkcompiler/runtime_core/ark_config.gni") import("$ark_root/tests/test_helper.gni") disasm_test_configs = [ "$ark_root:ark_config", "$ark_root/libpandabase:arkbase_public_config", "$ark_root/libpandafile:arkfile_public_config", sdk_libc_secshared_config, ] disasm_test_deps = [ "$ark_root/disassembler:arkdisassembler", "$ark_root/libpandabase:libarkbase_static", "$ark_root/libpandafile:libarkfile_static", ] disasm_column_test_js_files = [ "column-number1", "column-number2", "column-number3", "column-number4", "column-number5", "column-number6", "line-number1", "line-number2", "line-number3", "line-number4", "line-number5", ] disasm_test_js_files = [ "slot-number-annotation", "script-string1", "script-string2", ] test_js_path = "//arkcompiler/runtime_core/disassembler/tests/js/" foreach(file, disasm_column_test_js_files) { es2abc_gen_abc("gen_${file}_abc") { test_js = "${test_js_path}${file}.js" test_abc = "$target_out_dir/${file}.abc" src_js = rebase_path(test_js) dst_file = rebase_path(test_abc) extra_args = [ "--debug", "--module", ] in_puts = [ test_js ] out_puts = [ test_abc ] } } disasm_module_test_js_files = [ "module-requests-annotation-import", "module-regular-import", "module-namespace-import", "module-local-export", "module-indirect-export", "module-start-export", ] module_test_js_path = "//arkcompiler/runtime_core/disassembler/tests/module/" foreach(file, disasm_module_test_js_files) { es2abc_gen_abc("gen_${file}_abc") { test_js = "${module_test_js_path}${file}.js" test_abc = "$target_out_dir/${file}.abc" src_js = rebase_path(test_js) dst_file = rebase_path(test_abc) extra_args = [ "--module", "--merge-abc", ] in_puts = [ test_js ] out_puts = [ test_abc ] } } foreach(file, disasm_test_js_files) { es2abc_gen_abc("gen_${file}_abc") { test_js = "${test_js_path}${file}.js" test_abc = "$target_out_dir/${file}.abc" src_js = rebase_path(test_js) dst_file = rebase_path(test_abc) in_puts = [ test_js ] out_puts = [ test_abc ] } } disasm_include_dirs = [ "$ark_root/disassembler", "$ark_root/assembler", "$target_gen_dir", "$target_gen_dir/../", "$target_gen_dir/../../assembler", ] script_sources = [ "disassembler_annotations_test.cpp", "disassembler_column_number_test.cpp", "disassembler_line_number_test.cpp", "disassembler_string_test.cpp", ] module_sources = [ "disassembler_annotations_test.cpp", "disassembler_module_literal_test.cpp", ] host_unittest_action("DisasmModuleTest") { module_out_path = module_output_path sources = module_sources include_dirs = disasm_include_dirs configs = disasm_test_configs deps = disasm_test_deps test_abc_dir = rebase_path(target_out_dir) defines = [ "GRAPH_TEST_ABC_DIR=\"${test_abc_dir}/\"" ] foreach(file, disasm_module_test_js_files) { deps += [ ":gen_${file}_abc" ] } } host_unittest_action("DisasmDebugTest") { module_out_path = module_output_path sources = script_sources include_dirs = disasm_include_dirs configs = disasm_test_configs deps = disasm_test_deps test_abc_dir = rebase_path(target_out_dir) defines = [ "GRAPH_TEST_ABC_DIR=\"${test_abc_dir}/\"" ] foreach(file, disasm_column_test_js_files) { deps += [ ":gen_${file}_abc" ] } } host_unittest_action("DisasmScriptTest") { module_out_path = module_output_path sources = script_sources include_dirs = disasm_include_dirs configs = disasm_test_configs deps = disasm_test_deps test_abc_dir = rebase_path(target_out_dir) defines = [ "GRAPH_TEST_ABC_DIR=\"${test_abc_dir}/\"" ] foreach(file, disasm_test_js_files) { deps += [ ":gen_${file}_abc" ] } } group("host_unittest") { testonly = true deps = [ ":DisasmDebugTestAction", ":DisasmModuleTestAction", ":DisasmScriptTestAction", ] }