selftests/resctrl: Change a few printed messages
Subsystems (2)
PATCH 1/1 selftests/resctrl: Change a few printed messages
A few printed messages contain pass/fail strings which should be shown in test results. Remove the pass/fail strings in the messages to avoid confusion.
Add "\n" at the end of one printed message.
---
This is a follow-up patch of recent resctrl selftest patches and can be applied cleanly to:
git git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git
branch next.
tools/testing/selftests/resctrl/cache.c | 3 +-- tools/testing/selftests/resctrl/mba_test.c | 9 +++------ tools/testing/selftests/resctrl/mbm_test.c | 3 +-- tools/testing/selftests/resctrl/resctrlfs.c | 7 ++----- 4 files changed, 7 insertions(+), 15 deletions(-)
tools/testing/selftests/resctrl/cache.c +1 -2
@@ -301,8 +301,7 @@ int show_cache_info(unsigned long sum_llc_val, int no_of_bits, ret = platform &&abs ((int )diff_percent) > max_diff_percent && (cmt ? (abs (avg_diff) > max_diff) : true); -ksft_print_msg ("%s cache miss rate within %d%%\n" , - ret ?"Fail:" :"Pass:" , max_diff_percent); +ksft_print_msg ("Check cache miss rate within %d%%\n" , max_diff_percent);ksft_print_msg ("Percent diff=%d\n" ,abs ((int )diff_percent));ksft_print_msg ("Number of bits: %d\n" , no_of_bits);
tools/testing/selftests/resctrl/mba_test.c +3 -6
@@ -80,9 +80,7 @@ static void show_mba_info(unsigned long *bw_imc, unsigned long *bw_resc) avg_diff = (float )labs (avg_bw_resc - avg_bw_imc) / avg_bw_imc; avg_diff_per = (int )(avg_diff *100 ); -ksft_print_msg ("%s MBA: diff within %d%% for schemata %u\n" , - avg_diff_per >MAX_DIFF_PERCENT ? -"Fail:" :"Pass:" , +ksft_print_msg ("Check MBA diff within %d%% for schemata %u\n" ,MAX_DIFF_PERCENT ,ALLOCATION_MAX -ALLOCATION_STEP * allocation);
@@ -93,10 +91,9 @@ static void show_mba_info(unsigned long *bw_imc, unsigned long *bw_resc) failed = true; } -ksft_print_msg ("%s schemata change using MBA\n" , - failed ?"Fail:" :"Pass:" ); +ksft_print_msg ("Check schemata change using MBA\n" );if (failed) -ksft_print_msg ("At least one test failed" ); +ksft_print_msg ("At least one test failed\n" ); }static int check_results (void )
tools/testing/selftests/resctrl/mbm_test.c +1 -2
@@ -37,8 +37,7 @@ show_bw_info(unsigned long *bw_imc, unsigned long *bw_resc, int span) avg_diff_per = (int )(avg_diff *100 ); ret = avg_diff_per >MAX_DIFF_PERCENT ; -ksft_print_msg ("%s MBM: diff within %d%%\n" , - ret ?"Fail:" :"Pass:" ,MAX_DIFF_PERCENT ); +ksft_print_msg ("Check MBM diff within %d%%\n" ,MAX_DIFF_PERCENT );ksft_print_msg ("avg_diff_per: %d%%\n" , avg_diff_per);ksft_print_msg ("Span (MB): %d\n" , span);ksft_print_msg ("avg_bw_imc: %lu\n" , avg_bw_imc);
tools/testing/selftests/resctrl/resctrlfs.c +2 -5
@@ -570,15 +570,12 @@ bool check_resctrlfs_support(void)fclose (inf); -ksft_print_msg ("%s kernel supports resctrl filesystem\n" , - ret ?"Pass:" :"Fail:" ); - +ksft_print_msg ("Check kernel support for resctrl filesystem\n" );if (!ret)return ret; dp =opendir (RESCTRL_PATH ); -ksft_print_msg ("%s resctrl mountpoint \"%s\" exists\n" , - dp ?"Pass:" :"Fail:" ,RESCTRL_PATH ); +ksft_print_msg ("Check resctrl mountpoint \"%s\"\n" ,RESCTRL_PATH );if (dp)closedir (dp);
Signature · 1 line
2.31.1
Shuah Khan
maintainerQuoted 25 lines · Fenghua Yu
A few printed messages contain pass/fail strings which should be shown in test results. Remove the pass/fail strings in the messages to avoid confusion.
Add "\n" at the end of one printed message.
Suggested-by Shuah Khan <[email protected]>Signed-off-by Fenghua Yu <[email protected]>---
This is a follow-up patch of recent resctrl selftest patches and can be applied cleanly to:
gitgit://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git
branch next.tools/testing/selftests/resctrl/cache.c | 3 +-- tools/testing/selftests/resctrl/mba_test.c | 9 +++------ tools/testing/selftests/resctrl/mbm_test.c | 3 +-- tools/testing/selftests/resctrl/resctrlfs.c | 7 ++----- 4 files changed, 7 insertions(+), 15 deletions(-)tools/testing/selftests/resctrl/cache.c +0
-0
tools/testing/selftests/resctrl/cache.c int show_cache_info(unsigned long sum_llc_val, int no_of_bits, · line 304
Quoted 6 lines
tools/testing/selftests/resctrl/cache.c +1
-2@@ -301,8 +301,7 @@ int show_cache_info(unsigned long sum_llc_val, int no_of_bits, ret = platform &&abs ((int )diff_percent) > max_diff_percent && (cmt ? (abs (avg_diff) > max_diff) : true); -ksft_print_msg ("%s cache miss rate within %d%%\n" , - ret ?"Fail:" :"Pass:" , max_diff_percent); +ksft_print_msg ("Check cache miss rate within %d%%\n" , max_diff_percent);
You need %s and pass in the ret ? "Fail:" : "Pass:" result for the message to read correctly.
I am seeing:
# Check kernel support for resctrl filesystem
It should say the following:
# Fail Check kernel support for resctrl filesystem
Same for other such messages.
Quoted 36 lines
tools/testing/selftests/resctrl/cache.c +0
-0ksft_print_msg ("Percent diff=%d\n" ,abs ((int )diff_percent));ksft_print_msg ("Number of bits: %d\n" , no_of_bits);tools/testing/selftests/resctrl/mba_test.c +3
-6@@ -80,9 +80,7 @@ static void show_mba_info(unsigned long *bw_imc, unsigned long *bw_resc) avg_diff = (float )labs (avg_bw_resc - avg_bw_imc) / avg_bw_imc; avg_diff_per = (int )(avg_diff *100 ); -ksft_print_msg ("%s MBA: diff within %d%% for schemata %u\n" , - avg_diff_per >MAX_DIFF_PERCENT ? -"Fail:" :"Pass:" , +ksft_print_msg ("Check MBA diff within %d%% for schemata %u\n" ,MAX_DIFF_PERCENT ,ALLOCATION_MAX -ALLOCATION_STEP * allocation);@@ -93,10 +91,9 @@ static void show_mba_info(unsigned long *bw_imc, unsigned long *bw_resc) failed = true; } -ksft_print_msg ("%s schemata change using MBA\n" , - failed ?"Fail:" :"Pass:" ); +ksft_print_msg ("Check schemata change using MBA\n" );if (failed) -ksft_print_msg ("At least one test failed" ); +ksft_print_msg ("At least one test failed\n" ); }static int check_results (void )tools/testing/selftests/resctrl/mbm_test.c +0
-0
tools/testing/selftests/resctrl/mbm_test.c show_bw_info(unsigned long *bw_imc, unsigned long *bw_resc, int span) · line 40
Quoted 6 lines
tools/testing/selftests/resctrl/mbm_test.c +1
-2@@ -37,8 +37,7 @@ show_bw_info(unsigned long *bw_imc, unsigned long *bw_resc, int span) avg_diff_per = (int )(avg_diff *100 ); ret = avg_diff_per >MAX_DIFF_PERCENT ; -ksft_print_msg ("%s MBM: diff within %d%%\n" , - ret ?"Fail:" :"Pass:" ,MAX_DIFF_PERCENT ); +ksft_print_msg ("Check MBM diff within %d%%\n" ,MAX_DIFF_PERCENT );
Here
Quoted 8 lines
tools/testing/selftests/resctrl/mbm_test.c +0
-0ksft_print_msg ("avg_diff_per: %d%%\n" , avg_diff_per);ksft_print_msg ("Span (MB): %d\n" , span);ksft_print_msg ("avg_bw_imc: %lu\n" , avg_bw_imc);tools/testing/selftests/resctrl/resctrlfs.c +0
-0
tools/testing/selftests/resctrl/resctrlfs.c bool check_resctrlfs_support(void) · line 573
Quoted 7 lines
tools/testing/selftests/resctrl/resctrlfs.c +1
-3@@ -570,15 +570,12 @@ bool check_resctrlfs_support(void)fclose (inf); -ksft_print_msg ("%s kernel supports resctrl filesystem\n" , - ret ?"Pass:" :"Fail:" ); - +ksft_print_msg ("Check kernel support for resctrl filesystem\n" );
Here
tools/testing/selftests/resctrl/resctrlfs.c bool check_resctrlfs_support(void) · line 578
Quoted 7 lines
tools/testing/selftests/resctrl/resctrlfs.c +1
-2if (!ret)return ret; dp =opendir (RESCTRL_PATH ); -ksft_print_msg ("%s resctrl mountpoint \"%s\" exists\n" , - dp ?"Pass:" :"Fail:" ,RESCTRL_PATH ); +ksft_print_msg ("Check resctrl mountpoint \"%s\"\n" ,RESCTRL_PATH );
Here
tools/testing/selftests/resctrl/resctrlfs.c bool check_resctrlfs_support(void) · line 581
Quoted 4 lines
tools/testing/selftests/resctrl/resctrlfs.c +0
-0if (dp)closedir (dp);
thanks,
-- Shuah
Hi, Shuah,
Quoted 7 lines · Shuah Khan
tools/testing/selftests/resctrl/cache.c int show_cache_info(unsigned long sum_llc_val, int no_of_bits, · line 304
Quoted 3 lines · Fenghua Yu
tools/testing/selftests/resctrl/cache.c +1
-2-ksft_print_msg ("%s cache miss rate within %d%%\n" , - ret ?"Fail:" :"Pass:" , max_diff_percent); +ksft_print_msg ("Check cache miss rate within %d%%\n" , max_diff_percent);You need %s and pass in the ret ? "Fail:" : "Pass:" result for the message to read correctly.
Should I keep the ":" after "Pass"/"Fail"?
Quoted 8 lines
I am seeing:
# Check kernel support for resctrl filesystem
It should say the following:
# Fail Check kernel support for resctrl filesystem
i.e. should the printed messages be like the following? # Fail: Check kernel support for resctrl filesystem or
# Pass: Check kernel support for resctrl filesystem
Thanks.
-Fenghua
Shuah Khan
maintainerQuoted 4 lines · Fenghua Yu
Hi, Shuah,
Quoted 1 line · Shuah Khan
On 4/5/21 6:52 PM, Fenghua Yu wrote:
Quoted 9 lines
Quoted 6 lines
tools/testing/selftests/resctrl/cache.c int show_cache_info(unsigned long sum_llc_val, int no_of_bits, · line 304
Quoted 3 lines
tools/testing/selftests/resctrl/cache.c +1
-2-ksft_print_msg ("%s cache miss rate within %d%%\n" , - ret ?"Fail:" :"Pass:" , max_diff_percent); +ksft_print_msg ("Check cache miss rate within %d%%\n" , max_diff_percent);You need %s and pass in the ret ? "Fail:" : "Pass:" result for the message to read correctly.
Should I keep the ":" after "Pass"/"Fail"?
Yes please.
Quoted 5 lines
Quoted 5 lines
I am seeing:
# Check kernel support for resctrl filesystem
Quoted 9 lines
Quoted 3 lines
It should say the following:
# Fail Check kernel support for resctrl filesystem
i.e. should the printed messages be like the following? # Fail: Check kernel support for resctrl filesystem or
# Pass: Check kernel support for resctrl filesystem
This looks good.
thanks,
-- Shuah