[LTP] [PATCH 1/1] hugeshmat04: Restore the correct shmmax value

Cyril Hrubis chrubis@suse.cz
Thu Aug 3 12:42:26 CEST 2023


Hi!
> Signed-off-by: Leo Yu-Chi Liang <ycliang@andestech.com>
> ---
>  testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
> index 50efa8a52..b3e7c272a 100644
> --- a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
> +++ b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
> @@ -83,12 +83,12 @@ static void setup(void)
>  	long hpage_size, orig_hugepages;
>  
>  	orig_hugepages = get_sys_tune("nr_hugepages");
> -	SAFE_FILE_SCANF(PATH_SHMMAX, "%ld", &orig_shmmax);
> -	SAFE_FILE_PRINTF(PATH_SHMMAX, "%ld", (long)SIZE);
> -	SAFE_FILE_SCANF(PATH_SHMMAX, "%ld", &new_shmmax);
> +	SAFE_FILE_SCANF(PATH_SHMMAX, "%lu", &orig_shmmax);
> +	SAFE_FILE_PRINTF(PATH_SHMMAX, "%lu", (long)SIZE);
> +	SAFE_FILE_SCANF(PATH_SHMMAX, "%lu", &new_shmmax);
>  
>  	if (new_shmmax < SIZE)
> -		tst_brk(TCONF,	"shmmax too low, have: %ld", new_shmmax);
> +		tst_brk(TCONF,	"shmmax too low, have: %lu", new_shmmax);
>  
>  	hpage_size = SAFE_READ_MEMINFO("Hugepagesize:") * 1024;
>  
> @@ -99,7 +99,7 @@ static void setup(void)
>  static void cleanup(void)
>  {
>  	if (orig_shmmax != -1)
> -		SAFE_FILE_PRINTF(PATH_SHMMAX, "%ld", orig_shmmax);
> +		SAFE_FILE_PRINTF(PATH_SHMMAX, "%lu", orig_shmmax);
>  }

Can we please move the PATH_SHMMAX restoration to the .save_restore part
of the tst_test structure?

https://github.com/linux-test-project/ltp/wiki/C-Test-API#127-saving--restoring-procsys-values

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list