Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/resctrl: Fix incorrect parsing of option "-t"

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: 790bf585b0ee ("selftests/resctrl: Add Cache Allocation Technology (CAT) selftest")
Fixes: 78941183d1b1 ("selftests/resctrl: Add Cache QoS Monitoring (CQM) selftest")
Fixes: ecdbb911f22d ("selftests/resctrl: Add MBM test")
Fixes: 034c7678dd2c ("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>

authored by

Xiaochen Shen and committed by
Shuah Khan
1421ec68 d07f6ca9

+3 -3
+1 -1
tools/testing/selftests/resctrl/README
··· 47 47 48 48 usage: resctrl_tests [-h] [-b "benchmark_cmd [options]"] [-t test list] [-n no_of_bits] 49 49 -b benchmark_cmd [options]: run specified benchmark for MBM, MBA and CMT default benchmark is builtin fill_buf 50 - -t test list: run tests specified in the test list, e.g. -t mbm, mba, cmt, cat 50 + -t test list: run tests specified in the test list, e.g. -t mbm,mba,cmt,cat 51 51 -n no_of_bits: run cache tests using specified no of bits in cache bit mask 52 52 -p cpu_no: specify CPU number to run the test. 1 is default 53 53 -h: help
+2 -2
tools/testing/selftests/resctrl/resctrl_tests.c
··· 40 40 printf("\t-b benchmark_cmd [options]: run specified benchmark for MBM, MBA and CMT\n"); 41 41 printf("\t default benchmark is builtin fill_buf\n"); 42 42 printf("\t-t test list: run tests specified in the test list, "); 43 - printf("e.g. -t mbm, mba, cmt, cat\n"); 43 + printf("e.g. -t mbm,mba,cmt,cat\n"); 44 44 printf("\t-n no_of_bits: run cache tests using specified no of bits in cache bit mask\n"); 45 45 printf("\t-p cpu_no: specify CPU number to run the test. 1 is default\n"); 46 46 printf("\t-h: help\n"); ··· 173 173 174 174 return -1; 175 175 } 176 - token = strtok(NULL, ":\t"); 176 + token = strtok(NULL, ","); 177 177 } 178 178 break; 179 179 case 'p':