public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Andrea Cervesato <andrea.cervesato@suse.de>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v4 07/10] Rewrite shmem_2nstest.c using new LTP API
Date: Fri, 3 Jun 2022 11:26:08 +0200	[thread overview]
Message-ID: <YpnTsNWuDoKV2KiZ@yuki> (raw)
In-Reply-To: <20220325125445.11984-8-andrea.cervesato@suse.de>

Hi!
Pushed with a few changes, thanks.

I did rearrange the code to make it a bit simpler and removed some
useless code.

Full diff:

diff --git a/testcases/kernel/containers/sysvipc/shmem_2nstest.c b/testcases/kernel/containers/sysvipc/shmem_2nstest.c
index e6c1a16fa..ea3de94bd 100644
--- a/testcases/kernel/containers/sysvipc/shmem_2nstest.c
+++ b/testcases/kernel/containers/sysvipc/shmem_2nstest.c
@@ -40,36 +40,28 @@
 static char *str_op;
 static int use_clone;
 
-/*
- * check_shmem1() does not read -- it writes to check_shmem2() when it's done.
- */
 static int check_shmem1(LTP_ATTRIBUTE_UNUSED void *vtest)
 {
-	SAFE_SHMGET(TESTKEY, 100, IPC_CREAT);
+	int id;
+
+	id = SAFE_SHMGET(TESTKEY, 100, IPC_CREAT);
 
 	tst_res(TINFO, "container1: able to create shared mem segment");
 
-	TST_CHECKPOINT_WAKE(0);
+	TST_CHECKPOINT_WAKE_AND_WAIT(0);
+
+	SAFE_SHMCTL(id, IPC_RMID, NULL);
 
 	return 0;
 }
 
-/*
- * check_shmem2() reads from check_shmem1() and writes to main() when it's done.
- */
 static int check_shmem2(LTP_ATTRIBUTE_UNUSED void *vtest)
 {
-	int id;
-
 	TST_CHECKPOINT_WAIT(0);
 
 	TEST(shmget(TESTKEY, 100, 0));
 
 	if (TST_RET < 0) {
-		SAFE_SHMGET(TESTKEY, 100, IPC_CREAT);
-
-		tst_res(TINFO, "container2: able to allocate shmem seg with the same key");
-
 		if (use_clone == T_NONE)
 			tst_res(TFAIL, "Plain cloned process didn't find shmem segment");
 		else
@@ -81,8 +73,7 @@ static int check_shmem2(LTP_ATTRIBUTE_UNUSED void *vtest)
 			tst_res(TFAIL, "%s: in namespace2 found the shmem segment created in namespace1", str_op);
 	}
 
-	id = SAFE_SHMGET(TESTKEY, 100, 0);
-	SAFE_SHMCTL(id, IPC_RMID, NULL);
+	TST_CHECKPOINT_WAKE(0);
 
 	return 0;
 }

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2022-06-03  9:24 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-25 12:54 [LTP] [PATCH v4 00/10] Rewrite sysvipc testing suite using new LTP API Andrea Cervesato
2022-03-25 12:54 ` [LTP] [PATCH v4 01/10] Rewrite mesgq_nstest.c " Andrea Cervesato
2022-06-02 13:03   ` Cyril Hrubis
2022-03-25 12:54 ` [LTP] [PATCH v4 02/10] Rewrite msg_comm.c " Andrea Cervesato
2022-06-02 13:12   ` Cyril Hrubis
2022-03-25 12:54 ` [LTP] [PATCH v4 03/10] Rewrite sem_comm.c " Andrea Cervesato
2022-06-02 13:21   ` Cyril Hrubis
2022-03-25 12:54 ` [LTP] [PATCH v4 04/10] Rewrite sem_nstest.c " Andrea Cervesato
2022-06-02 13:47   ` Cyril Hrubis
2022-03-25 12:54 ` [LTP] [PATCH v4 05/10] Rewrite semtest_2ns.c " Andrea Cervesato
2022-06-03  8:50   ` Cyril Hrubis
2022-03-25 12:54 ` [LTP] [PATCH v4 06/10] Rewrite shmnstest.c " Andrea Cervesato
2022-06-03  9:00   ` Cyril Hrubis
2022-03-25 12:54 ` [LTP] [PATCH v4 07/10] Rewrite shmem_2nstest.c " Andrea Cervesato
2022-06-03  9:26   ` Cyril Hrubis [this message]
2022-03-25 12:54 ` [LTP] [PATCH v4 08/10] Rewrite shm_comm.c " Andrea Cervesato
2022-06-03  9:33   ` Cyril Hrubis
2022-03-25 12:54 ` [LTP] [PATCH v4 09/10] Remove libclone dependency from sysvipc test suite Andrea Cervesato
2022-06-03  9:35   ` Cyril Hrubis
2022-03-25 12:54 ` [LTP] [PATCH v4 10/10] Delete ipcns_helper.h in the " Andrea Cervesato
2022-06-03  9:35   ` Cyril Hrubis

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=YpnTsNWuDoKV2KiZ@yuki \
    --to=chrubis@suse.cz \
    --cc=andrea.cervesato@suse.de \
    --cc=ltp@lists.linux.it \
    /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