Skip to content
This repository has been archived by the owner on Aug 20, 2024. It is now read-only.

Commit

Permalink
perf_plugins_handler: Add unit tests for fwk handlers
Browse files Browse the repository at this point in the history
Add initial unit testing for the framework handlers implemented
in perf_plugins_handler: init, bind and bind_request.

Signed-off-by: Nicola Mazzucato <nicola.mazzucato@arm.com>
Change-Id: I7d196196d34cecc9e0e4b85d19ffeee6247e486a
  • Loading branch information
nicola-mazzucato-arm authored and tarek-arm committed May 17, 2023
1 parent 6531df6 commit d1987ab
Show file tree
Hide file tree
Showing 7 changed files with 2,132 additions and 85 deletions.
3 changes: 3 additions & 0 deletions module/scmi_perf/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ set(MODULE_UT_MOCK_SRC ${CMAKE_CURRENT_LIST_DIR}/mocks)
list(APPEND MOCK_REPLACEMENTS fwk_module)
list(APPEND MOCK_REPLACEMENTS fwk_id)
list(APPEND MOCK_REPLACEMENTS fwk_core)
list(APPEND MOCK_REPLACEMENTS fwk_mm)

include(${SCP_ROOT}/unit_test/module_common.cmake)

Expand Down Expand Up @@ -60,6 +61,7 @@ set(MODULE_UT_MOCK_SRC ${CMAKE_CURRENT_LIST_DIR}/mocks)
list(APPEND MOCK_REPLACEMENTS fwk_module)
list(APPEND MOCK_REPLACEMENTS fwk_id)
list(APPEND MOCK_REPLACEMENTS fwk_core)
list(APPEND MOCK_REPLACEMENTS fwk_mm)

include(${SCP_ROOT}/unit_test/module_common.cmake)

Expand Down Expand Up @@ -93,6 +95,7 @@ set(MODULE_UT_MOCK_SRC ${CMAKE_CURRENT_LIST_DIR}/mocks)
list(APPEND MOCK_REPLACEMENTS fwk_module)
list(APPEND MOCK_REPLACEMENTS fwk_id)
list(APPEND MOCK_REPLACEMENTS fwk_core)
list(APPEND MOCK_REPLACEMENTS fwk_mm)

include(${SCP_ROOT}/unit_test/module_common.cmake)

Expand Down
36 changes: 23 additions & 13 deletions module/scmi_perf/test/config_scmi_perf.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
enum dvfs_element_idx {
DVFS_ELEMENT_IDX_0,
DVFS_ELEMENT_IDX_1,
DVFS_ELEMENT_IDX_2,
DVFS_ELEMENT_IDX_COUNT,
};

#define PERF_DOMAINS_IDX_COUNT DVFS_ELEMENT_IDX_COUNT
static const struct mod_scmi_perf_domain_config domains[] = {
[DVFS_ELEMENT_IDX_0] = {
.fast_channels_addr_scp =
Expand All @@ -37,30 +37,40 @@ static const struct mod_scmi_perf_domain_config domains[] = {
(uint64_t[]){
[MOD_SCMI_PERF_FAST_CHANNEL_LEVEL_GET] = 1,
},
.phy_group_id =
FWK_ID_ELEMENT_INIT(FWK_MODULE_IDX_DVFS, DVFS_ELEMENT_IDX_0),
},
[DVFS_ELEMENT_IDX_1] = {
.phy_group_id =
FWK_ID_ELEMENT_INIT(FWK_MODULE_IDX_DVFS, DVFS_ELEMENT_IDX_1),
},
[DVFS_ELEMENT_IDX_1] = {},
[DVFS_ELEMENT_IDX_2] = {},
};

#ifdef BUILD_HAS_SCMI_PERF_PLUGIN_HANDLER
enum plugins_list {
PERF_PLUGIN_IDX_0,
PERF_PLUGIN_IDX_COUNT,
};

static const struct mod_scmi_plugin_config plugins_table[] = {
[0] = {
.id = FWK_ID_NONE_INIT,
[PERF_PLUGIN_IDX_0] = {
.id = FWK_ID_MODULE_INIT(FWK_MODULE_IDX_PERF_PLUGIN),
.dom_type = PERF_PLUGIN_DOM_TYPE_PHYSICAL,
},
};
#endif

struct fwk_module_config config_scmi_perf = {
.data = &((struct mod_scmi_perf_config){
.domains = &domains,
.perf_doms_count = FWK_ARRAY_SIZE(domains),
.fast_channels_alarm_id = FWK_ID_NONE_INIT,
static struct mod_scmi_perf_config perf_config = {
.domains = &domains,
.perf_doms_count = FWK_ARRAY_SIZE(domains),
.fast_channels_alarm_id = FWK_ID_NONE_INIT,
#ifdef BUILD_HAS_SCMI_PERF_PLUGIN_HANDLER
.plugins = plugins_table,
.plugins_count = FWK_ARRAY_SIZE(plugins_table),
.plugins = plugins_table,
#endif
}),
};

struct fwk_module_config config_scmi_perf = {
.data = &perf_config,
};

static const struct mod_dvfs_domain_config test_dvfs_config = {
Expand Down
3 changes: 2 additions & 1 deletion module/scmi_perf/test/fwk_module_idx.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Arm SCP/MCP Software
* Copyright (c) 2022, Arm Limited and Contributors. All rights reserved.
* Copyright (c) 2022-2023, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
Expand All @@ -15,6 +15,7 @@ enum fwk_module_idx {
FWK_MODULE_IDX_SCMI_PERF,
FWK_MODULE_IDX_DVFS,
FWK_MODULE_IDX_TIMER,
FWK_MODULE_IDX_PERF_PLUGIN,
FWK_MODULE_IDX_COUNT,
};

Expand Down
Loading

0 comments on commit d1987ab

Please sign in to comment.