# 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/runtime_core/ark_config.gni")
import("//build/config/components/ets_frontend/es2abc_config.gni")
import("$ark_root/tests/test_helper.gni")
#module_out_path = "$ark_root/assembler"
config("module_private_config") {
visibility = [ ":*" ]
include_dirs = [
"$ark_root/assembler",
"$target_gen_dir",
"$target_gen_dir/include",
"$root_gen_dir/libpandabase",
"$ark_root",
"$ark_root/plugins/ecmascript/assembler",
]
defines = [ "PANDA_WITH_ECMASCRIPT" ]
}
assembler_test_js_files = [ "test_class_access_flags" ]
test_js_path = "//arkcompiler/runtime_core/assembler/tests/js/"
foreach(file, assembler_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 = [ "--merge-abc" ]
in_puts = [ test_js ]
out_puts = [ test_abc ]
}
}
host_unittest_action("AssemblerTest") {
module_out_path = module_output_path
sources = [
"annotation_test.cpp",
"assembler_access_flag_test.cpp",
"assembler_emitter_test.cpp",
"assembler_ins_test.cpp",
"assembler_lexer_test.cpp",
"assembler_mangling_test.cpp",
"assembler_parser_test.cpp",
"ecmascript_meta_test.cpp",
]
configs = [
":module_private_config",
"$ark_root:ark_config",
"$ark_root/assembler:arkassembler_public_config",
"$ark_root/libpandabase:arkbase_public_config",
"$ark_root/libpandafile:arkfile_public_config",
"$ark_root/compiler:arkcompiler_public_config",
"$ark_root/bytecode_optimizer:bytecodeopt_public_config",
]
deps = [
"$ark_root/assembler:libarkassembler",
"$ark_root/bytecode_optimizer:libarkbytecodeopt",
"$ark_root/compiler:libarkcompiler",
"$ark_root/libpandabase:libarkbase",
"$ark_root/libpandafile:libarkfile",
"$ark_root/libziparchive:libarkziparchive",
]
external_deps = [ sdk_libc_secshared_dep ]
if (ark_standalone_build) {
deps += [ "$build_root/third_party_gn/googletest:gtest_main" ]
} else {
external_deps += [ "googletest:gtest_main" ]
}
if (enable_hilog) {
external_deps += [ "hilog:libhilog" ]
}
test_abc_dir = rebase_path(target_out_dir)
defines = [ "GRAPH_TEST_ABC_DIR=\"${test_abc_dir}/\"" ]
foreach(file, assembler_test_js_files) {
deps += [ ":gen_${file}_abc" ]
}
}
group("host_unittest") {
testonly = true
deps = [ ":AssemblerTestAction" ]
}