[LTP] [PATCH v4] mem: Convert shmt02 to new API

Ricardo B. Marlière rbm@suse.com
Mon Jun 23 19:42:58 CEST 2025


On Mon Jun 23, 2025 at 2:38 PM -03, Andrea Cervesato wrote:
> Hi!
>
> Merged with a small change because I realized my suggestion to use 
> TST_EXP_EQ_STRN() was not matching LTP standards (data != strings).
>
> diff --git a/testcases/kernel/mem/shmt/shmt02.c 
> b/testcases/kernel/mem/shmt/shmt02.c
> index 020074d3e..16d99ac7a 100644
> --- a/testcases/kernel/mem/shmt/shmt02.c
> +++ b/testcases/kernel/mem/shmt/shmt02.c
> @@ -34,7 +34,12 @@ static void run(void)
>
>          SAFE_SHMCTL(shmid, IPC_RMID, NULL);
>
> -       TST_EXP_EQ_STRN(cp, tst_rand_data, SHMSIZE);
> +       if (memcmp(cp, tst_rand_data, SHMSIZE) != 0) {
> +               tst_res(TFAIL, "Copied data changed after IPC_RMID");
> +               return;
> +       }
> +
> +       tst_res(TPASS, "Copied data has been read back");

Ah, indeed. Thank you!

>   }
>
>   static struct tst_test test = {
>
> - Andrea



More information about the ltp mailing list