X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fintel_rdt_test.c;h=fee83841ad1c7a14342a76c733623a023442e8c8;hp=13407387b83af71fa7037377555c351ca66ed3f1;hb=48efd3deb4c9139fd060ff3d289896e9031bcc7c;hpb=df49cf6aac930f56813af82d1ea8669783349a21 diff --git a/src/intel_rdt_test.c b/src/intel_rdt_test.c index 13407387..fee83841 100644 --- a/src/intel_rdt_test.c +++ b/src/intel_rdt_test.c @@ -4,27 +4,6 @@ /*************************************************************************** * PQOS mocks */ -#if PQOS_VERSION >= 30000 -int pqos_alloc_reset(const enum pqos_cdp_config l3_cdp_cfg, - const enum pqos_cdp_config l2_cdp_cfg, - const enum pqos_mba_config mba_cfg) { - return 0; -} -#elif PQOS_VERSION >= 2000 -int pqos_alloc_reset(const enum pqos_cdp_config l3_cdp_cfg, - const enum pqos_cdp_config l2_cdp_cfg) { - return 0; -} -#else -int pqos_alloc_reset(const enum pqos_cdp_config l3_cdp_cfg) { - return 0; -} -#endif - -#ifdef LIBPQOS2 -/*************************************************************************** - * PQOS v2.0 mocks - */ int pqos_mon_reset(void) { return 0; } int pqos_mon_assoc_get(const unsigned lcore, pqos_rmid_t *rmid) { return 0; } int pqos_mon_start(const unsigned num_cores, const unsigned *cores, @@ -32,6 +11,7 @@ int pqos_mon_start(const unsigned num_cores, const unsigned *cores, struct pqos_mon_data *group) { return 0; } +#if PQOS_VERSION >= 30000 int pqos_mon_start_pids(const unsigned num_pids, const pid_t *pids, const enum pqos_mon_event event, void *context, struct pqos_mon_data *group) { @@ -45,10 +25,32 @@ int pqos_mon_remove_pids(const unsigned num_pids, const pid_t *pids, struct pqos_mon_data *group) { return 0; } + +#else +int pqos_mon_start_pid(const pid_t pids, const enum pqos_mon_event event, + void *context, struct pqos_mon_data *group) { + return 0; +} +#endif int pqos_mon_stop(struct pqos_mon_data *group) { return 0; } int pqos_mon_poll(struct pqos_mon_data **groups, const unsigned num_groups) { return 0; } + +#if PQOS_VERSION >= 30000 +int pqos_alloc_reset(const enum pqos_cdp_config l3_cdp_cfg, + const enum pqos_cdp_config l2_cdp_cfg, + const enum pqos_mba_config mba_cfg) { + return 0; +} +#elif PQOS_VERSION >= 20000 +int pqos_alloc_reset(const enum pqos_cdp_config l3_cdp_cfg, + const enum pqos_cdp_config l2_cdp_cfg) { + return 0; +} +#else +int pqos_alloc_reset(const enum pqos_cdp_config l3_cdp_cfg) { return 0; } +#endif int pqos_alloc_assoc_set(const unsigned lcore, const unsigned class_id) { return 0; } @@ -81,6 +83,7 @@ int pqos_cap_get(const struct pqos_cap **cap, const struct pqos_cpuinfo **cpu) { return 0; } +#ifdef LIBPQOS2 /*************************************************************************** * helper functions */ @@ -119,7 +122,8 @@ DEF_TEST(rdt_config_ngroups__one_process) { {.value.string = "proc1", .type = OCONFIG_TYPE_STRING}, }; oconfig_item_t config_item = { - .values = values, .values_num = STATIC_ARRAY_SIZE(values), + .values = values, + .values_num = STATIC_ARRAY_SIZE(values), }; /* check */ @@ -144,7 +148,8 @@ DEF_TEST(rdt_config_ngroups__two_groups) { {.value.string = "proc21,proc22,proc23", .type = OCONFIG_TYPE_STRING}, }; oconfig_item_t config_item = { - .values = values, .values_num = STATIC_ARRAY_SIZE(values), + .values = values, + .values_num = STATIC_ARRAY_SIZE(values), }; /* check */ @@ -175,7 +180,8 @@ DEF_TEST(rdt_config_ngroups__too_long_proc_name) { {.value.string = "_seventeen_chars_", .type = OCONFIG_TYPE_STRING}, }; oconfig_item_t config_item = { - .values = values, .values_num = STATIC_ARRAY_SIZE(values), + .values = values, + .values_num = STATIC_ARRAY_SIZE(values), }; /* check */ @@ -197,7 +203,8 @@ DEF_TEST(rdt_config_ngroups__duplicate_proc_name_between_groups) { {.value.string = "proc21,proc,proc23", .type = OCONFIG_TYPE_STRING}, }; oconfig_item_t config_item = { - .values = values, .values_num = STATIC_ARRAY_SIZE(values), + .values = values, + .values_num = STATIC_ARRAY_SIZE(values), }; /* check */ @@ -218,7 +225,8 @@ DEF_TEST(rdt_config_ngroups__duplicate_proc_name_in_group) { {.value.string = "proc11,proc,proc,proc14", .type = OCONFIG_TYPE_STRING}, }; oconfig_item_t config_item = { - .values = values, .values_num = STATIC_ARRAY_SIZE(values), + .values = values, + .values_num = STATIC_ARRAY_SIZE(values), }; /* check */ @@ -241,7 +249,8 @@ DEF_TEST(rdt_config_ngroups__empty_group) { }; oconfig_item_t config_item = { - .values = values, .values_num = STATIC_ARRAY_SIZE(values), + .values = values, + .values_num = STATIC_ARRAY_SIZE(values), }; /* check */ @@ -262,7 +271,8 @@ DEF_TEST(rdt_config_ngroups__empty_proc_name) { {.value.string = "proc11,,proc13", .type = OCONFIG_TYPE_STRING}, }; oconfig_item_t config_item = { - .values = values, .values_num = STATIC_ARRAY_SIZE(values), + .values = values, + .values_num = STATIC_ARRAY_SIZE(values), }; /* check */ @@ -287,56 +297,6 @@ int main(void) { } #else -/*************************************************************************** - * PQOS v1.2 mocks - */ -int pqos_mon_reset(void) { return 0; } -int pqos_mon_assoc_get(const unsigned lcore, pqos_rmid_t *rmid) { return 0; } -int pqos_mon_start(const unsigned num_cores, const unsigned *cores, - const enum pqos_mon_event event, void *context, - struct pqos_mon_data *group) { - return 0; -} -int pqos_mon_start_pid(const pid_t pids, const enum pqos_mon_event event, - void *context, struct pqos_mon_data *group) { - return 0; -} -int pqos_mon_stop(struct pqos_mon_data *group) { return 0; } -int pqos_mon_poll(struct pqos_mon_data **groups, const unsigned num_groups) { - return 0; -} -int pqos_alloc_assoc_set(const unsigned lcore, const unsigned class_id) { - return 0; -} -int pqos_alloc_assoc_get(const unsigned lcore, unsigned *class_id) { return 0; } -int pqos_alloc_assoc_set_pid(const pid_t task, const unsigned class_id) { - return 0; -} -int pqos_alloc_assoc_get_pid(const pid_t task, unsigned *class_id) { return 0; } -int pqos_alloc_assign(const unsigned technology, const unsigned *core_array, - const unsigned core_num, unsigned *class_id) { - return 0; -} -int pqos_alloc_release(const unsigned *core_array, const unsigned core_num) { - return 0; -} -int pqos_alloc_assign_pid(const unsigned technology, const pid_t *task_array, - const unsigned task_num, unsigned *class_id) { - return 0; -} -int pqos_alloc_release_pid(const pid_t *task_array, const unsigned task_num) { - return 0; -} -int pqos_init(const struct pqos_config *config) { return 0; } -int pqos_fini(void) { return 0; } -int pqos_cap_get_type(const struct pqos_cap *cap, const enum pqos_cap_type type, - const struct pqos_capability **cap_item) { - return 0; -} -int pqos_cap_get(const struct pqos_cap **cap, const struct pqos_cpuinfo **cpu) { - return 0; -} - DEF_TEST(pqos12_test_stub) { EXPECT_EQ_INT(0, 0); return 0;