# 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/ets_runtime/js_runtime_config.gni") import("//arkcompiler/toolchain/test/test_helper.gni") import("//build/ohos.gni") import("//build/test.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", ] 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" ] in_puts = [ test_js ] out_puts = [ test_abc ] } } source_set("debugger_entry_set") { sources = [ "entry/test_debugger_entry.cpp" ] public_configs = [ ":debug_api_test" ] deps = [ ":jsdebugtest" ] foreach(file, test_js_files) { deps += [ ":gen_${file}_abc" ] } } ohos_shared_library("debugger_entry") { deps = [ ":debugger_entry_set" ] install_enable = false output_extension = "so" subsystem_name = "test" } source_set("jsdebugtest_set") { sources = [ "utils/test_entry.cpp", "utils/test_extractor.cpp", "utils/test_list.cpp", "utils/test_util.cpp", ] public_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) { test_abc_dir = rebase_path(target_out_dir) } defines = [ "DEBUGGER_ABC_DIR=\"${test_abc_dir}/\"" ] if (is_ohos && is_standard_system) { if (enable_hilog) { defines += [ "ENABLE_HILOG" ] include_dirs = [ "//base/hiviewdfx/hilog/interfaces/native/innerkits/include" ] } } deps = [ "$ark_root/libpandafile:arkfile_header_deps" ] } ohos_shared_library("jsdebugtest") { deps = [ ":jsdebugtest_set" ] deps += [ "//arkcompiler/ets_runtime:libark_jsruntime_test", "//arkcompiler/toolchain/tooling:libark_ecma_debugger_test", ] if (is_ohos && is_standard_system) { if (enable_hilog) { external_deps = [ "hiviewdfx_hilog_native:libhilog" ] } } 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", "//arkcompiler/ets_runtime:libark_jsruntime_test", "//arkcompiler/toolchain/tooling:libark_ecma_debugger_test", ] } host_unittest_action("DebuggerTest") { module_out_path = module_output_path sources = [ # test file "debugger_commands_test.cpp", "debugger_events_test.cpp", "debugger_params_test.cpp", "debugger_returns_test.cpp", "debugger_script_test.cpp", "debugger_types_test.cpp", "heapprofiler_impl_test.cpp", "js_pt_hooks_test.cpp", "profiler_impl_test.cpp", "pt_base64_test.cpp", "pt_json_test.cpp", "runtime_impl_test.cpp", "tracing_impl_test.cpp", ] configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] deps = [ "//arkcompiler/ets_runtime:libark_jsruntime_test", "//arkcompiler/toolchain/tooling:libark_ecma_debugger_test", "//third_party/cJSON:cjson", sdk_libc_secshared_dep, ] } group("debugger_entry_resource") { testonly = true deps = [ ":debugger_entry" ] } group("unittest") { testonly = true # deps file deps = [ ":DebuggerEntryTest", ":DebuggerTest", ] } group("host_unittest") { testonly = true # deps file deps = [ ":DebuggerEntryTestAction", ":DebuggerTestAction", ] }