Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Reinette Chatre <reinette.chatre@intel.com>
To: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>,
	Fenghua Yu <fenghua.yu@intel.com>, Shuah Khan <shuah@kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <linux-kselftest@vger.kernel.org>
Subject: Re: [PATCH 3/5] selftests/resctrl: Remove duplicate codes that clear each test result file
Date: Thu, 22 Sep 2022 10:46:31 -0700	[thread overview]
Message-ID: <bdb19cf6-dd4b-2042-7cda-7f6108e543aa@intel.com> (raw)
In-Reply-To: <20220914015147.3071025-5-tan.shaopeng@jp.fujitsu.com>

Hi Shaopeng,

On 9/13/2022 6:51 PM, Shaopeng Tan wrote:
> Before exiting each test function(run_cmt/cat/mbm/mba_test()),
> test results are printed by ksft_print_msg() and then temporary result
> files are cleaned by function cmt/cat/mbm/mba_test_cleanup().
> However, before running ksft_print_msg(), function

before -> after?

> cmt/cat/mbm/mba_test_cleanup()
> has been run in each test function as follows:
>   cmt_resctrl_val()
>   cat_perf_miss_val()
>   mba_schemata_change()
>   mbm_bw_change()
> 
> Remove duplicate codes that clear each test result file.
> 

Another good catch, thank you.

> Signed-off-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
> ---
>  tools/testing/selftests/resctrl/cat_test.c | 1 -
>  tools/testing/selftests/resctrl/cmt_test.c | 2 --
>  tools/testing/selftests/resctrl/mba_test.c | 2 --
>  tools/testing/selftests/resctrl/mbm_test.c | 2 --
>  4 files changed, 7 deletions(-)
> 
> diff --git a/tools/testing/selftests/resctrl/cat_test.c b/tools/testing/selftests/resctrl/cat_test.c
> index 1c5e90c63254..d1134f66469f 100644
> --- a/tools/testing/selftests/resctrl/cat_test.c
> +++ b/tools/testing/selftests/resctrl/cat_test.c
> @@ -221,7 +221,6 @@ int cat_perf_miss_val(int cpu_no, int n, char *cache_type)
>  		kill(bm_pid, SIGKILL);
>  	}
>  
> -	cat_test_cleanup();
>  	if (bm_pid)
>  		umount_resctrlfs();
>  

It makes it much easier to understand code if it is symmetrical. Since the files are
created within cat_perf_miss_val() I think it would be better to perform the cleanup
in the same function. So, keep this cleanup but remove the call from run_cat_test()
instead.

Similar for the cleanups below ... could you please keep them and instead
remove the duplicate cleanup from run_cmt/mbm/mba_test() instead?

When you do so, please be careful since it seems that there is (another!) bug where
the cleanup is not done if the test fails.

> diff --git a/tools/testing/selftests/resctrl/cmt_test.c b/tools/testing/selftests/resctrl/cmt_test.c
> index 8968e36db99d..b3b17fb876f4 100644
> --- a/tools/testing/selftests/resctrl/cmt_test.c
> +++ b/tools/testing/selftests/resctrl/cmt_test.c
> @@ -139,7 +139,5 @@ int cmt_resctrl_val(int cpu_no, int n, char **benchmark_cmd)
>  	if (ret)
>  		return ret;
>  
> -	cmt_test_cleanup();
> -
>  	return 0;
>  }
> diff --git a/tools/testing/selftests/resctrl/mba_test.c b/tools/testing/selftests/resctrl/mba_test.c
> index 1a1bdb6180cf..93ffacb416df 100644
> --- a/tools/testing/selftests/resctrl/mba_test.c
> +++ b/tools/testing/selftests/resctrl/mba_test.c
> @@ -166,7 +166,5 @@ int mba_schemata_change(int cpu_no, char *bw_report, char **benchmark_cmd)
>  	if (ret)
>  		return ret;
>  
> -	mba_test_cleanup();
> -
>  	return 0;
>  }
> diff --git a/tools/testing/selftests/resctrl/mbm_test.c b/tools/testing/selftests/resctrl/mbm_test.c
> index 38a3b3ad1c76..a453db4c221f 100644
> --- a/tools/testing/selftests/resctrl/mbm_test.c
> +++ b/tools/testing/selftests/resctrl/mbm_test.c
> @@ -134,7 +134,5 @@ int mbm_bw_change(int span, int cpu_no, char *bw_report, char **benchmark_cmd)
>  	if (ret)
>  		return ret;
>  
> -	mbm_test_cleanup();
> -
>  	return 0;
>  }

Thank you

Reinette

  reply	other threads:[~2022-09-22 17:46 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-14  1:51 [PATCH 0/5] selftests/resctrl: Some improvements of resctrl selftest Shaopeng Tan
2022-09-14  1:51 ` [PATCH 1/5] selftests/resctrl: Clear unused initalization code in MBM tests Shaopeng Tan
2022-09-22 17:44   ` Reinette Chatre
2022-09-27  9:01     ` tan.shaopeng
2022-09-28 15:48       ` Reinette Chatre
2022-09-29  5:28         ` tan.shaopeng
2022-09-29 15:27           ` Reinette Chatre
2022-09-14  1:51 ` [PATCH] selftests/resctrl: Return MBA check result and make it to output message Shaopeng Tan
2022-09-22 17:51   ` Reinette Chatre
2022-09-27  8:55     ` tan.shaopeng
2022-09-14  1:51 ` [PATCH 2/5] selftests/resctrl: Clear unused common codes called by CAT/MBA tests Shaopeng Tan
2022-09-22 17:44   ` Reinette Chatre
2022-09-27  9:01     ` tan.shaopeng
2022-09-14  1:51 ` [PATCH 3/5] selftests/resctrl: Remove duplicate codes that clear each test result file Shaopeng Tan
2022-09-22 17:46   ` Reinette Chatre [this message]
2022-09-27  9:01     ` tan.shaopeng
2022-09-28 15:48       ` Reinette Chatre
2022-09-29  5:28         ` tan.shaopeng
2022-09-29 15:28           ` Reinette Chatre
2022-09-14  1:51 ` [PATCH 4/5] selftests/resctrl: Kill the child process before exiting the parent process if an exception occurs Shaopeng Tan
2022-09-22 17:47   ` Reinette Chatre
2022-09-27  9:02     ` tan.shaopeng
2022-09-14  1:51 ` [PATCH 5/5] selftests/resctrl: Flush stdout file buffer before executing fork() Shaopeng Tan
2022-09-22 17:52   ` Reinette Chatre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bdb19cf6-dd4b-2042-7cda-7f6108e543aa@intel.com \
    --to=reinette.chatre@intel.com \
    --cc=fenghua.yu@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=tan.shaopeng@jp.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox