# Copyright (c) 2021-2022 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("//base/startup/appspawn/appspawn.gni")
import("//build/test.gni")

ohos_executable("AppSpawnTest") {
  sources = [
    "${appspawn_path}/test/moduletest/appspawn_test_cmder.cpp",
    "${appspawn_path}/test/moduletest/appspawn_test_main.cpp",
  ]

  include_dirs = [
    "${appspawn_path}",
    "${appspawn_path}/common",
    "${appspawn_path}/standard",
    "${appspawn_path}/modules/modulemgr",
    "${appspawn_path}/modules/ace_adapter",
    "${appspawn_path}/modules/common",
    "${appspawn_path}/modules/sandbox",
    "${appspawn_path}/test/moduletest/threadpool",
    "${appspawn_innerkits_path}/include",
    "${appspawn_innerkits_path}/client",
    "${appspawn_innerkits_path}/permission",
    "${appspawn_path}/modules/module_engine/include",
    "${appspawn_path}/test/mock",
    "${appspawn_path}/test/unittest",
    "${appspawn_path}/util/include",
  ]

  deps = [
    "${appspawn_innerkits_path}/client:appspawn_client",
    "${appspawn_path}/test/moduletest/threadpool:libappspawn_threadpool",
    "${appspawn_path}/util:libappspawn_util",
  ]

  external_deps = [
    "cJSON:cjson",
    "c_utils:utils",
    "config_policy:configpolicy_util",
    "hilog:libhilog",
    "init:libbegetutil",
    "zlib:libz",
  ]
  subsystem_name = "${subsystem_name}"
  part_name = "${part_name}"
}

ohos_moduletest("AppSpawnModuleTest") {
  module_out_path = "appspawn/appspawn"

  sources = [
    "${appspawn_path}/test/moduletest/appspawn_client_test.cpp",
    #"${appspawn_path}/test/moduletest/appspawn_module_test.cpp",
    "${appspawn_path}/test/moduletest/appspawn_test_cmder.cpp",
  ]

  include_dirs = [
    "${appspawn_path}",
    "${appspawn_path}/common",
    "${appspawn_path}/standard",
    "${appspawn_path}/modules/modulemgr",
    "${appspawn_path}/modules/ace_adapter",
    "${appspawn_path}/modules/common",
    "${appspawn_path}/modules/sandbox",
    "${appspawn_path}/test/moduletest/threadpool",
    "${appspawn_innerkits_path}/include",
    "${appspawn_innerkits_path}/client",
    "${appspawn_innerkits_path}/permission",
    "${appspawn_path}/modules/module_engine/include",
    "${appspawn_path}/test/mock",
    "${appspawn_path}/test/unittest",
    "${appspawn_path}/util/include",
  ]

  deps = [
    "${appspawn_innerkits_path}/client:appspawn_client",
    "${appspawn_path}/util:libappspawn_util",
  ]

  external_deps = [
    "cJSON:cjson",
    "c_utils:utils",
    "config_policy:configpolicy_util",
    "hilog:libhilog",
    "init:libbegetutil",
  ]
  subsystem_name = "${subsystem_name}"
  part_name = "${part_name}"
}

group("moduletest") {
  testonly = true
  deps = [
    ":AppSpawnModuleTest",
    ":AppSpawnTest",
    "plugin-sample:appspawn_plugin_sample",
  ]
  deps += [ "hnp_sample:hnpsample" ]
}