1# Copyright (c) 2022 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("//base/update/updater/updater_default_cfg.gni") 15import("//build/test.gni") 16 17MODULE_OUTPUT_PATH = "updater/updater_test" 18updater_path = rebase_path("${updater_absolutely_path}", ".") 19 20ohos_unittest("script_unittest") { 21 testonly = true 22 resource_config_file = "${updater_path}/test/unittest/test_data/ohos_test.xml" 23 module_out_path = MODULE_OUTPUT_PATH 24 sources = [ 25 "script_instruction/basic_instruction_unittest.cpp", 26 "script_instruction/script_instructionhelper_unittest.cpp", 27 "script_instruction/script_loadscript_unittest.cpp", 28 "script_instruction/script_registercmd_unittest.cpp", 29 "script_instruction/script_updateprocesser_unittest.cpp", 30 "script_interpreter_unittest.cpp", 31 "script_unittest.cpp", 32 "threadpool_unittest.cpp", 33 ] 34 sources += [ 35 "$root_out_dir/updater/updater/yacc/lexer.cpp", 36 "$root_out_dir/updater/updater/yacc/parser.cpp", 37 "${updater_path}/services/script/script_instruction/script_basicinstruction.cpp", 38 "${updater_path}/services/script/script_instruction/script_instructionhelper.cpp", 39 "${updater_path}/services/script/script_instruction/script_loadscript.cpp", 40 "${updater_path}/services/script/script_instruction/script_registercmd.cpp", 41 "${updater_path}/services/script/script_instruction/script_updateprocesser.cpp", 42 "${updater_path}/services/script/script_interpreter/script_context.cpp", 43 "${updater_path}/services/script/script_interpreter/script_expression.cpp", 44 "${updater_path}/services/script/script_interpreter/script_function.cpp", 45 "${updater_path}/services/script/script_interpreter/script_interpreter.cpp", 46 "${updater_path}/services/script/script_interpreter/script_param.cpp", 47 "${updater_path}/services/script/script_interpreter/script_scanner.cpp", 48 "${updater_path}/services/script/script_interpreter/script_statement.cpp", 49 "${updater_path}/services/script/script_manager/script_managerImpl.cpp", 50 "${updater_path}/services/script/script_manager/script_utils.cpp", 51 "${updater_path}/services/script/threadpool/threadpool.cpp", 52 "${updater_path}/utils/utils.cpp", 53 ] 54 include_dirs = [ 55 "${updater_path}/interfaces/kits/include", 56 "${updater_path}/services/common", 57 "${updater_path}/services/include/package", 58 "${updater_path}/services/include/script", 59 "${updater_path}/services/include/log", 60 "${updater_path}/services/include/updater", 61 "${updater_path}/services/package/pkg_algorithm", 62 "${updater_path}/services/package/pkg_manager", 63 "${updater_path}/services/script/script_instruction", 64 "${updater_path}/services/script/script_interpreter", 65 "${updater_path}/services/script/script_manager", 66 "${updater_path}/services/script/threadpool", 67 "$root_out_dir/updater/updater/yacc", 68 "${updater_path}/test/unittest", 69 "${updater_path}/utils/include", 70 ] 71 72 deps = [ 73 "${updater_path}/interfaces/kits/packages:libpackageExt", 74 "${updater_path}/services/log:libupdaterlog", 75 "${updater_path}/services/package:libupdaterpackage", 76 "${updater_path}/services/script:gen_yacc", 77 "${updater_path}/utils:libutils", 78 ] 79 if (updater_cfg_file != "") { 80 deps += [ 81 "${updater_path}/test/unittest/script:user_instruction", 82 "${updater_path}/test/unittest/script:user_instruction_invalid", 83 ] 84 } 85 configs = [ "${updater_path}/test/unittest:utest_config" ] 86 external_deps = [ 87 "bounds_checking_function:libsec_static", 88 "bzip2:libbz2", 89 "c_utils:utils", 90 "googletest:gmock_main", 91 "googletest:gtest_main", 92 "hilog:libhilog", 93 "init:libbegetutil_static", 94 "init:libfsmanager_static_real", 95 "lz4:liblz4_static", 96 "openssl:libcrypto_shared", 97 "openssl:libssl_shared", 98 "zlib:libz", 99 ] 100 install_enable = true 101 part_name = "updater" 102} 103 104ohos_shared_library("user_instruction") { 105 sources = [ "script_instruction/user_instruction/user_instruction.cpp" ] 106 output_extension = "so" 107 ldflags = [ "-rdynamic" ] 108 include_dirs = [ 109 "${updater_path}/interfaces/kits/include/", 110 "${updater_path}/services/common", 111 "${updater_path}/services/include", 112 "${updater_path}/services/include/package", 113 "${updater_path}/services/include/script", 114 "${updater_path}/services/script/script_instruction", 115 "${updater_path}/utils/include", 116 ] 117 install_enable = true 118 subsystem_name = "updater" 119 part_name = "updater" 120} 121 122ohos_shared_library("user_instruction_invalid") { 123 sources = 124 [ "script_instruction/user_instruction/user_instruction_invalid.cpp" ] 125 output_extension = "so" 126 ldflags = [ "-rdynamic" ] 127 include_dirs = [ 128 "${updater_path}/interfaces/kits/include/", 129 "${updater_path}/services/common", 130 "${updater_path}/services/include", 131 "${updater_path}/services/include/package", 132 "${updater_path}/services/include/script", 133 "${updater_path}/services/script/script_instruction", 134 "${updater_path}/utils/include", 135 ] 136 install_enable = true 137 subsystem_name = "updater" 138 part_name = "updater" 139} 140