# 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("//build/ohos.gni") import("//build/ohos_var.gni") import("//build/test.gni") import("//foundation/resourceschedule/ffrt/ffrt_io_task_scheuduler.gni") module_output_path = "ffrttest/" gtest_public_deps = [ "//third_party/googletest:gtest_main" ] ffrt_ut_base_deps = [ "../..:libffrt", "//third_party/googletest:gtest", "//third_party/jsoncpp:jsoncpp", ] ffrt_ut_base_external_deps = [ "c_utils:utils", "faultloggerd:libbacktrace_local", "faultloggerd:libdfx_dumpcatcher", ] config("ffrt_test_config") { include_dirs = [ "../../src", "../../src/dfx/log", "../../src/dfx/trace", "../../src/sched", ] cflags = [ "-fno-rtti", "-Wno-unused-variable", "-Wno-unused-function", ] defines = [ "QOS_INTERVAL", "QOS_DISPATCH", "QOS_RTG", "QOS_MULTI_RTG", "QOS_RTG_RT", "QOS_CHECKPOINT", "QOS_SUBMIT", "QOS_DEMO", "ATRACE_MODE=0", # 0 is off, 5 is bytrace, 6 is pmu "ATRACE_LEVEL=0", "ATRACE_LOGI_ENABLE=0", "ATRACE_LOGD_ENABLE=0", "ATRACE_SCOPE_LOG_ENABLE=0", "ATRACE_DURATION_LOG_ENABLE=0", "FFRT_RELEASE", "DISABLE_MONITOR", ] if (use_musl) { defines += [ "TDD_MUSL" ] } } ohos_unittest("frame_interval_test") { module_out_path = module_output_path configs = [ ":ffrt_test_config" ] cflags_cc = [ "-frtti", "-Xclang", "-fcxx-exceptions", "-std=c++11", "-DFFRT_PERF_EVENT_ENABLE", ] sources = [ "frame_interval_test.cpp" ] deps = ffrt_ut_base_deps external_deps = ffrt_ut_base_external_deps if (is_standard_system) { public_deps = gtest_public_deps } install_enable = true part_name = "ffrt" } ohos_unittest("deadline_test") { module_out_path = module_output_path configs = [ ":ffrt_test_config" ] cflags_cc = [ "-frtti", "-Xclang", "-fcxx-exceptions", "-std=c++11", "-DFFRT_PERF_EVENT_ENABLE", ] sources = [ "deadline_test.cpp" ] deps = ffrt_ut_base_deps external_deps = ffrt_ut_base_external_deps if (is_standard_system) { public_deps = gtest_public_deps } install_enable = true part_name = "ffrt" } ohos_unittest("task_ctx_test") { module_out_path = module_output_path configs = [ ":ffrt_test_config" ] cflags_cc = [ "-frtti", "-Xclang", "-fcxx-exceptions", "-std=c++11", "-DFFRT_PERF_EVENT_ENABLE", ] sources = [ "task_ctx_test.cpp" ] deps = ffrt_ut_base_deps external_deps = ffrt_ut_base_external_deps if (is_standard_system) { public_deps = gtest_public_deps } install_enable = true part_name = "ffrt" } ohos_unittest("cpu_monitor_test") { module_out_path = module_output_path configs = [ ":ffrt_test_config" ] cflags_cc = [ "-frtti", "-Xclang", "-fcxx-exceptions", "-std=c++11", "-DFFRT_PERF_EVENT_ENABLE", ] sources = [ "cpu_monitor_test.cpp" ] deps = ffrt_ut_base_deps external_deps = ffrt_ut_base_external_deps if (is_standard_system) { public_deps = gtest_public_deps } install_enable = true part_name = "ffrt" } ohos_unittest("cpuworker_manager_test") { module_out_path = module_output_path configs = [ ":ffrt_test_config" ] cflags_cc = [ "-frtti", "-Xclang", "-fcxx-exceptions", "-std=c++11", "-DFFRT_PERF_EVENT_ENABLE", ] sources = [ "cpuworker_manager_test.cpp" ] deps = ffrt_ut_base_deps external_deps = ffrt_ut_base_external_deps if (is_standard_system) { public_deps = gtest_public_deps } install_enable = true part_name = "ffrt" } ohos_unittest("execute_unit_test") { module_out_path = module_output_path configs = [ ":ffrt_test_config" ] cflags_cc = [ "-frtti", "-Xclang", "-fcxx-exceptions", "-std=c++11", "-DFFRT_PERF_EVENT_ENABLE", ] sources = [ "execute_unit_test.cpp" ] deps = ffrt_ut_base_deps external_deps = ffrt_ut_base_external_deps if (is_standard_system) { public_deps = gtest_public_deps } install_enable = true part_name = "ffrt" } ohos_unittest("worker_thread_test") { module_out_path = module_output_path configs = [ ":ffrt_test_config" ] cflags_cc = [ "-frtti", "-Xclang", "-fcxx-exceptions", "-std=c++11", "-DFFRT_PERF_EVENT_ENABLE", ] sources = [ "worker_thread_test.cpp" ] deps = ffrt_ut_base_deps external_deps = ffrt_ut_base_external_deps if (is_standard_system) { public_deps = gtest_public_deps } install_enable = true part_name = "ffrt" } ohos_unittest("qos_convert_test") { module_out_path = module_output_path configs = [ ":ffrt_test_config" ] cflags_cc = [ "-frtti", "-Xclang", "-fcxx-exceptions", "-std=c++11", "-DFFRT_PERF_EVENT_ENABLE", ] sources = [ "qos_convert_test.cpp" ] deps = ffrt_ut_base_deps external_deps = ffrt_ut_base_external_deps if (is_standard_system) { public_deps = gtest_public_deps } install_enable = true part_name = "ffrt" } ohos_unittest("ut_coroutine_test") { module_out_path = module_output_path configs = [ ":ffrt_test_config" ] cflags_cc = [ "-frtti", "-Xclang", "-fcxx-exceptions", "-std=c++11", "-DFFRT_PERF_EVENT_ENABLE", ] sources = [ "ut_coroutine_test.cpp" ] deps = ffrt_ut_base_deps external_deps = ffrt_ut_base_external_deps if (is_standard_system) { public_deps = gtest_public_deps } install_enable = true part_name = "ffrt" } group("ffrt_unittest_ffrt") { testonly = true deps = [] if (!is_asan) { deps += [ ":cpu_monitor_test", ":cpuworker_manager_test", ":deadline_test", ":execute_unit_test", ":frame_interval_test", ":qos_convert_test", ":task_ctx_test", ":worker_thread_test", ] } }