1# Copyright (c) 2021 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("//foundation/arkui/napi/napi.gni") 15 16import("//build/test.gni") 17import("//foundation/arkui/ace_engine/ace_config.gni") 18import("//foundation/arkui/napi/test/unittest/ut.gni") 19 20if (is_standard_system) { 21 module_output_path = "ace_engine/napi" 22} else { 23 module_output_path = "ace_engine_full/napi" 24} 25 26ark_support = false 27 28foreach(item, ace_platforms) { 29 if (item.name == "ohos") { 30 engine_config = item.config 31 support_engines = engine_config.js_engines 32 foreach(engine, support_engines) { 33 if (engine.engine_name == "ark") { 34 ark_support = true 35 } 36 } 37 } 38} 39 40if (ark_support) { 41 ohos_unittest("test_ark_unittest") { 42 module_out_path = module_output_path 43 44 include_dirs = ark_include 45 46 cflags = [ "-g3" ] 47 48 sources = [ 49 "engine/test_ark.cpp", 50 "test_napi.cpp", 51 ] 52 sources += napi_sources 53 54 defines = [ "NAPI_TEST" ] 55 56 deps = ark_deps 57 58 external_deps = [ 59 "bounds_checking_function:libsec_shared", 60 "c_utils:utils", 61 ] 62 63 external_deps += [ "hilog:libhilog" ] 64 external_deps += [ "ets_runtime:libark_jsruntime" ] 65 } 66 67 ohos_unittest("test_ark_unittest_threadsafe") { 68 module_out_path = module_output_path 69 70 include_dirs = ark_include 71 72 cflags = [ "-g3" ] 73 74 sources = [ 75 "engine/test_ark.cpp", 76 "test_napi_threadsafe.cpp", 77 ] 78 sources += napi_sources 79 80 defines = [ "NAPI_TEST" ] 81 82 deps = ark_deps 83 external_deps = [ "bounds_checking_function:libsec_shared" ] 84 85 external_deps += [ "hilog:libhilog" ] 86 external_deps += [ "ets_runtime:libark_jsruntime" ] 87 } 88} 89 90group("unittest") { 91 testonly = true 92 deps = [] 93 if (ark_support) { 94 deps += [ 95 ":test_ark_unittest", 96 ":test_ark_unittest_threadsafe", 97 ] 98 } 99} 100 101#jerry tdd test for phone running 102group("jerry_tdd_test_run") { 103 testonly = true 104 deps = [ "//third_party/jerryscript/tests/unit-core:jerry_tdd_test" ] 105} 106 107#jerry es2015 test for phone running 108group("jerry_jstest_es2015") { 109 testonly = true 110 deps = [ "//third_party/jerryscript/tests/jerry:jerry_js_test_es2015" ] 111} 112 113#jerry es2015 test for host running 114group("jerry_host_jstest_es2015") { 115 testonly = true 116 deps = [ 117 "//third_party/jerryscript/tests/jerry:jerry_host_js_test_es2015", 118 "//third_party/jerryscript/tests/unit-core:jerry_tdd_host_test", 119 ] 120} 121 122#jerry es5.1 test for phone running 123group("jerry_jstest_es5.1") { 124 testonly = true 125 deps = [ "//third_party/jerryscript/tests/jerry:jerry_js_test_es5.1" ] 126} 127 128#jerry es5.1 test for host running 129group("jerry_host_jstest_es5.1") { 130 testonly = true 131 deps = [ 132 "//third_party/jerryscript/tests/jerry:jerry_host_js_test_es5.1", 133 "//third_party/jerryscript/tests/unit-core:jerry_tdd_host_test", 134 ] 135} 136 137#jerry tdd test for host running 138group("jerry_tdd_host_test_run") { 139 testonly = true 140 deps = [ "//third_party/jerryscript/tests/unit-core:jerry_tdd_host_test" ] 141} 142