# Copyright (c) 2021 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/toolchain/test/test_helper.gni") import("../../toolchain.gni") module_output_path = "arkcompiler/toolchain" config("debug_api_test") { visibility = [ ":*" ] ldflags = [ "-Wl,-rpath=\$ORIGIN/" ] configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] include_dirs = [ "//arkcompiler/ets_runtime", "//arkcompiler/toolchain/tooling", ] } test_js_path = "//arkcompiler/toolchain/tooling/test/testcases/js/" # When new js test file added, pls modify ohos_test.xml in test/resource accordingly. test_js_files = [ "arrow_func", "async_func", "exception", "range_error", "sample", "step", "syntax_exception", "throw_exception", "variable_first", "variable_second", "export_variable_first", "export_variable_second", "module_variable", "dropframe", "local_variable_scope", "container", ] foreach(file, test_js_files) { es2abc_gen_abc("gen_${file}_abc") { test_js = "${test_js_path}${file}.js" test_abc = "$target_out_dir/${file}.abc" # Only targets in this file can depend on this. extra_visibility = [ ":*" ] src_js = rebase_path(test_js) dst_file = rebase_path(test_abc) extra_args = [ "--debug" ] if (file == "module_variable" || file == "export_variable_first" || file == "export_variable_second") { extra_args += [ "--module" ] extra_args += [ "--merge-abc" ] } in_puts = [ test_js ] out_puts = [ test_abc ] } } ohos_shared_library("debugger_entry") { stack_protector_ret = false sources = [ "entry/test_debugger_entry.cpp" ] configs = [ ":debug_api_test" ] deps = [ ":jsdebugtest" ] foreach(file, test_js_files) { deps += [ ":gen_${file}_abc" ] } install_enable = false output_extension = "so" subsystem_name = "test" } ohos_shared_library("jsdebugtest") { stack_protector_ret = false sources = [ "utils/test_entry.cpp", "utils/test_extractor.cpp", "utils/test_list.cpp", "utils/test_util.cpp", ] configs = [ ":debug_api_test", "//arkcompiler/toolchain/tooling:ark_ecma_debugger_config", ] test_abc_dir = "/data/test/" target_label = get_label_info(":${target_name}", "label_with_toolchain") target_toolchain = get_label_info(target_label, "toolchain") if (target_toolchain == host_toolchain || ark_standalone_build) { test_abc_dir = rebase_path(target_out_dir) } test_js_dir = rebase_path(test_js_path) defines = [ "DEBUGGER_ABC_DIR=\"${test_abc_dir}/\"", "DEBUGGER_JS_DIR=\"${test_js_dir}\"", ] deps = [ "//arkcompiler/ets_runtime:libark_jsruntime_test", "//arkcompiler/toolchain/tooling:libark_ecma_debugger_test", ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps deps += hiviewdfx_deps install_enable = false output_extension = "so" subsystem_name = "test" } host_unittest_action("DebuggerEntryTest") { module_out_path = module_output_path sources = [ # test file "debugger_entry_test.cpp", ] cflags_cc = [ "-Wno-gnu-zero-variadic-macro-arguments" ] defines = [ "DEBUGGER_TEST_LIBRARY=\"libdebugger_entry.so\"" ] configs = [ ":debug_api_test" ] deps = [ ":debugger_entry_resource", ":jsdebugtest", "$ark_third_party_root/icu/icu4c:shared_icui18n", "$ark_third_party_root/icu/icu4c:shared_icuuc", "$toolchain_root/tooling:libark_ecma_debugger_test", ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps deps += hiviewdfx_deps external_deps += [ "ets_runtime:libark_jsruntime_test" ] } host_unittest_action("DebuggerTest") { module_out_path = module_output_path sources = [ # test file "debugger_commands_test.cpp", "debugger_events_test.cpp", "debugger_impl_test.cpp", "debugger_params_test.cpp", "debugger_returns_test.cpp", "debugger_script_test.cpp", "debugger_service_test.cpp", "debugger_types_test.cpp", "dispatcher_test.cpp", "heapprofiler_impl_test.cpp", "js_pt_hooks_test.cpp", "profiler_impl_test.cpp", "protocol_handler_test.cpp", "pt_base64_test.cpp", "pt_json_test.cpp", "pt_params_test.cpp", "pt_returns_test.cpp", "pt_types_test.cpp", "runtime_impl_test.cpp", "tracing_impl_test.cpp", ] configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] deps = [ "$ark_third_party_root/cJSON:cjson", "$ark_third_party_root/icu/icu4c:shared_icui18n", "$ark_third_party_root/icu/icu4c:shared_icuuc", "$toolchain_root/tooling:libark_ecma_debugger_test", sdk_libc_secshared_dep, ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps deps += hiviewdfx_deps external_deps += [ "ets_runtime:libark_jsruntime_test" ] } host_unittest_action("DebuggerCInterpTest") { module_out_path = module_output_path sources = [ # test file "debugger_cinterp_test.cpp", ] cflags_cc = [ "-Wno-gnu-zero-variadic-macro-arguments" ] defines = [ "DEBUGGER_TEST_LIBRARY=\"libdebugger_entry.so\"" ] configs = [ ":debug_api_test" ] deps = [ ":debugger_entry_resource", ":jsdebugtest", "$ark_third_party_root/icu/icu4c:shared_icui18n", "$ark_third_party_root/icu/icu4c:shared_icuuc", "$toolchain_root/tooling:libark_ecma_debugger_test", ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps deps += hiviewdfx_deps external_deps += [ "ets_runtime:libark_jsruntime_test" ] } group("debugger_entry_resource") { testonly = true deps = [ ":debugger_entry" ] } group("unittest") { testonly = true # deps file deps = [ ":DebuggerCInterpTest", ":DebuggerEntryTest", ":DebuggerTest", ] } group("host_unittest") { testonly = true # deps file deps = [ ":DebuggerCInterpTestAction", ":DebuggerEntryTestAction", ":DebuggerTestAction", ] }