All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] msgctl{08, 09, 10, 11}: cleanup
       [not found] <525F76B7.4050705@oracle.com>
@ 2013-10-18  9:12 ` Stanislav Kholmanskikh
  2013-10-21 12:57   ` chrubis
  0 siblings, 1 reply; 7+ messages in thread
From: Stanislav Kholmanskikh @ 2013-10-18  9:12 UTC (permalink / raw)
  To: ltp-list; +Cc: vasily.isaenko

* Moved common functions, definitions to libmsgctl.h, libmsgctl.c.
* Changed tst_* in children with printf + exit (or return).
* Some cleanup.

Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
---
 testcases/kernel/syscalls/ipc/msgctl/Makefile    |    9 +
 testcases/kernel/syscalls/ipc/msgctl/libmsgctl.c |  148 +++++++++++++
 testcases/kernel/syscalls/ipc/msgctl/libmsgctl.h |   39 ++++
 testcases/kernel/syscalls/ipc/msgctl/msgctl08.c  |  201 ++++--------------
 testcases/kernel/syscalls/ipc/msgctl/msgctl09.c  |  252 ++++-----------------
 testcases/kernel/syscalls/ipc/msgctl/msgctl10.c  |  196 ++++--------------
 testcases/kernel/syscalls/ipc/msgctl/msgctl11.c  |  245 ++++-----------------
 7 files changed, 369 insertions(+), 721 deletions(-)
 create mode 100644 testcases/kernel/syscalls/ipc/msgctl/libmsgctl.c
 create mode 100644 testcases/kernel/syscalls/ipc/msgctl/libmsgctl.h

diff --git a/testcases/kernel/syscalls/ipc/msgctl/Makefile b/testcases/kernel/syscalls/ipc/msgctl/Makefile
index f467389..ae61b51 100644
--- a/testcases/kernel/syscalls/ipc/msgctl/Makefile
+++ b/testcases/kernel/syscalls/ipc/msgctl/Makefile
@@ -18,6 +18,15 @@
 
 top_srcdir              ?= ../../../../..
 
+FILTER_OUT_MAKE_TARGETS	:= libmsgctl
+
 include $(top_srcdir)/include/mk/testcases.mk
 include $(abs_srcdir)/../Makefile.inc
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
+
+SRCS			?= $(wildcard $(abs_srcdir)/*.c)
+OBJS			:= $(notdir $(patsubst %.c,%.o,$(SRCS)))
+.INTERMEDIATE: $(OBJS)
+
+$(MAKE_TARGETS): %: %.o libmsgctl.o
+libmsgctl.o: libmsgctl.h
diff --git a/testcases/kernel/syscalls/ipc/msgctl/libmsgctl.c b/testcases/kernel/syscalls/ipc/msgctl/libmsgctl.c
new file mode 100644
index 0000000..fa77b56
--- /dev/null
+++ b/testcases/kernel/syscalls/ipc/msgctl/libmsgctl.c
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) International Business Machines  Corp., 2002
+ * Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation,
+ * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/msg.h>
+#include "libmsgctl.h"
+
+int doreader(long key, int tid, long type, int child, int nreps)
+{
+	int i, size;
+	int id;
+	struct mbuffer buffer;
+
+	id = msgget(key, 0);
+	if (id < 0) {
+		printf("msgget() error in the reader of child group %d: %s\n",
+			child, strerror(errno));
+
+		return FAIL;
+	}
+	if (id != tid) {
+		printf("Message queue mismatch in the reader of child group %d for message queue id %d\n",
+			child, id);
+
+		return FAIL;
+	}
+	for (i = 0; i < nreps; i++) {
+		memset(&buffer, 0, sizeof(buffer));
+
+		size = msgrcv(id, &buffer, 100, type, 0);
+		if (size < 0) {
+			printf("msgrcv() error in child %d, read # = %d: %s\n",
+				child, (i + 1), strerror(errno));
+
+			return FAIL;
+		}
+		if (buffer.type != type) {
+			printf("Type mismatch in child %d, read #d = %d: ",
+				child, (i + 1));
+			printf("for message got %ld, expected - %ld\n",
+				buffer.type, type);
+
+			return FAIL;
+		}
+		if (buffer.data.len + 1 != size) {
+			printf("Size mismatch in child %d, read # = %d: ",
+				child, (i + 1));
+			printf("for message got %d, expected - %d\n",
+				buffer.data.len + 1, size);
+
+			return FAIL;
+		}
+		if (verify(buffer.data.pbytes, (key % 255), size - 1, child)) {
+			printf("Verify failed in child %d read # = %d, key = %lx\n",
+				child, (i + 1), key);
+
+			return FAIL;
+		}
+		key++;
+	}
+	return PASS;
+}
+
+int dowriter(long key, int tid, long type, int child, int nreps)
+{
+	int i, size;
+	int id;
+	struct mbuffer buffer;
+
+	id = msgget(key, 0);
+	if (id < 0) {
+		printf("msgget() error in the writer of child group %d: %s\n",
+			child, strerror(errno));
+
+		return FAIL;
+	}
+	if (id != tid) {
+		printf("Message queue mismatch in the reader of child group %d for message queue id %d\n",
+			child, id);
+
+		return FAIL;
+	}
+
+	for (i = 0; i < nreps; i++) {
+		memset(&buffer, 0, sizeof(buffer));
+
+		do {
+			size = (lrand48() % 99);
+		} while (size == 0);
+		fill_buffer(buffer.data.pbytes, (key % 255), size);
+		buffer.data.len = size;
+		buffer.type = type;
+		if (msgsnd(id, &buffer, size + 1, 0) < 0) {
+			printf("msgsnd() error in child %d, write # = %d, key = %lx: %s\n",
+				child, nreps, key, strerror(errno));
+
+			return FAIL;
+		}
+		key++;
+	}
+	return PASS;
+}
+
+int fill_buffer(char *buf, char val, int size)
+{
+	int i;
+
+	for (i = 0; i < size; i++)
+		buf[i] = val;
+	return 0;
+}
+
+/* Check a buffer for correct values */
+int verify(char *buf, char val, int size, int child)
+{
+	while (size-- > 0) {
+		if (*buf++ != val) {
+			printf("Verify error in child %d, *buf = %x, val = %x, size = %d\n",
+				child, *buf, val, size);
+
+			return FAIL;
+		}
+	}
+	return PASS;
+}
+
diff --git a/testcases/kernel/syscalls/ipc/msgctl/libmsgctl.h b/testcases/kernel/syscalls/ipc/msgctl/libmsgctl.h
new file mode 100644
index 0000000..e1afeab
--- /dev/null
+++ b/testcases/kernel/syscalls/ipc/msgctl/libmsgctl.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) International Business Machines  Corp., 2002
+ * Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation,
+ * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef __LIBMSGCTL_H__
+#define __LIBMSGCTL_H__
+
+#define FAIL	1
+#define PASS	0
+
+struct mbuffer {
+	long type;
+	struct {
+		char len;
+		char pbytes[99];
+	} data;
+};
+
+int doreader(long key, int tid, long type, int child, int nreps);
+int dowriter(long key, int tid, long type, int child, int nreps);
+int fill_buffer(char *buf, char val, int size);
+int verify(char *buf, char val, int size, int child);
+
+#endif /*__LIBMSGCTL_H__ */
diff --git a/testcases/kernel/syscalls/ipc/msgctl/msgctl08.c b/testcases/kernel/syscalls/ipc/msgctl/msgctl08.c
index f733946..8d7e431 100644
--- a/testcases/kernel/syscalls/ipc/msgctl/msgctl08.c
+++ b/testcases/kernel/syscalls/ipc/msgctl/msgctl08.c
@@ -51,6 +51,7 @@
 #include "test.h"
 #include "usctest.h"
 #include "ipcmsg.h"
+#include "libmsgctl.h"
 
 void setup();
 void cleanup();
@@ -61,38 +62,22 @@ void cleanup();
 char *TCID = "msgctl08";	/* Test program identifier.    */
 int TST_TOTAL = 1;		/* Total number of test cases. */
 
-int exp_enos[] = { 0 };		/* List must end with 0 */
-
 #ifndef CONFIG_COLDFIRE
 #define MAXNPROCS	1000000	/* This value is set to an arbitrary high limit. */
 #else
 #define MAXNPROCS	 100000	/* Coldfire can't deal with 1000000 */
 #endif
 #define MAXNREPS	100000
-#define FAIL		1
-#define PASS		0
-
-key_t keyarray[MAXNPROCS];
-
-struct {
-	long type;
-	struct {
-		char len;
-		char pbytes[99];
-	} data;
-} buffer;
-
-int pidarray[MAXNPROCS];
-int tid;
-int MSGMNI, nprocs, nreps;
-int procstat;
+
+static key_t keyarray[MAXNPROCS];
+
+static int pidarray[MAXNPROCS];
+static int tid;
+static int MSGMNI, nprocs, nreps;
+static int procstat;
 int dotest(key_t key, int child_process);
-int doreader(int id, long key, int child);
-int dowriter(int id, long key, int child);
-int fill_buffer(register char *buf, char val, register int size);
-int verify(register char *buf, char val, register int size, int child);
 void sig_handler();		/* signal catching function */
-int mykid;
+static int mykid;
 #ifdef UCLINUX
 static char *argv0;
 
@@ -106,11 +91,9 @@ static int child_process_uclinux;
 #endif
 
 /*-----------------------------------------------------------------*/
-int main(argc, argv)
-int argc;
-char *argv[];
+int main(int argc, char **argv)
 {
-	register int i, j, ok, pid;
+	int i, j, ok, pid;
 	int count, status;
 	struct sigaction act;
 
@@ -162,7 +145,7 @@ char *argv[];
 	srand(getpid());
 	tid = -1;
 
-	/* Setup signal handleing routine */
+	/* Setup signal handling routine */
 	memset(&act, 0, sizeof(act));
 	act.sa_handler = sig_handler;
 	sigemptyset(&act.sa_mask);
@@ -266,179 +249,84 @@ void do_child_1_uclinux()
 
 void do_child_2_uclinux()
 {
-	exit(doreader(id_uclinux, key_uclinux % 255, child_process_uclinux));
+	exit(doreader(key_uclinux, id_uclinux, 1, child_process_uclinux, nreps));
 }
 #endif
 
-int dotest(key, child_process)
-key_t key;
-int child_process;
+int dotest(key_t key, int child_process)
 {
 	int id, pid;
+	int ret, status;
 
 	sighold(SIGTERM);
 	TEST(msgget(key, IPC_CREAT | S_IRUSR | S_IWUSR));
 	if (TEST_RETURN < 0) {
-		tst_resm(TFAIL | TTERRNO, "Msgget error in child %d",
-			 child_process);
-		tst_exit();
+		printf("msgget() error in child %d: %s\n",
+			child_process, strerror(TEST_ERRNO));
+
+		return FAIL;
 	}
 	tid = id = TEST_RETURN;
 	sigrelse(SIGTERM);
 
 	fflush(stdout);
 	if ((pid = FORK_OR_VFORK()) < 0) {
-		tst_resm(TWARN, "\tFork failed (may be OK if under stress)");
+		printf("\tFork failed (may be OK if under stress)\n");
 		TEST(msgctl(tid, IPC_RMID, 0));
 		if (TEST_RETURN < 0) {
-			tst_resm(TFAIL | TTERRNO, "Msgctl error in cleanup");
+			printf("mscgtl() error in cleanup: %s\n",
+				strerror(TEST_ERRNO));
 		}
-		tst_exit();
+		return FAIL;
 	}
 	/* Child does this */
 	if (pid == 0) {
 #ifdef UCLINUX
 		if (self_exec(argv0, "nddd", 2, id, key, child_process) < 0) {
-			tst_resm(TWARN, "self_exec failed");
+			printf("self_exec failed\n");
 			TEST(msgctl(tid, IPC_RMID, 0));
 			if (TEST_RETURN < 0) {
-				tst_resm(TFAIL | TTERRNO,
-					 "Msgctl error in cleanup");
+				printf("msgctl() error in cleanup: %s\n",
+					strerror(errno));
 			}
-			tst_exit();
+			return FAIL;
 		}
 #else
-		exit(doreader(id, key % 255, child_process));
+		exit(doreader(key, id, 1, child_process, nreps));
 #endif
 	}
 	/* Parent does this */
 	mykid = pid;
 	procstat = 2;
-	dowriter(id, key % 255, child_process);
-	wait(0);
-	TEST(msgctl(id, IPC_RMID, 0));
-	if (TEST_RETURN < 0) {
-		tst_resm(TFAIL, "msgctl errno %d", TEST_ERRNO);
-		tst_exit();
-	}
-	exit(PASS);
-}
-
-int doreader(id, key, child)
-int id, child;
-long key;
-{
-	int i, size;
+	ret = dowriter(key, id, 1, child_process, nreps);
+	wait(&status);
 
-	for (i = 0; i < nreps; i++) {
-		if ((size = msgrcv(id, &buffer, 100, 0, 0)) < 0) {
-			tst_brkm(TBROK | TERRNO, cleanup,
-				 "Msgrcv error in child %d, read # = %d",
-				 (i + 1), child);
-			tst_exit();
-		}
-		if (buffer.data.len + 1 != size) {
-			tst_resm(TFAIL,
-				 "Size mismatch in child %d, read # = %d",
-				 child, (i + 1));
-			tst_resm(TFAIL,
-				 "for message size got  %d expected  %d",
-				 size, buffer.data.len);
-			tst_exit();
-		}
-		if (verify(buffer.data.pbytes, key, size - 1, child)) {
-			tst_resm(TFAIL, "in child %d read # = %d,key =  %lx",
-				 child, (i + 1), key);
-			tst_exit();
-		}
-		key++;
-	}
-	return (0);
-}
+	if (ret != PASS)
+		exit(FAIL);
 
-int dowriter(id, key, child)
-int id, child;
-long key;
-{
-	int i, size;
+	if ((!WIFEXITED(status) || (WEXITSTATUS(status) != PASS)))
+		exit(FAIL);
 
-	for (i = 0; i < nreps; i++) {
-		do {
-			size = (rand() % 99);
-		} while (size == 0);
-		fill_buffer(buffer.data.pbytes, key, size);
-		buffer.data.len = size;
-		buffer.type = 1;
-		TEST(msgsnd(id, &buffer, size + 1, 0));
-		if (TEST_RETURN < 0) {
-			tst_brkm(TBROK | TTERRNO, cleanup,
-				 "Msgsnd error in child %d, key =   %lx",
-				 child, key);
-		}
-		key++;
-	}
-	return (0);
-}
-
-int fill_buffer(buf, val, size)
-register char *buf;
-char val;
-register int size;
-{
-	register int i;
-
-	for (i = 0; i < size; i++) {
-		buf[i] = val;
-	}
-
-	return (0);
-}
-
-/*
- * verify()
- *	Check a buffer for correct values.
- */
+	TEST(msgctl(id, IPC_RMID, 0));
+	if (TEST_RETURN < 0) {
+		printf("msgctl() errno %d: %s\n",
+			TEST_ERRNO, strerror(TEST_ERRNO));
 
-int verify(buf, val, size, child)
-register char *buf;
-char val;
-register int size;
-int child;
-{
-	while (size-- > 0) {
-		if (*buf++ != val) {
-			tst_resm(TWARN,
-				 "Verify error in child %d, *buf = %x, val = %x, size = %d",
-				 child, *buf, val, size);
-			return (FAIL);
-		}
+		return FAIL;
 	}
-	return (PASS);
+	return PASS;
 }
 
-/*
- *  * void
- *  * sig_handler() - signal catching function for 'SIGUSR1' signal.
- *  *
- *  *   This is a null function and used only to catch the above signal
- *  *   generated in parent process.
- *  */
 void sig_handler()
 {
 }
 
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- *****************************************************************/
 void setup()
 {
 	int nr_msgqs;
 
 	tst_tmpdir();
 
-	/* You will want to enable some signal handling so you can capture
-	 * unexpected signals like SIGSEGV.
-	 */
 	tst_sig(FORK, DEF_HANDLER, cleanup);
 
 	/* One cavet that hasn't been fixed yet.  TEST_PAUSE contains the code to
@@ -466,10 +354,6 @@ void setup()
 	MSGMNI = min(nr_msgqs, NR_MSGQUEUES);
 }
 
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- *             completion or premature exit.
- ****************************************************************/
 void cleanup()
 {
 	int status;
@@ -488,10 +372,7 @@ void cleanup()
 	}
 
 	fflush(stdout);
-	/*
-	 * print timing stats if that option was specified.
-	 * print errno log if that option was specified.
-	 */
+
 	TEST_CLEANUP;
 	tst_rmdir();
 
diff --git a/testcases/kernel/syscalls/ipc/msgctl/msgctl09.c b/testcases/kernel/syscalls/ipc/msgctl/msgctl09.c
index bec852a..a2a1256 100644
--- a/testcases/kernel/syscalls/ipc/msgctl/msgctl09.c
+++ b/testcases/kernel/syscalls/ipc/msgctl/msgctl09.c
@@ -49,6 +49,7 @@
 #include "test.h"
 #include "usctest.h"
 #include "ipcmsg.h"
+#include "libmsgctl.h"
 
 #define MAXNREPS	1000
 #ifndef CONFIG_COLDFIRE
@@ -57,14 +58,8 @@
 #define MAXNPROCS	 100000	/* Coldfire can't deal with 1000000 */
 #endif
 #define MAXNKIDS	10
-#define FAIL		1
-#define PASS		0
 
 int dotest(key_t, int);
-int doreader(long, int, int);
-int dowriter(long, int, int);
-int fill_buffer(char *, char, int);
-int verify(char *, char, int, int);
 void setup();
 void cleanup();
 
@@ -75,24 +70,14 @@ void cleanup();
 char *TCID = "msgctl09";	/* Test program identifier.    */
 int TST_TOTAL = 1;		/* Total number of test cases. */
 
-int exp_enos[] = { 0 };		/* List must end with 0 */
+static key_t keyarray[MAXNPROCS];
 
-key_t keyarray[MAXNPROCS];
-
-struct {
-	long type;
-	struct {
-		char len;
-		char pbytes[99];
-	} data;
-} buffer;
-
-int pidarray[MAXNPROCS];
-int rkidarray[MAXNKIDS];
-int wkidarray[MAXNKIDS];
-int tid;
-int nprocs, nreps, nkids, MSGMNI;
-int procstat;
+static int pidarray[MAXNPROCS];
+static int rkidarray[MAXNKIDS];
+static int wkidarray[MAXNKIDS];
+static int tid;
+static int nprocs, nreps, nkids, MSGMNI;
+static int procstat;
 void term(int);
 #ifdef UCLINUX
 static char *argv0;
@@ -111,11 +96,9 @@ static int rkid_uclinux;
 void cleanup_msgqueue(int i, int tid);
 
 /*-----------------------------------------------------------------*/
-int main(argc, argv)
-int argc;
-char *argv[];
+int main(int argc, char **argv)
 {
-	register int i, j, ok, pid;
+	int i, j, ok, pid;
 	int count, status;
 
 #ifdef UCLINUX
@@ -280,13 +263,15 @@ void do_child_1_uclinux()
 void do_child_2_uclinux()
 {
 	procstat = 2;
-	exit(doreader(key_uclinux, pid_uclinux, child_process_uclinux));
+	exit(doreader(key_uclinux, tid, pid_uclinux,
+			child_process_uclinux, nreps));
 }
 
 void do_child_3_uclinux()
 {
 	procstat = 2;
-	exit(dowriter(key_uclinux, rkid_uclinux, child_process_uclinux));
+	exit(dowriter(key_uclinux, tid, rkid_uclinux,
+			child_process_uclinux, nreps));
 }
 #endif
 
@@ -313,18 +298,16 @@ void cleanup_msgqueue(int i, int tid)
 	}
 }
 
-int dotest(key, child_process)
-key_t key;
-int child_process;
+int dotest(key_t key, int child_process)
 {
 	int id, pid;
 	int i, count, status, exit_status;
 
 	sighold(SIGTERM);
 	if ((id = msgget(key, IPC_CREAT | S_IRUSR | S_IWUSR)) < 0) {
-		tst_resm(TFAIL | TERRNO, "Msgget error in child %d",
-			 child_process);
-		tst_exit();
+		printf("msgget() error in child %d: %s\n",
+			child_process, strerror(errno));
+		return FAIL;
 	}
 	tid = id;
 	sigrelse(SIGTERM);
@@ -334,58 +317,56 @@ int child_process;
 	for (i = 0; i < nkids; i++) {
 		fflush(stdout);
 		if ((pid = FORK_OR_VFORK()) < 0) {
-			tst_resm(TWARN,
-				 "Fork failure in first child of child group %d",
-				 child_process);
+			printf("Fork failure in the first child of child group %d\n",
+				child_process);
 			cleanup_msgqueue(i, tid);
-			tst_exit();
+			return FAIL;
 		}
 		/* First child does this */
 		if (pid == 0) {
 #ifdef UCLINUX
 			if (self_exec(argv0, "nddd", 2, key, getpid(),
 				      child_process) < 0) {
-				tst_resm(TWARN, "self_exec failed");
+				printf("self_exec failed\n");
 				cleanup_msgqueue(i, tid);
-				tst_exit();
+				return FAIL;
 			}
 #else
 			procstat = 2;
-			exit(doreader(key, getpid(), child_process));
+			exit(doreader(key, tid, getpid(), child_process, nreps));
 #endif
 		}
 		rkidarray[i] = pid;
 		fflush(stdout);
 		if ((pid = FORK_OR_VFORK()) < 0) {
-			tst_resm(TWARN,
-				 "Fork failure in first child of child group %d",
-				 child_process);
+			printf("Fork failure in the second child of child group %d\n",
+				child_process);
 			/*
 			 * Kill the reader child process
 			 */
 			(void)kill(rkidarray[i], SIGKILL);
 
 			cleanup_msgqueue(i, tid);
-			tst_exit();
+			return FAIL;
 		}
 		/* Second child does this */
 		if (pid == 0) {
 #ifdef UCLINUX
 			if (self_exec(argv0, "nddd", 3, key, rkidarray[i],
 				      child_process) < 0) {
-				tst_resm(TWARN, "\tFork failure in first child "
-					 "of child group %d \n", child_process);
+				printf("\tFork failure in the first child of child group %d\n",
+					child_process);
 				/*
 				 * Kill the reader child process
 				 */
 				(void)kill(rkidarray[i], SIGKILL);
 
 				cleanup_msgqueue(i, tid);
-				tst_exit();
+				return FAIL;
 			}
 #else
 			procstat = 2;
-			exit(dowriter(key, rkidarray[i], child_process));
+			exit(dowriter(key, tid, rkidarray[i], child_process, nreps));
 #endif
 		}
 		wkidarray[i] = pid;
@@ -395,18 +376,17 @@ int child_process;
 	while (1) {
 		if ((wait(&status)) > 0) {
 			if (status >> 8 != PASS) {
-				tst_resm(TFAIL,
-					 "Child exit status = %d from child group %d",
-					 status >> 8, child_process);
+				printf("Child exit status = %d from child group %d\n",
+					status >> 8, child_process);
 				for (i = 0; i < nkids; i++) {
 					kill(rkidarray[i], SIGTERM);
 					kill(wkidarray[i], SIGTERM);
 				}
 				if (msgctl(tid, IPC_RMID, 0) < 0) {
-					tst_resm(TFAIL | TERRNO,
-						 "Msgctl error");
+					printf("msgctl() error: %s\n",
+						strerror(errno));
 				}
-				tst_exit();
+				return FAIL;
 			}
 			count++;
 		} else {
@@ -417,142 +397,19 @@ int child_process;
 	}
 	/* Make sure proper number of children exited */
 	if (count != (nkids * 2)) {
-		tst_resm(TFAIL,
-			 "Wrong number of children exited in child group %d, Saw %d Expected %d",
-			 child_process, count, (nkids * 2));
+		printf("Wrong number of children exited in child group %d, saw %d, expected %d\n",
+			child_process, count, (nkids * 2));
 		if (msgctl(tid, IPC_RMID, 0) < 0) {
-			tst_resm(TFAIL | TERRNO, "Msgctl error");
+			printf("msgctl() error: %s\n", strerror(errno));
 		}
-		tst_exit();
+		return FAIL;
 	}
 	if (msgctl(id, IPC_RMID, 0) < 0) {
-		tst_resm(TFAIL | TERRNO, "Msgctl failure in child group %d",
-			 child_process);
-		tst_exit();
-	}
-	exit(exit_status);
-}
-
-int doreader(key, type, child)
-int type, child;
-long key;
-{
-	int i, size;
-	int id;
-
-	if ((id = msgget(key, 0)) < 0) {
-		tst_resm(TFAIL | TERRNO,
-			 "Msgget error in reader of child group %d", child);
-		tst_exit();
-	}
-	if (id != tid) {
-		tst_resm(TFAIL,
-			 "Message queue mismatch in reader of child group %d for message queue id %d",
-			 child, id);
-		tst_exit();
-	}
-	for (i = 0; i < nreps; i++) {
-		if ((size = msgrcv(id, &buffer, 100, type, 0)) < 0) {
-			tst_resm(TFAIL | TERRNO,
-				 "Msgrcv error in child %d, read # = %d",
-				 (i + 1), child);
-			tst_exit();
-		}
-		if (buffer.type != type) {
-			tst_resm(TFAIL,
-				 "Size mismatch in child %d, read # = %d",
-				 child, (i + 1));
-			tst_resm(TFAIL,
-				 "\tfor message size got  %d expected  %d",
-				 size, buffer.data.len);
-			tst_exit();
-		}
-		if (buffer.data.len + 1 != size) {
-			tst_resm(TFAIL,
-				 "Size mismatch in child %d, read # = %d, size = %d, expected = %d",
-				 child, (i + 1), buffer.data.len, size);
-			tst_exit();
-		}
-		if (verify(buffer.data.pbytes, (key % 255), size - 1, child)) {
-			tst_resm(TFAIL, "in child %d read # = %d,key =  %lx",
-				 child, (i + 1), key);
-			tst_exit();
-		}
-		key++;
-	}
-	exit(PASS);
-}
-
-int dowriter(key, type, child)
-int type, child;
-long key;
-{
-	int i, size;
-	int id;
-
-	if ((id = msgget(key, 0)) < 0) {
-		tst_resm(TFAIL | TERRNO,
-			 "Msgget error in writer of child group %d", child);
-		tst_exit();
-	}
-	if (id != tid) {
-		tst_resm(TFAIL,
-			 "Message queue mismatch in writer of child group %d",
-			 child);
-		tst_resm(TFAIL, "\tfor message queue id %d expected  %d", id,
-			 tid);
-		tst_exit();
-	}
-
-	for (i = 0; i < nreps; i++) {
-		do {
-			size = (lrand48() % 99);
-		} while (size == 0);
-		fill_buffer(buffer.data.pbytes, (key % 255), size);
-		buffer.data.len = size;
-		buffer.type = type;
-		if (msgsnd(id, &buffer, size + 1, 0) < 0) {
-			tst_resm(TFAIL | TERRNO,
-				 "Msgsnd error in child %d, key =   %lx",
-				 child, key);
-			tst_exit();
-		}
-		key++;
+		printf("msgctl() failure in child group %d: %s\n",
+			child_process, strerror(errno));
+		return FAIL;
 	}
-	exit(PASS);
-}
-
-int fill_buffer(buf, val, size)
-register char *buf;
-char val;
-register int size;
-{
-	register int i;
-
-	for (i = 0; i < size; i++)
-		buf[i] = val;
-	return 0;
-}
-
-/*
- * verify()
- *	Check a buffer for correct values.
- */
-
-int verify(buf, val, size, child)
-register char *buf;
-char val;
-register int size;
-int child;
-{
-	while (size-- > 0)
-		if (*buf++ != val) {
-			tst_resm(TWARN,
-				 "Verify error in child %d, *buf = %x, val = %x, size = %d",
-				 child, *buf, val, size);
-			return (FAIL);
-		}
-	return (PASS);
+	return exit_status;
 }
 
 /* ARGSUSED */
@@ -567,9 +424,8 @@ void term(int sig)
 		for (i = 0; i < nprocs; i++) {
 			if (pidarray[i] > 0) {
 				if (kill(pidarray[i], SIGTERM) < 0) {
-					tst_resm(TBROK,
-						 "Kill failed to kill child %d",
-						 i);
+					printf("Kill failed to kill child %d",
+						i);
 					exit(FAIL);
 				}
 			}
@@ -593,17 +449,12 @@ void term(int sig)
 	}
 }
 
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- *****************************************************************/
 void setup()
 {
 	int nr_msgqs;
 
 	tst_tmpdir();
-	/* You will want to enable some signal handling so you can capture
-	 * unexpected signals like SIGSEGV.
-	 */
+
 	tst_sig(FORK, DEF_HANDLER, cleanup);
 
 	/* One cavet that hasn't been fixed yet.  TEST_PAUSE contains the code to
@@ -631,17 +482,10 @@ void setup()
 	MSGMNI = min(nr_msgqs, NR_MSGQUEUES);
 }
 
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ****************************************************************/
 void cleanup()
 {
 	int status;
-	/*
-	 * print timing stats if that option was specified.
-	 * print errno log if that option was specified.
-	 */
+
 	TEST_CLEANUP;
 
 	/*
diff --git a/testcases/kernel/syscalls/ipc/msgctl/msgctl10.c b/testcases/kernel/syscalls/ipc/msgctl/msgctl10.c
index 895a319..20d209e 100644
--- a/testcases/kernel/syscalls/ipc/msgctl/msgctl10.c
+++ b/testcases/kernel/syscalls/ipc/msgctl/msgctl10.c
@@ -52,6 +52,7 @@
 #include "test.h"
 #include "usctest.h"
 #include "ipcmsg.h"
+#include "libmsgctl.h"
 
 void setup();
 void cleanup();
@@ -62,34 +63,18 @@ void cleanup();
 char *TCID = "msgctl10";	/* Test program identifier.    */
 int TST_TOTAL = 1;		/* Total number of test cases. */
 
-int exp_enos[] = { 0 };		/* List must end with 0 */
-
 #define MAXNPROCS	10000	/*These should be sufficient */
 #define MAXNREPS	10000	/*Else they srewup the system un-necessarily */
-#define FAIL		1
-#define PASS		0
 
 key_t keyarray[MAXNPROCS];
 
-struct {
-	long type;
-	struct {
-		char len;
-		char pbytes[99];
-	} data;
-} buffer;
-
-int pidarray[MAXNPROCS];
-int tid;
-int MSGMNI, nprocs, nreps;
-int procstat;
-int dotest(key_t key, int child_process);
-int doreader(int id, long key, int child);
-int dowriter(int id, long key, int child);
-int fill_buffer(register char *buf, char val, register int size);
-int verify(register char *buf, char val, register int size, int child);
+static int pidarray[MAXNPROCS];
+static int tid;
+static int MSGMNI, nprocs, nreps;
+static int procstat;
+static int dotest(key_t key, int child_process);
 void sig_handler();		/* signal catching function */
-int mykid;
+static int mykid;
 #ifdef UCLINUX
 static char *argv0;
 
@@ -103,11 +88,9 @@ static int child_process_uclinux;
 #endif
 
 /*-----------------------------------------------------------------*/
-int main(argc, argv)
-int argc;
-char *argv[];
+int main(int argc, char **argv)
 {
-	register int i, j, ok, pid;
+	int i, j, ok, pid;
 	int count, status;
 	struct sigaction act;
 
@@ -159,7 +142,7 @@ char *argv[];
 	srand(getpid());
 	tid = -1;
 
-	/* Setup signal handleing routine */
+	/* Setup signal handling routine */
 	memset(&act, 0, sizeof(act));
 	act.sa_handler = sig_handler;
 	sigemptyset(&act.sa_mask);
@@ -260,177 +243,82 @@ void do_child_1_uclinux()
 
 void do_child_2_uclinux()
 {
-	exit(doreader(id_uclinux, key_uclinux % 255, child_process_uclinux));
+	exit(doreader(key_uclinux, id_uclinux, 1, child_process_uclinux, nreps));
 }
 #endif
 
-int dotest(key, child_process)
-key_t key;
-int child_process;
+int dotest(key_t key, int child_process)
 {
 	int id, pid;
+	int ret, status;
 
 	sighold(SIGTERM);
 	TEST(msgget(key, IPC_CREAT | S_IRUSR | S_IWUSR));
 	if (TEST_RETURN < 0) {
-		tst_resm(TFAIL | TTERRNO, "Msgget error in child %d",
-			 child_process);
-		tst_exit();
+		printf("msgget() error in child %d: %s\n",
+			child_process, strerror(TEST_ERRNO));
+		return FAIL;
 	}
 	tid = id = TEST_RETURN;
 	sigrelse(SIGTERM);
 
 	fflush(stdout);
 	if ((pid = FORK_OR_VFORK()) < 0) {
-		tst_resm(TWARN, "\tFork failed (may be OK if under stress)");
+		printf("Fork failed (may be OK if under stress)\n");
 		TEST(msgctl(tid, IPC_RMID, 0));
 		if (TEST_RETURN < 0) {
-			tst_resm(TFAIL | TTERRNO, "Msgctl error in cleanup");
+			printf("msgctl() error in cleanup: %s\n",
+				strerror(TEST_ERRNO));
 		}
-		tst_exit();
+		return FAIL;
 	}
 	/* Child does this */
 	if (pid == 0) {
 #ifdef UCLINUX
 		if (self_exec(argv0, "nddd", 2, id, key, child_process) < 0) {
-			tst_resm(TWARN, "self_exec failed");
+			printf("self_exec failed\n");
 			TEST(msgctl(tid, IPC_RMID, 0));
 			if (TEST_RETURN < 0) {
-				tst_resm(TFAIL | TTERRNO,
-					 "Msgctl error in cleanup");
+				printf("msgctl() error in cleanup: %s\n",
+					strerror(TEST_ERRNO));
 			}
-			tst_exit();
+			return FAIL;
 		}
 #else
-		exit(doreader(id, key % 255, child_process));
+		exit(doreader(key, id, 1, child_process, nreps));
 #endif
 	}
 	/* Parent does this */
 	mykid = pid;
 	procstat = 2;
-	dowriter(id, key % 255, child_process);
-	wait(0);
-	TEST(msgctl(id, IPC_RMID, 0));
-	if (TEST_RETURN < 0) {
-		tst_resm(TFAIL | TTERRNO, "msgctl failed");
-		tst_exit();
-	}
-	exit(PASS);
-}
-
-int doreader(int id, long key, int child)
-{
-	int i, size;
-
-	for (i = 0; i < nreps; i++) {
-		if ((size = msgrcv(id, &buffer, 100, 0, 0)) < 0) {
-			tst_brkm(TBROK | TERRNO, cleanup,
-				 "Msgrcv error in child %d, read # = %d",
-				 (i + 1), child);
-			tst_exit();
-		}
-		if (buffer.data.len + 1 != size) {
-			tst_resm(TFAIL,
-				 "Size mismatch in child %d, read # = %d",
-				 child, (i + 1));
-			tst_resm(TFAIL,
-				 "for message size got  %d expected  %d",
-				 size, buffer.data.len);
-			tst_exit();
-		}
-		if (verify(buffer.data.pbytes, key, size - 1, child)) {
-			tst_resm(TFAIL, "in child %d read # = %d,key =  %lx",
-				 child, (i + 1), key);
-			tst_exit();
-		}
-		key++;
-	}
-	return (0);
-}
-
-int dowriter(id, key, child)
-int id, child;
-long key;
-{
-	int i, size;
+	ret = dowriter(key, id, 1, child_process, nreps);
+	wait(&status);
 
-	for (i = 0; i < nreps; i++) {
-		do {
-			size = (rand() % 99);
-		} while (size == 0);
-		fill_buffer(buffer.data.pbytes, key, size);
-		buffer.data.len = size;
-		buffer.type = 1;
-		TEST(msgsnd(id, &buffer, size + 1, 0));
-		if (TEST_RETURN < 0) {
-			tst_brkm(TBROK | TTERRNO, cleanup,
-				 "Msgsnd error in child %d, key =   %lx",
-				 child, key);
-		}
-		key++;
-	}
-	return (0);
-}
+	if (ret != PASS)
+		exit(FAIL);
 
-int fill_buffer(buf, val, size)
-register char *buf;
-char val;
-register int size;
-{
-	register int i;
+	if ((!WIFEXITED(status) || (WEXITSTATUS(status) != PASS)))
+		exit(FAIL);
 
-	for (i = 0; i < size; i++) {
-		buf[i] = val;
-	}
-
-	return (0);
-}
-
-/*
- * verify()
- *	Check a buffer for correct values.
- */
-
-int verify(buf, val, size, child)
-register char *buf;
-char val;
-register int size;
-int child;
-{
-	while (size-- > 0) {
-		if (*buf++ != val) {
-			tst_resm(TWARN,
-				 "Verify error in child %d, *buf = %x, val = %x, size = %d",
-				 child, *buf, val, size);
-			return (FAIL);
-		}
+	TEST(msgctl(id, IPC_RMID, 0));
+	if (TEST_RETURN < 0) {
+		printf("msgctl() failed: %s\n",
+			strerror(TEST_ERRNO));
+		return FAIL;
 	}
-	return (PASS);
+	return PASS;
 }
 
-/*
- *  * void
- *  * sig_handler() - signal catching function for 'SIGUSR1' signal.
- *  *
- *  *   This is a null function and used only to catch the above signal
- *  *   generated in parent process.
- *  */
 void sig_handler()
 {
 }
 
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- *****************************************************************/
 void setup()
 {
 	int nr_msgqs;
 
 	tst_tmpdir();
 
-	/* You will want to enable some signal handling so you can capture
-	 * unexpected signals like SIGSEGV.
-	 */
 	tst_sig(FORK, DEF_HANDLER, cleanup);
 
 	/* One cavet that hasn't been fixed yet.  TEST_PAUSE contains the code to
@@ -453,10 +341,6 @@ void setup()
 	}
 }
 
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- *             completion or premature exit.
- ****************************************************************/
 void cleanup()
 {
 	int status;
@@ -475,11 +359,7 @@ void cleanup()
 	}
 
 	fflush(stdout);
-	/*
-	 * print timing stats if that option was specified.
-	 * print errno log if that option was specified.
-	 */
+
 	TEST_CLEANUP;
 	tst_rmdir();
-
 }
diff --git a/testcases/kernel/syscalls/ipc/msgctl/msgctl11.c b/testcases/kernel/syscalls/ipc/msgctl/msgctl11.c
index 82ad2d3..9746e0d 100644
--- a/testcases/kernel/syscalls/ipc/msgctl/msgctl11.c
+++ b/testcases/kernel/syscalls/ipc/msgctl/msgctl11.c
@@ -50,6 +50,7 @@
 #include "test.h"
 #include "usctest.h"
 #include "ipcmsg.h"
+#include "libmsgctl.h"
 #include "system_specific_process_info.h"
 
 #define MAXNREPS	1000
@@ -59,14 +60,8 @@
 #define MAXNPROCS	 100000	/* Coldfire can't deal with 1000000 */
 #endif
 #define MAXNKIDS	10
-#define FAIL		1
-#define PASS		0
 
 int dotest(key_t, int);
-int doreader(long, int, int);
-int dowriter(long, int, int);
-int fill_buffer(char *, char, int);
-int verify(char *, char, int, int);
 void setup();
 void cleanup();
 
@@ -77,26 +72,16 @@ void cleanup();
 char *TCID = "msgctl11";	/* Test program identifier.    */
 int TST_TOTAL = 1;		/* Total number of test cases. */
 
-int exp_enos[] = { 0 };		/* List must end with 0 */
+static int maxnkids = MAXNKIDS;	/* Used if pid_max is exceeded */
 
-int maxnkids = MAXNKIDS;	/* Used if pid_max is exceeded */
+static key_t keyarray[MAXNPROCS];
 
-key_t keyarray[MAXNPROCS];
-
-struct {
-	long type;
-	struct {
-		char len;
-		char pbytes[99];
-	} data;
-} buffer;
-
-int pidarray[MAXNPROCS];
-int rkidarray[MAXNKIDS];
-int wkidarray[MAXNKIDS];
-int tid;
-int nprocs, nreps, nkids, MSGMNI;
-int procstat;
+static int pidarray[MAXNPROCS];
+static int rkidarray[MAXNKIDS];
+static int wkidarray[MAXNKIDS];
+static int tid;
+static int nprocs, nreps, nkids, MSGMNI;
+static int procstat;
 void term(int);
 #ifdef UCLINUX
 static char *argv0;
@@ -115,11 +100,9 @@ static int rkid_uclinux;
 void cleanup_msgqueue(int i, int tid);
 
 /*-----------------------------------------------------------------*/
-int main(argc, argv)
-int argc;
-char *argv[];
+int main(int argc, char **argv)
 {
-	register int i, j, ok, pid;
+	int i, j, ok, pid;
 	int count, status;
 
 #ifdef UCLINUX
@@ -284,13 +267,15 @@ void do_child_1_uclinux()
 void do_child_2_uclinux()
 {
 	procstat = 2;
-	exit(doreader(key_uclinux, pid_uclinux, child_process_uclinux));
+	exit(doreader(key_uclinux, tid, pid_uclinux,
+			child_process_uclinux, nreps));
 }
 
 void do_child_3_uclinux()
 {
 	procstat = 2;
-	exit(dowriter(key_uclinux, rkid_uclinux, child_process_uclinux));
+	exit(dowriter(key_uclinux, tid, rkid_uclinux,
+			child_process_uclinux, nreps));
 }
 #endif
 
@@ -317,18 +302,16 @@ void cleanup_msgqueue(int i, int tid)
 	}
 }
 
-int dotest(key, child_process)
-key_t key;
-int child_process;
+int dotest(key_t key, int child_process)
 {
 	int id, pid;
 	int i, count, status, exit_status;
 
 	sighold(SIGTERM);
 	if ((id = msgget(key, IPC_CREAT | S_IRUSR | S_IWUSR)) < 0) {
-		tst_resm(TFAIL | TERRNO, "Msgget error in child %d",
-			 child_process);
-		tst_exit();
+		printf("msgget() error in child %d: %s\n",
+			child_process, strerror(errno));
+		return FAIL;
 	}
 	tid = id;
 	sigrelse(SIGTERM);
@@ -338,58 +321,56 @@ int child_process;
 	for (i = 0; i < nkids; i++) {
 		fflush(stdout);
 		if ((pid = FORK_OR_VFORK()) < 0) {
-			tst_resm(TWARN,
-				 "Fork failure in first child of child group %d",
-				 child_process);
+			printf("Fork failure in the first child of child group %d\n",
+				child_process);
 			cleanup_msgqueue(i, tid);
-			tst_exit();
+			return FAIL;
 		}
 		/* First child does this */
 		if (pid == 0) {
 #ifdef UCLINUX
 			if (self_exec(argv0, "nddd", 2, key, getpid(),
 				      child_process) < 0) {
-				tst_resm(TWARN, "self_exec failed");
+				printf("self_exec failed\n");
 				cleanup_msgqueue(i, tid);
-				tst_exit();
+				return FAIL;
 			}
 #else
 			procstat = 2;
-			exit(doreader(key, getpid(), child_process));
+			exit(doreader(key, tid, getpid(), child_process, nreps));
 #endif
 		}
 		rkidarray[i] = pid;
 		fflush(stdout);
 		if ((pid = FORK_OR_VFORK()) < 0) {
-			tst_resm(TWARN,
-				 "Fork failure in first child of child group %d",
-				 child_process);
+			printf("Fork failure in the second child of child group %d\n",
+				child_process);
 			/*
 			 * Kill the reader child process
 			 */
 			(void)kill(rkidarray[i], SIGKILL);
 
 			cleanup_msgqueue(i, tid);
-			tst_exit();
+			return FAIL;
 		}
 		/* Second child does this */
 		if (pid == 0) {
 #ifdef UCLINUX
 			if (self_exec(argv0, "nddd", 3, key, rkidarray[i],
 				      child_process) < 0) {
-				tst_resm(TWARN, "\tFork failure in first child "
-					 "of child group %d \n", child_process);
+				printf("\tFork failure in the first child of child group %d\n",
+					child_process);
 				/*
 				 * Kill the reader child process
 				 */
 				(void)kill(rkidarray[i], SIGKILL);
 
 				cleanup_msgqueue(i, tid);
-				tst_exit();
+				return FAIL;
 			}
 #else
 			procstat = 2;
-			exit(dowriter(key, rkidarray[i], child_process));
+			exit(dowriter(key, tid, rkidarray[i], child_process, nreps));
 #endif
 		}
 		wkidarray[i] = pid;
@@ -399,18 +380,17 @@ int child_process;
 	while (1) {
 		if ((wait(&status)) > 0) {
 			if (status >> 8 != PASS) {
-				tst_resm(TFAIL,
-					 "Child exit status = %d from child group %d",
-					 status >> 8, child_process);
+				printf("Child exit status = %d from child group %d\n",
+					status >> 8, child_process);
 				for (i = 0; i < nkids; i++) {
 					kill(rkidarray[i], SIGTERM);
 					kill(wkidarray[i], SIGTERM);
 				}
 				if (msgctl(tid, IPC_RMID, 0) < 0) {
-					tst_resm(TFAIL | TERRNO,
-						 "Msgctl error");
+					printf("msgctl() error: %s\n",
+						strerror(errno));
 				}
-				tst_exit();
+				return FAIL;
 			}
 			count++;
 		} else {
@@ -421,142 +401,19 @@ int child_process;
 	}
 	/* Make sure proper number of children exited */
 	if (count != (nkids * 2)) {
-		tst_resm(TFAIL,
-			 "Wrong number of children exited in child group %d, Saw %d Expected %d",
-			 child_process, count, (nkids * 2));
+		printf("Wrong number of children exited in child group %d, saw %d, expected %d\n",
+			child_process, count, (nkids * 2));
 		if (msgctl(tid, IPC_RMID, 0) < 0) {
-			tst_resm(TFAIL | TERRNO, "Msgctl error");
+			printf("msgctl() error: %s\n", strerror(errno));
 		}
-		tst_exit();
+		return FAIL;
 	}
 	if (msgctl(id, IPC_RMID, 0) < 0) {
-		tst_resm(TFAIL | TERRNO, "Msgctl failure in child group %d",
-			 child_process);
-		tst_exit();
-	}
-	exit(exit_status);
-}
-
-int doreader(key, type, child)
-int type, child;
-long key;
-{
-	int i, size;
-	int id;
-
-	if ((id = msgget(key, 0)) < 0) {
-		tst_resm(TFAIL | TERRNO,
-			 "Msgget error in reader of child group %d", child);
-		tst_exit();
-	}
-	if (id != tid) {
-		tst_resm(TFAIL,
-			 "Message queue mismatch in reader of child group %d for message queue id %d",
-			 child, id);
-		tst_exit();
-	}
-	for (i = 0; i < nreps; i++) {
-		if ((size = msgrcv(id, &buffer, 100, type, 0)) < 0) {
-			tst_resm(TFAIL | TERRNO,
-				 "Msgrcv error in child %d, read # = %d",
-				 (i + 1), child);
-			tst_exit();
-		}
-		if (buffer.type != type) {
-			tst_resm(TFAIL,
-				 "Size mismatch in child %d, read # = %d",
-				 child, (i + 1));
-			tst_resm(TFAIL,
-				 "\tfor message size got  %d expected  %d",
-				 size, buffer.data.len);
-			tst_exit();
-		}
-		if (buffer.data.len + 1 != size) {
-			tst_resm(TFAIL,
-				 "Size mismatch in child %d, read # = %d, size = %d, expected = %d",
-				 child, (i + 1), buffer.data.len, size);
-			tst_exit();
-		}
-		if (verify(buffer.data.pbytes, (key % 255), size - 1, child)) {
-			tst_resm(TFAIL, "in child %d read # = %d,key =  %lx",
-				 child, (i + 1), key);
-			tst_exit();
-		}
-		key++;
-	}
-	exit(PASS);
-}
-
-int dowriter(key, type, child)
-int type, child;
-long key;
-{
-	int i, size;
-	int id;
-
-	if ((id = msgget(key, 0)) < 0) {
-		tst_resm(TFAIL | TERRNO,
-			 "Msgget error in writer of child group %d", child);
-		tst_exit();
-	}
-	if (id != tid) {
-		tst_resm(TFAIL,
-			 "Message queue mismatch in writer of child group %d",
-			 child);
-		tst_resm(TFAIL, "\tfor message queue id %d expected  %d", id,
-			 tid);
-		tst_exit();
-	}
-
-	for (i = 0; i < nreps; i++) {
-		do {
-			size = (lrand48() % 99);
-		} while (size == 0);
-		fill_buffer(buffer.data.pbytes, (key % 255), size);
-		buffer.data.len = size;
-		buffer.type = type;
-		if (msgsnd(id, &buffer, size + 1, 0) < 0) {
-			tst_resm(TFAIL | TERRNO,
-				 "Msgsnd error in child %d, key =   %lx",
-				 child, key);
-			tst_exit();
-		}
-		key++;
+		printf("msgctl() failure in child group %d: %s\n",
+			child_process, strerror(errno));
+		return FAIL;
 	}
-	exit(PASS);
-}
-
-int fill_buffer(buf, val, size)
-register char *buf;
-char val;
-register int size;
-{
-	register int i;
-
-	for (i = 0; i < size; i++)
-		buf[i] = val;
-	return 0;
-}
-
-/*
- * verify()
- *	Check a buffer for correct values.
- */
-
-int verify(buf, val, size, child)
-register char *buf;
-char val;
-register int size;
-int child;
-{
-	while (size-- > 0)
-		if (*buf++ != val) {
-			tst_resm(TWARN,
-				 "Verify error in child %d, *buf = %x, val = %x, size = %d",
-				 child, *buf, val, size);
-			return (FAIL);
-		}
-	return (PASS);
+	return exit_status;
 }
 
 /* ARGSUSED */
@@ -597,9 +454,6 @@ void term(int sig)
 	}
 }
 
-/***************************************************************
- * setup() - performs all ONE TIME setup for this test.
- *****************************************************************/
 void setup()
 {
 	int nr_msgqs, free_pids;
@@ -649,17 +503,10 @@ void setup()
 	tst_resm(TINFO, "Using upto %d pids", free_pids / 2);
 }
 
-/***************************************************************
- * cleanup() - performs all ONE TIME cleanup for this test at
- * completion or premature exit.
- ****************************************************************/
 void cleanup()
 {
 	int status;
-	/*
-	 * print timing stats if that option was specified.
-	 * print errno log if that option was specified.
-	 */
+
 	TEST_CLEANUP;
 
 	/*
-- 
1.7.1


------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [LTP] [PATCH] msgctl{08, 09, 10, 11}: cleanup
  2013-10-18  9:12 ` [LTP] [PATCH] msgctl{08, 09, 10, 11}: cleanup Stanislav Kholmanskikh
@ 2013-10-21 12:57   ` chrubis
       [not found]     ` <5268FDE5.5010408@oracle.com>
  0 siblings, 1 reply; 7+ messages in thread
From: chrubis @ 2013-10-21 12:57 UTC (permalink / raw)
  To: Stanislav Kholmanskikh; +Cc: vasily.isaenko, ltp-list

Hi!
> diff --git a/testcases/kernel/syscalls/ipc/msgctl/Makefile b/testcases/kernel/syscalls/ipc/msgctl/Makefile
> index f467389..ae61b51 100644
> --- a/testcases/kernel/syscalls/ipc/msgctl/Makefile
> +++ b/testcases/kernel/syscalls/ipc/msgctl/Makefile
> @@ -18,6 +18,15 @@
>  
>  top_srcdir              ?= ../../../../..
>  
> +FILTER_OUT_MAKE_TARGETS	:= libmsgctl
> +
>  include $(top_srcdir)/include/mk/testcases.mk
>  include $(abs_srcdir)/../Makefile.inc
>  include $(top_srcdir)/include/mk/generic_leaf_target.mk
> +
> +SRCS			?= $(wildcard $(abs_srcdir)/*.c)
> +OBJS			:= $(notdir $(patsubst %.c,%.o,$(SRCS)))
> +.INTERMEDIATE: $(OBJS)
> +
> +$(MAKE_TARGETS): %: %.o libmsgctl.o
> +libmsgctl.o: libmsgctl.h
> diff --git a/testcases/kernel/syscalls/ipc/msgctl/libmsgctl.c b/testcases/kernel/syscalls/ipc/msgctl/libmsgctl.c
> new file mode 100644
> index 0000000..fa77b56

This is too hacky what about building .a library instead as it's done in
testcases/kernel/mem/lib ?

I've looked into the lib.mk and it looks like you don't even have to put
the lib in the separate directory if you set LIBSRC in the corresponding
Makefile.

I should really make some time to write more documentation for the most
common build system usages....

> diff --git a/testcases/kernel/syscalls/ipc/msgctl/msgctl08.c b/testcases/kernel/syscalls/ipc/msgctl/msgctl08.c
> index f733946..8d7e431 100644
> --- a/testcases/kernel/syscalls/ipc/msgctl/msgctl08.c
> +++ b/testcases/kernel/syscalls/ipc/msgctl/msgctl08.c
> @@ -51,6 +51,7 @@
>  #include "test.h"
>  #include "usctest.h"
>  #include "ipcmsg.h"
> +#include "libmsgctl.h"
>  
>  void setup();
>  void cleanup();

Can you add void to all functions that take no parameters? (Otherwise
the compiler thinks that they take unspecified number of integer
parameters...)

> @@ -61,38 +62,22 @@ void cleanup();
>  char *TCID = "msgctl08";	/* Test program identifier.    */
>  int TST_TOTAL = 1;		/* Total number of test cases. */

Can you please also remove useless comments as:

/* Test program identifier.    */

/* Total number of test cases. */

/*
 *  *  *  * These globals must be defined in the test.
  *   *   *   */

/*--------------------------------------------------------------------*/

And similar?


-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [LTP] [PATCH] msgctl{08, 09, 10, 11}: cleanup
       [not found]     ` <5268FDE5.5010408@oracle.com>
@ 2013-10-24 11:10       ` chrubis
  2013-10-24 12:16       ` chrubis
  1 sibling, 0 replies; 7+ messages in thread
From: chrubis @ 2013-10-24 11:10 UTC (permalink / raw)
  To: Stanislav Kholmanskikh; +Cc: vasily.isaenko, ltp-list

Hi!
> >> diff --git a/testcases/kernel/syscalls/ipc/msgctl/Makefile b/testcases/kernel/syscalls/ipc/msgctl/Makefile
> >> index f467389..ae61b51 100644
> >> --- a/testcases/kernel/syscalls/ipc/msgctl/Makefile
> >> +++ b/testcases/kernel/syscalls/ipc/msgctl/Makefile
> >> @@ -18,6 +18,15 @@
> >>   
> >>   top_srcdir              ?= ../../../../..
> >>   
> >> +FILTER_OUT_MAKE_TARGETS	:= libmsgctl
> >> +
> >>   include $(top_srcdir)/include/mk/testcases.mk
> >>   include $(abs_srcdir)/../Makefile.inc
> >>   include $(top_srcdir)/include/mk/generic_leaf_target.mk
> >> +
> >> +SRCS			?= $(wildcard $(abs_srcdir)/*.c)
> >> +OBJS			:= $(notdir $(patsubst %.c,%.o,$(SRCS)))
> >> +.INTERMEDIATE: $(OBJS)
> >> +
> >> +$(MAKE_TARGETS): %: %.o libmsgctl.o
> >> +libmsgctl.o: libmsgctl.h
> >> diff --git a/testcases/kernel/syscalls/ipc/msgctl/libmsgctl.c b/testcases/kernel/syscalls/ipc/msgctl/libmsgctl.c
> >> new file mode 100644
> >> index 0000000..fa77b56
> > This is too hacky what about building .a library instead as it's done in
> > testcases/kernel/mem/lib ?
> >
> > I've looked into the lib.mk and it looks like you don't even have to put
> > the lib in the separate directory if you set LIBSRC in the corresponding
> > Makefile.
> 
> Cyril, could you show an example of doing this (placing test case 
> sources and static libraries sources in the same directory), please?
> 
> I tried to do what you said but couldn't manage it :(
> 
> I used this Makefile:
> 
> top_srcdir              ?= ../../../../..
> 
> LIBSRCS := $(abs_srcdir)/libmsgctl.c
> INTERNAL_LIB := libmsgctl.a
> 
> include $(top_srcdir)/include/mk/testcases.mk
> include $(abs_srcdir)/../Makefile.inc
> include $(top_srcdir)/include/mk/generic_leaf_target.mk
> include $(top_srcdir)/include/mk/lib.mk
> 
> And got error:
> ../../../../../include/mk/lib.mk:66: warning: overriding commands for 
> target `../lib/libipc.a'
> /home/stas/ltp/testcases/kernel/syscalls/ipc/msgctl/../Makefile.inc:34: 
> warning: ignoring old commands for target `../lib/libipc.a'
> make: Circular ../lib/libipc.a <- ../lib/libipc.a dependency dropped.
> if [ -z "../lib" ] ; then \
>          echo "Cowardly refusing to create empty archive"; \
>          exit 1; \
>      fi
> ar -rc "../lib/libipc.a" ../lib
> ar: ../lib/libipc.a: Error reading ../lib: Is a directory
> make: *** [../lib/libipc.a] Error 1
> 
> And I think that I found an another issue we should overcome - lib.mk 
> defines MAKE_TARGETS:
> 
> MAKE_TARGETS    := $(LIB)
> 
> generic_leaf_target.mk also does it.
> 
> So It should not be trivial to include both files (lib.mk and 
> generic_leaf_target.mk) into one Makefile.
> I suppose that in that case we have to implicitly define MAKE_TARGETS in 
> our Makefile.
> 
> Not good :(

I will have a look, stay tuned.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [LTP] [PATCH] msgctl{08, 09, 10, 11}: cleanup
       [not found]     ` <5268FDE5.5010408@oracle.com>
  2013-10-24 11:10       ` chrubis
@ 2013-10-24 12:16       ` chrubis
       [not found]         ` <52692C2F.3040903@oracle.com>
  1 sibling, 1 reply; 7+ messages in thread
From: chrubis @ 2013-10-24 12:16 UTC (permalink / raw)
  To: Stanislav Kholmanskikh; +Cc: vasily.isaenko, ltp-list

[-- Attachment #1: Type: text/plain, Size: 3975 bytes --]

Hi!
> >> diff --git a/testcases/kernel/syscalls/ipc/msgctl/Makefile b/testcases/kernel/syscalls/ipc/msgctl/Makefile
> >> index f467389..ae61b51 100644
> >> --- a/testcases/kernel/syscalls/ipc/msgctl/Makefile
> >> +++ b/testcases/kernel/syscalls/ipc/msgctl/Makefile
> >> @@ -18,6 +18,15 @@
> >>   
> >>   top_srcdir              ?= ../../../../..
> >>   
> >> +FILTER_OUT_MAKE_TARGETS	:= libmsgctl
> >> +
> >>   include $(top_srcdir)/include/mk/testcases.mk
> >>   include $(abs_srcdir)/../Makefile.inc
> >>   include $(top_srcdir)/include/mk/generic_leaf_target.mk
> >> +
> >> +SRCS			?= $(wildcard $(abs_srcdir)/*.c)
> >> +OBJS			:= $(notdir $(patsubst %.c,%.o,$(SRCS)))
> >> +.INTERMEDIATE: $(OBJS)
> >> +
> >> +$(MAKE_TARGETS): %: %.o libmsgctl.o
> >> +libmsgctl.o: libmsgctl.h
> >> diff --git a/testcases/kernel/syscalls/ipc/msgctl/libmsgctl.c b/testcases/kernel/syscalls/ipc/msgctl/libmsgctl.c
> >> new file mode 100644
> >> index 0000000..fa77b56
> > This is too hacky what about building .a library instead as it's done in
> > testcases/kernel/mem/lib ?
> >
> > I've looked into the lib.mk and it looks like you don't even have to put
> > the lib in the separate directory if you set LIBSRC in the corresponding
> > Makefile.
> 
> Cyril, could you show an example of doing this (placing test case 
> sources and static libraries sources in the same directory), please?
> 
> I tried to do what you said but couldn't manage it :(
> 
> I used this Makefile:
> 
> top_srcdir              ?= ../../../../..
> 
> LIBSRCS := $(abs_srcdir)/libmsgctl.c
> INTERNAL_LIB := libmsgctl.a
> 
> include $(top_srcdir)/include/mk/testcases.mk
> include $(abs_srcdir)/../Makefile.inc
> include $(top_srcdir)/include/mk/generic_leaf_target.mk
> include $(top_srcdir)/include/mk/lib.mk
> 
> And got error:
> ../../../../../include/mk/lib.mk:66: warning: overriding commands for 
> target `../lib/libipc.a'
> /home/stas/ltp/testcases/kernel/syscalls/ipc/msgctl/../Makefile.inc:34: 
> warning: ignoring old commands for target `../lib/libipc.a'
> make: Circular ../lib/libipc.a <- ../lib/libipc.a dependency dropped.
> if [ -z "../lib" ] ; then \
>          echo "Cowardly refusing to create empty archive"; \
>          exit 1; \
>      fi
> ar -rc "../lib/libipc.a" ../lib
> ar: ../lib/libipc.a: Error reading ../lib: Is a directory
> make: *** [../lib/libipc.a] Error 1

Ah, there is the include $(abs_srcdir)/../Makefile.inc that sets LIB
to ../lib/libipc.a which breaks the lib.mk as there now there are two
rules for making the library. One that runs make in ../lib/ from the
Makefile.inc and second in lib.mk. Renaming the LIB to LIBIPC in
Makefile.inc fixes this one.

> And I think that I found an another issue we should overcome - lib.mk 
> defines MAKE_TARGETS:
> 
> MAKE_TARGETS    := $(LIB)
> 
> generic_leaf_target.mk also does it.
> 
> So It should not be trivial to include both files (lib.mk and 
> generic_leaf_target.mk) into one Makefile.
> I suppose that in that case we have to implicitly define MAKE_TARGETS in 
> our Makefile.

Now this one is more complicated, but solvable.

First of all we need to change the part in lib.mk to

MAKE_TARGETS += $(LIB)

Then define MAKE_TARGETS explicitly in the Makefile (we need that anyway
for lib: tests dependency) and add LDFLAGS and LDLIBS. The full Makefile
looks like:

top_srcdir              ?= ../../../../..
include $(top_srcdir)/include/mk/testcases.mk

LIBSRCS := libmsgctl.c
INTERNAL_LIB := libmsgctl.a
MAKE_TARGETS := $(patsubst %.c,%,$(wildcard msgctl??.c))

$(MAKE_TARGETS): $(INTERNAL_LIB)

LDFLAGS += -L$(abs_builddir)
LDLIBS += -lmsgctl

include $(abs_srcdir)/../Makefile.inc
include $(top_srcdir)/include/mk/lib.mk
include $(top_srcdir)/include/mk/generic_leaf_target.mk

See also attached patch with all the changes and check if that works for
you. If so I will commit change to the lib.mk as separate patch and ask
you to include changes in Makefile.inc in your patchset.

-- 
Cyril Hrubis
chrubis@suse.cz

[-- Attachment #2: build.patch --]
[-- Type: text/x-diff, Size: 1572 bytes --]

diff --git a/include/mk/lib.mk b/include/mk/lib.mk
index 96c08eb..456db24 100644
--- a/include/mk/lib.mk
+++ b/include/mk/lib.mk
@@ -46,7 +46,7 @@ ifneq ($(MAKECMDGOALS),install)
 LIB ?= $(INTERNAL_LIB)
 endif
 
-MAKE_TARGETS	:= $(LIB)
+MAKE_TARGETS	+= $(LIB)
 
 LIBSRCS		?= $(wildcard $(abs_srcdir)/*.c)
 
diff --git a/testcases/kernel/syscalls/ipc/Makefile.inc b/testcases/kernel/syscalls/ipc/Makefile.inc
index a468e93..c7890a9 100644
--- a/testcases/kernel/syscalls/ipc/Makefile.inc
+++ b/testcases/kernel/syscalls/ipc/Makefile.inc
@@ -25,15 +25,15 @@
 LDLIBS			+= -lipc
 LIBDIR			:= ../lib
 
-LIB			:= $(LIBDIR)/libipc.a
+LIBIPC			:= $(LIBDIR)/libipc.a
 
 $(LIBDIR):
 	mkdir -p "$@"
 
-$(LIB): $(LIBDIR)
+$(LIBIPC): $(LIBDIR)
 	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
 
-MAKE_DEPS		:= $(LIB)
+MAKE_DEPS		:= $(LIBIPC)
 
 CPPFLAGS		+= -I$(abs_srcdir)/$(LIBDIR)
 
diff --git a/testcases/kernel/syscalls/ipc/msgctl/Makefile b/testcases/kernel/syscalls/ipc/msgctl/Makefile
index f467389..7f1688b 100644
--- a/testcases/kernel/syscalls/ipc/msgctl/Makefile
+++ b/testcases/kernel/syscalls/ipc/msgctl/Makefile
@@ -17,7 +17,17 @@
 #
 
 top_srcdir              ?= ../../../../..
-
 include $(top_srcdir)/include/mk/testcases.mk
+
+LIBSRCS := libmsgctl.c
+INTERNAL_LIB := libmsgctl.a
+MAKE_TARGETS := $(patsubst %.c,%,$(wildcard msgctl??.c))
+
+$(MAKE_TARGETS): $(INTERNAL_LIB)
+
+LDFLAGS += -L$(abs_builddir)
+LDLIBS += -lmsgctl
+
 include $(abs_srcdir)/../Makefile.inc
+include $(top_srcdir)/include/mk/lib.mk
 include $(top_srcdir)/include/mk/generic_leaf_target.mk

[-- Attachment #3: Type: text/plain, Size: 416 bytes --]

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [LTP] [PATCH] msgctl{08, 09, 10, 11}: cleanup
       [not found]         ` <52692C2F.3040903@oracle.com>
@ 2013-10-24 14:31           ` chrubis
       [not found]             ` <526A2990.2000107@oracle.com>
  0 siblings, 1 reply; 7+ messages in thread
From: chrubis @ 2013-10-24 14:31 UTC (permalink / raw)
  To: Stanislav Kholmanskikh; +Cc: vasily.isaenko, ltp-list

Hi!
> >> And I think that I found an another issue we should overcome - lib.mk
> >> defines MAKE_TARGETS:
> >>
> >> MAKE_TARGETS    := $(LIB)
> >>
> >> generic_leaf_target.mk also does it.
> >>
> >> So It should not be trivial to include both files (lib.mk and
> >> generic_leaf_target.mk) into one Makefile.
> >> I suppose that in that case we have to implicitly define MAKE_TARGETS in
> >> our Makefile.
> > Now this one is more complicated, but solvable.
> >
> > First of all we need to change the part in lib.mk to
> >
> > MAKE_TARGETS += $(LIB)
> >
> > Then define MAKE_TARGETS explicitly in the Makefile (we need that anyway
> > for lib: tests dependency) and add LDFLAGS and LDLIBS. The full Makefile
> > looks like:
> >
> > top_srcdir              ?= ../../../../..
> > include $(top_srcdir)/include/mk/testcases.mk
> >
> > LIBSRCS := libmsgctl.c
> > INTERNAL_LIB := libmsgctl.a
> > MAKE_TARGETS := $(patsubst %.c,%,$(wildcard msgctl??.c))
> >
> > $(MAKE_TARGETS): $(INTERNAL_LIB)
> >
> > LDFLAGS += -L$(abs_builddir)
> > LDLIBS += -lmsgctl
> >
> > include $(abs_srcdir)/../Makefile.inc
> > include $(top_srcdir)/include/mk/lib.mk
> > include $(top_srcdir)/include/mk/generic_leaf_target.mk
> >
> > See also attached patch with all the changes and check if that works for
> > you. If so I will commit change to the lib.mk as separate patch and ask
> > you to include changes in Makefile.inc in your patchset.
> 
> 
> Yes, It works.
> 
> But the compilation is performed as follows:
> 
> gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall 
> -I/home/stas/ltp/testcases/kernel/include 
> -I/home/stas/ltp/testcases/kernel/syscalls/ipc/msgctl/../lib 
> -I../../../../../include -I../../../../../include 
> -I../../../../../include -I../../../../../include 
> -L/home/stas/ltp/testcases/kernel/syscalls/ipc/msgctl 
> -L/home/stas/ltp/testcases/kernel/syscalls/ipc/msgctl/../lib 
> -L../../../../../lib -L../../../../../lib  msgctl01.c libmsgctl.a -lltp 
> -lmsgctl -lipc -o msgctl01
> 
> So gcc 'links' msgctl01.c and libmsgctl.a at once (and additionally is 
> passed -lmsgctl option).

Ah, this one. Let's fix this, the handling of static libraries is too
fragile and this may posibly break on some distribution (from my memory
Ubuntu was the most problematic one).

> How do you think, maybe introduce my favourite .INTERMEDIATE target into 
> Makefile? :)
> 
> Like this:
> 
> MAKE_TARGET_OBJS := $(addsuffix .o,$(MAKE_TARGETS))
> .INTERMEDIATE: $(MAKE_TARGET_OBJS)
> 
> $(MAKE_TARGET_OBJS): $(INTERNAL_LIB)
> 
> #$(MAKE_TARGETS): $(INTERNAL_LIB)
> 
> With this option the compilation is as follows:
> 
> gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall 
> -I/home/stas/ltp/testcases/kernel/include 
> -I/home/stas/ltp/testcases/kernel/syscalls/ipc/msgctl/../lib 
> -I../../../../../include -I../../../../../include 
> -I../../../../../include -I../../../../../include  -c -o msgctl01.o 
> msgctl01.c
> gcc   -L/home/stas/ltp/testcases/kernel/syscalls/ipc/msgctl 
> -L/home/stas/ltp/testcases/kernel/syscalls/ipc/msgctl/../lib 
> -L../../../../../lib -L../../../../../lib  msgctl01.o   -lltp -lmsgctl 
> -lipc -o msgctl01
> 
> I can't find any reasonable arguments for this approach. Just feels that 
> it's more 'correct'.

That looks a bit like a workaround, but let's go with this one for now.

I will take a closer look later and change it if I find a better way.
(I have a better build system documentation on my TODO)

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [LTP] [PATCH] msgctl{08, 09, 10, 11}: cleanup
       [not found]             ` <526A2990.2000107@oracle.com>
@ 2013-10-31 10:55               ` chrubis
       [not found]                 ` <527B58E9.6050705@oracle.com>
  0 siblings, 1 reply; 7+ messages in thread
From: chrubis @ 2013-10-31 10:55 UTC (permalink / raw)
  To: Stanislav Kholmanskikh; +Cc: vasily.isaenko, ltp-list

Hi!
Hi!
> Could you commit the 'infrastructure' patches (lib.mk and etc) to master?
> After that I will send the updated patches to msgctl{08, 09, 10, 11} 
> (with additional cleanup and this new Makefile).

Sure, looking at the previous emails and patches there is this change in
include/mk/lib.mk that I will commit ASAP, the rest can go with your
fixes.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [LTP] [PATCH] msgctl{08, 09, 10, 11}: cleanup
       [not found]                 ` <527B58E9.6050705@oracle.com>
@ 2013-11-07 10:54                   ` chrubis
  0 siblings, 0 replies; 7+ messages in thread
From: chrubis @ 2013-11-07 10:54 UTC (permalink / raw)
  To: Stanislav Kholmanskikh; +Cc: vasily.isaenko, ltp-list

Hi!
> >> Could you commit the 'infrastructure' patches (lib.mk and etc) to master?
> >> After that I will send the updated patches to msgctl{08, 09, 10, 11}
> >> (with additional cleanup and this new Makefile).
> > Sure, looking at the previous emails and patches there is this change in
> > include/mk/lib.mk that I will commit ASAP, the rest can go with your
> > fixes.
> Hi!
> 
> Maybe finish this?

The change in include/mk/lib.mk is in git since Oct 31 see abaa46 and
I've said that the change in Makefile.inc should go with your patches.

Is there anything that is still missing?

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-11-07 10:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <525F76B7.4050705@oracle.com>
2013-10-18  9:12 ` [LTP] [PATCH] msgctl{08, 09, 10, 11}: cleanup Stanislav Kholmanskikh
2013-10-21 12:57   ` chrubis
     [not found]     ` <5268FDE5.5010408@oracle.com>
2013-10-24 11:10       ` chrubis
2013-10-24 12:16       ` chrubis
     [not found]         ` <52692C2F.3040903@oracle.com>
2013-10-24 14:31           ` chrubis
     [not found]             ` <526A2990.2000107@oracle.com>
2013-10-31 10:55               ` chrubis
     [not found]                 ` <527B58E9.6050705@oracle.com>
2013-11-07 10:54                   ` chrubis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.