Skip to content

Commit

Permalink
selftests/resctrl: Fix incorrect parsing of option "-t"
Browse files Browse the repository at this point in the history
commit 1421ec6 upstream.

Resctrl test suite accepts command line argument "-t" to specify the
unit tests to run in the test list (e.g., -t mbm,mba,cmt,cat) as
documented in the help.

When calling strtok() to parse the option, the incorrect delimiters
argument ":\t" is used. As a result, passing "-t mbm,mba,cmt,cat" throws
an invalid option error.

Fix this by using delimiters argument "," instead of ":\t" for parsing
of unit tests list. At the same time, remove the unnecessary "spaces"
between the unit tests in help documentation to prevent confusion.

Fixes: 790bf58 ("selftests/resctrl: Add Cache Allocation Technology (CAT) selftest")
Fixes: 7894118 ("selftests/resctrl: Add Cache QoS Monitoring (CQM) selftest")
Fixes: ecdbb91 ("selftests/resctrl: Add MBM test")
Fixes: 034c767 ("selftests/resctrl: Add README for resctrl tests")
Cc: stable@vger.kernel.org
Signed-off-by: Xiaochen Shen <xiaochen.shen@intel.com>
Reviewed-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
xiaochenshen authored and gregkh committed Jul 14, 2021
1 parent b8ffd9d commit 3b0bfe4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tools/testing/selftests/resctrl/README
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Parameter '-h' shows usage information.

usage: resctrl_tests [-h] [-b "benchmark_cmd [options]"] [-t test list] [-n no_of_bits]
-b benchmark_cmd [options]: run specified benchmark for MBM, MBA and CMT default benchmark is builtin fill_buf
-t test list: run tests specified in the test list, e.g. -t mbm, mba, cmt, cat
-t test list: run tests specified in the test list, e.g. -t mbm,mba,cmt,cat
-n no_of_bits: run cache tests using specified no of bits in cache bit mask
-p cpu_no: specify CPU number to run the test. 1 is default
-h: help
4 changes: 2 additions & 2 deletions tools/testing/selftests/resctrl/resctrl_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static void cmd_help(void)
printf("\t-b benchmark_cmd [options]: run specified benchmark for MBM, MBA and CMT\n");
printf("\t default benchmark is builtin fill_buf\n");
printf("\t-t test list: run tests specified in the test list, ");
printf("e.g. -t mbm, mba, cmt, cat\n");
printf("e.g. -t mbm,mba,cmt,cat\n");
printf("\t-n no_of_bits: run cache tests using specified no of bits in cache bit mask\n");
printf("\t-p cpu_no: specify CPU number to run the test. 1 is default\n");
printf("\t-h: help\n");
Expand Down Expand Up @@ -173,7 +173,7 @@ int main(int argc, char **argv)

return -1;
}
token = strtok(NULL, ":\t");
token = strtok(NULL, ",");
}
break;
case 'p':
Expand Down

0 comments on commit 3b0bfe4

Please sign in to comment.