# 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("//ark/js_runtime/js_runtime_config.gni") import("//ark/js_runtime/test/test_helper.gni") import("//ark/ts2abc/ts2panda/ts2abc_config.gni") import("//build/ohos.gni") import("//build/test.gni") module_output_path = "ark/js_runtime" config("debug_api_test") { visibility = [ ":*" ] ldflags = [ "-Wl,-rpath=\$ORIGIN/" ] configs = [ "//ark/js_runtime:ark_jsruntime_public_config", # should add before # arkruntime_public_config "//ark/js_runtime:ark_jsruntime_common_config", "//ark/js_runtime:ecma_test_config", "$ark_root/runtime:arkruntime_public_config", ] include_dirs = [ "//ark/js_runtime", "//ark/runtime_core", "//ark/runtime_core/libpandabase", "//ark/js_runtime/ecmascript/tooling/test", ] } ts2abc_gen_abc("ark_sample_abc") { test_js_path = "//ark/js_runtime/ecmascript/tooling/test/js/Sample.js" test_abc_path = "$target_out_dir/Sample.abc" extra_visibility = [ ":*" ] # Only targets in this file can depend on this. src_js = rebase_path(test_js_path) dst_file = rebase_path(test_abc_path) extra_args = [ "--debug" ] in_puts = [ test_js_path ] out_puts = [ test_abc_path ] } ts2abc_gen_abc("ark_asyncfunc_abc") { test_js_path = "//ark/js_runtime/ecmascript/tooling/test/js/AsyncFunc.js" test_abc_path = "$target_out_dir/AsyncFunc.abc" extra_visibility = [ ":*" ] # Only targets in this file can depend on this. src_js = rebase_path(test_js_path) dst_file = rebase_path(test_abc_path) extra_args = [ "--debug" ] in_puts = [ test_js_path ] out_puts = [ test_abc_path ] } ts2abc_gen_abc("ark_arrowfunc_abc") { test_js_path = "//ark/js_runtime/ecmascript/tooling/test/js/ArrowFunc.js" test_abc_path = "$target_out_dir/ArrowFunc.abc" extra_visibility = [ ":*" ] # Only targets in this file can depend on this. src_js = rebase_path(test_js_path) dst_file = rebase_path(test_abc_path) extra_args = [ "--debug" ] in_puts = [ test_js_path ] out_puts = [ test_abc_path ] } ts2abc_gen_abc("ark_exception_abc") { test_js_path = "//ark/js_runtime/ecmascript/tooling/test/js/exception.js" test_abc_path = "$target_out_dir/exception.abc" extra_visibility = [ ":*" ] # Only targets in this file can depend on this. src_js = rebase_path(test_js_path) dst_file = rebase_path(test_abc_path) extra_args = [ "--debug" ] in_puts = [ test_js_path ] out_puts = [ test_abc_path ] } source_set("debugger_entry_set") { sources = [ "entry/test_debugger_entry.cpp" ] public_configs = [ ":debug_api_test" ] deps = [ ":ark_arrowfunc_abc", ":ark_asyncfunc_abc", ":ark_exception_abc", ":ark_sample_abc", ":jsdebugtest", "$ark_root/libpandabase:libarkbase", "$ark_root/libpandafile:libarkfile", ] } 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_util.cpp", "utils/testcases/test_list.cpp", ] public_configs = [ ":debug_api_test" ] 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}/\"" ] deps = [ "$ark_root/libpandabase:libarkbase", "$ark_root/libpandafile:libarkfile", "//ark/js_runtime:libark_jsruntime_test_set", "//ark/js_runtime/ecmascript/tooling:libark_ecma_debugger_test_set", ] } ohos_shared_library("jsdebugtest") { deps = [ ":jsdebugtest_set" ] if (is_ohos && is_standard_system) { if (build_public_version) { external_deps = [ "bytrace_standard:bytrace_core", "hitrace_native:libhitrace", ] } } if (is_standard_system) { deps += [ "$ark_root/runtime:libarkruntime_static" ] } else { deps += [ "$ark_root/runtime:libarkruntime" ] } 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_root/libpandabase:libarkbase", "$ark_root/libpandafile:libarkfile", ] } 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", "js_pt_hooks_test.cpp", "pt_json_test.cpp", ] configs = [ "//ark/js_runtime:ecma_test_config" ] deps = [ "$ark_root/libpandabase:libarkbase", "//ark/js_runtime/ecmascript/tooling:libark_ecma_debugger_test", 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", ] }