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 ] 53 include_dirs = [ 54 "${updater_path}/interfaces/kits/include", 55 "${updater_path}/services/common", 56 "${updater_path}/services/include/package", 57 "${updater_path}/services/include/script", 58 "${updater_path}/services/include/log", 59 "${updater_path}/services/include/updater", 60 "${updater_path}/services/package/pkg_algorithm", 61 "${updater_path}/services/package/pkg_manager", 62 "${updater_path}/services/script/script_instruction", 63 "${updater_path}/services/script/script_interpreter", 64 "${updater_path}/services/script/script_manager", 65 "${updater_path}/services/script/threadpool", 66 "$root_out_dir/updater/updater/yacc", 67 "${updater_path}/test/unittest", 68 "${updater_path}/utils/include", 69 "//third_party/bounds_checking_function/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 "//third_party/bounds_checking_function:libsec_static", 79 "//third_party/bzip2:libbz2", 80 "//third_party/googletest:gmock_main", 81 "//third_party/googletest:gtest_main", 82 "//third_party/lz4:liblz4_static", 83 "//third_party/openssl:libcrypto_shared", 84 "//third_party/openssl:libssl_shared", 85 "//third_party/zlib:libz", 86 ] 87 configs = [ "${updater_path}/test/unittest:utest_config" ] 88 external_deps = [ 89 "c_utils:utils", 90 "hilog:libhilog", 91 ] 92 install_enable = true 93 part_name = "updater" 94} 95 96ohos_shared_library("user_instruction") { 97 sources = [ "script_instruction/user_instruction/user_instruction.cpp" ] 98 output_extension = "so" 99 ldflags = [ "-rdynamic" ] 100 include_dirs = [ 101 "${updater_path}/interfaces/kits/include/", 102 "${updater_path}/services/common", 103 "${updater_path}/services/include", 104 "${updater_path}/services/include/package", 105 "${updater_path}/services/include/script", 106 "${updater_path}/services/script/script_instruction", 107 "${updater_path}/utils/include", 108 ] 109 install_enable = true 110 subsystem_name = "updater" 111 part_name = "updater" 112} 113 114ohos_shared_library("user_instruction_invalid") { 115 sources = 116 [ "script_instruction/user_instruction/user_instruction_invalid.cpp" ] 117 output_extension = "so" 118 ldflags = [ "-rdynamic" ] 119 include_dirs = [ 120 "${updater_path}/interfaces/kits/include/", 121 "${updater_path}/services/common", 122 "${updater_path}/services/include", 123 "${updater_path}/services/include/package", 124 "${updater_path}/services/include/script", 125 "${updater_path}/services/script/script_instruction", 126 "${updater_path}/utils/include", 127 ] 128 install_enable = true 129 subsystem_name = "updater" 130 part_name = "updater" 131} 132