selftests/resctrl: Split validate_resctrl_feature_request()

validate_resctrl_feature_request() is used to test both if a resource is
present in the info directory, and if a passed monitoring feature is
present in the mon_features file.

Refactor validate_resctrl_feature_request() into two smaller functions
that each accomplish one check to give feature checking more
granularity:
- Resource directory presence in the /sys/fs/resctrl/info directory.
- Feature name presence in the /sys/fs/resctrl/info/<RESOURCE>/mon_features
  file.

Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
This commit is contained in:
Maciej Wieczor-Retman
2024-02-16 09:35:28 +01:00
committed by Shuah Khan
parent e331ac141f
commit 0061641648
5 changed files with 31 additions and 17 deletions

View File

@@ -97,7 +97,7 @@ static int mbm_setup(const struct resctrl_test *test,
return END_OF_TESTS;
/* Set up shemata with 100% allocation on the first run. */
if (p->num_of_runs == 0 && validate_resctrl_feature_request("MB", NULL))
if (p->num_of_runs == 0 && resctrl_resource_exists("MB"))
ret = write_schemata(p->ctrlgrp, "100", uparams->cpu, test->resource);
p->num_of_runs++;
@@ -140,8 +140,8 @@ out:
static bool mbm_feature_check(const struct resctrl_test *test)
{
return validate_resctrl_feature_request("L3_MON", "mbm_total_bytes") &&
validate_resctrl_feature_request("L3_MON", "mbm_local_bytes");
return resctrl_mon_feature_exists("L3_MON", "mbm_total_bytes") &&
resctrl_mon_feature_exists("L3_MON", "mbm_local_bytes");
}
struct resctrl_test mbm_test = {