Hi Sai,
On 5/18/2020 3:08 PM, Sai Praneeth Prakhya wrote:
Presently, if a requested resctrl feature is not supported by H/W or is disabled by user through kernel command line, the test suite treats it as an error and hence would print something like "not ok MBA: schemata change". But, not supporting a feature isn't a test error and hence shouldn't printed as a failure.
So, instead of treating it as an error, use the SKIP directive of TAP protocol and print it as below i.e. don't report it as test failure.
Sample o/p if CAT isn't supported: "ok CAT # SKIP Hardware does not support CAT or CAT is disabled"
Suggested-by: Reinette Chatre reinette.chatre@intel.com Signed-off-by: Sai Praneeth Prakhya sai.praneeth.prakhya@intel.com
...
diff --git a/tools/testing/selftests/resctrl/resctrl_tests.c b/tools/testing/selftests/resctrl/resctrl_tests.c index fb7703413be7..d45ae004ed77 100644 --- a/tools/testing/selftests/resctrl/resctrl_tests.c +++ b/tools/testing/selftests/resctrl/resctrl_tests.c @@ -170,6 +170,10 @@ int main(int argc, char **argv) if (!is_amd && mbm_test) { printf("# Starting MBM BW change ...\n");
if (!validate_resctrl_feature_request("mbm")) {
printf("ok MBM # SKIP Hardware does not support MBM or MBM is disabled\n");
goto test_mba;
if (!has_ben) sprintf(benchmark_cmd[5], "%s", "mba"); res = mbm_bw_change(span, cpu_no, bw_report, benchmark_cmd);}
@@ -178,8 +182,13 @@ int main(int argc, char **argv) tests_run++; } +test_mba:
I think this particular usage of goto could make the flow of the code harder to trace. Could the tests perhaps be moved to functions to avoid needing to jump like this? Perhaps there could be a new function per test, like run_mbm_test(), run_mba_test(), etc. with each test called when requested by user and with the test exiting cleanly if feature is not supported by the hardware.
Reinette