Skip to contentSkip to conversation

build tweaks and a bug fix

PATCH In review Josh Cartwright 4 participants 12 messages Aug 28, 2015 – Sep 2, 2015 Kbuild

lore
Share & tools
lore
#0 lore raw

cover build tweaks and a bug fix

Hey John, Clark-

This series has a few minor rt-tests tweaks that make it a bit easier to build and package rt-tests for the bizarro build demands in the embedded space. With a bug fix thrown in for good measure.

The first patch breaks the assumption that build host == target; the second patch allows a packager to more easily split hwlatdetect into a separate package. (Both of these patches are unchanged since Darren's original submission in 2012[1]).

The third patch works around crappy gzip implementations.

The forth patch fixes a hypothetical (as far as I know) bug in hackbench's error handling.

A form of all of these patches has been carried out-of-tree in the OpenEmbedded project for years now :(. They are more widely useful; as such, it's time to land them in rt-tests proper.

Thanks,
Josh

1: http://permalink.gmane.org/gmane.linux.rt.user/8749

Cc Darren Hart <[email protected]>
Cc Robert Yang <[email protected]>
Cc Kai Kang <[email protected]>
Cc Song.Li <[email protected]>
Cc Jesse Zhang <[email protected]>

Darren Hart (2):
rt-tests: Allow for user-specified PYLIB
rt-tests: Break out install_hwlatdetect

Josh Cartwright (2):
rt-tests: workaround poor gzip implementations
hackbench: cleanup error handling in create_worker

 Makefile                  | 32 ++++++++++++++++++--------------
 src/hackbench/hackbench.c | 36 +++++++++++++++---------------------
 2 files changed, 33 insertions(+), 35 deletions(-)
Signature · 1 line
2.5.0
#1 lore raw

PATCH 1/4 rt-tests: Allow for user-specified PYLIB

From: Darren Hart <[email protected]>

Allow users (build systems) to specify PYLIB. This allows for a cross-build-system to specify the target PYLIB rather than the host PYLIB.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index a48e759..1ec7f6a 100644
@@ -34,7 +34,7 @@ ifdef HAVE_PARSE_CPUSTRING_ALL
 endif
 endif
 
-PYLIB  := $(shell python -c 'import distutils.sysconfig;  print distutils.sysconfig.get_python_lib()')
+PYLIB  ?= $(shell python -c 'import distutils.sysconfig;  print distutils.sysconfig.get_python_lib()')
 
 ifndef DEBUG
 	CFLAGS	+= -O2
Signature · 1 line
2.5.0
#2 lore raw

Re: [PATCH rt-tests 1/4] rt-tests: Allow for user-specified PYLIB

Quoted 30 lines · Josh Cartwright

From: Darren Hart <[email protected]>

Allow users (build systems) to specify PYLIB. This allows for a cross-build-system to specify the target PYLIB rather than the host PYLIB.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index a48e759..1ec7f6a 100644
@@ -34,7 +34,7 @@ ifdef HAVE_PARSE_CPUSTRING_ALL
 endif
 endif
 
-PYLIB  := $(shell python -c 'import distutils.sysconfig;  print distutils.sysconfig.get_python_lib()')
+PYLIB  ?= $(shell python -c 'import distutils.sysconfig;  print distutils.sysconfig.get_python_lib()')
 
 ifndef DEBUG
 	CFLAGS	+= -O2
Signature · 1 line
2.5.0

Nice. I see Clark has already grabbed this one.

#3 lore raw

PATCH 2/4 rt-tests: Break out install_hwlatdetect

In reply to Josh Cartwright

From: Darren Hart <[email protected]>

Allow hwlatdetect to be installed independently of the rest of the tests. This is convenient for build systems that package it separately due to the python dependency.

---
 Makefile | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
Makefile +11 -7
index 1ec7f6a..e5a9942 100644
@@ -131,21 +131,15 @@ changelog:
 	git log >ChangeLog
 
 .PHONY: install
-install: all
+install: all install_hwlatdetect
 	mkdir -p "$(DESTDIR)$(bindir)" "$(DESTDIR)$(mandir)/man4"
 	mkdir -p "$(DESTDIR)$(srcdir)" "$(DESTDIR)$(mandir)/man8"
 	cp $(TARGETS) "$(DESTDIR)$(bindir)"
-	if test -n "$(PYLIB)" ; then \
-		install -D -m 755 src/hwlatdetect/hwlatdetect.py $(DESTDIR)$(PYLIB)/hwlatdetect.py ; \
-		rm -f "$(DESTDIR)$(bindir)/hwlatdetect" ; \
-		ln -s $(PYLIB)/hwlatdetect.py "$(DESTDIR)$(bindir)/hwlatdetect" ; \
-	fi
 	install -D -m 644 src/backfire/backfire.c "$(DESTDIR)$(srcdir)/backfire/backfire.c"
 	install -m 644 src/backfire/Makefile "$(DESTDIR)$(srcdir)/backfire/Makefile"
 	gzip src/backfire/backfire.4 -c >"$(DESTDIR)$(mandir)/man4/backfire.4.gz"
 	gzip src/cyclictest/cyclictest.8 -c >"$(DESTDIR)$(mandir)/man8/cyclictest.8.gz"
 	gzip src/pi_tests/pi_stress.8 -c >"$(DESTDIR)$(mandir)/man8/pi_stress.8.gz"
-	gzip src/hwlatdetect/hwlatdetect.8 -c >"$(DESTDIR)$(mandir)/man8/hwlatdetect.8.gz"
 	gzip src/ptsematest/ptsematest.8 -c >"$(DESTDIR)$(mandir)/man8/ptsematest.8.gz"
 	gzip src/sigwaittest/sigwaittest.8 -c >"$(DESTDIR)$(mandir)/man8/sigwaittest.8.gz"
 	gzip src/svsematest/svsematest.8 -c >"$(DESTDIR)$(mandir)/man8/svsematest.8.gz"
@@ -153,6 +147,16 @@ install: all
 	gzip src/backfire/sendme.8 -c >"$(DESTDIR)$(mandir)/man8/sendme.8.gz"
 	gzip src/hackbench/hackbench.8 -c >"$(DESTDIR)$(mandir)/man8/hackbench.8.gz"
 
+.PHONY: install_hwlatdetect
+install_hwlatdetect: hwlatdetect
+	if test -n "$(PYLIB)" ; then \
+		mkdir -p "$(DESTDIR)$(bindir)" "$(DESTDIR)$(mandir)/man8" ; \
+		install -D -m 755 src/hwlatdetect/hwlatdetect.py $(DESTDIR)$(PYLIB)/hwlatdetect.py ; \
+		rm -f "$(DESTDIR)$(bindir)/hwlatdetect" ; \
+		ln -s $(PYLIB)/hwlatdetect.py "$(DESTDIR)$(bindir)/hwlatdetect" ; \
+		gzip src/hwlatdetect/hwlatdetect.8 -c >"$(DESTDIR)$(mandir)/man8/hwlatdetect.8.gz" ; \
+	fi
+
 .PHONY: release
 release: distclean changelog
 	mkdir -p releases
Signature · 1 line
2.5.0
#4 lore raw

Re: [PATCH rt-tests 2/4] rt-tests: Break out install_hwlatdetect

Quoted 60 lines · Josh Cartwright

From: Darren Hart <[email protected]>

Allow hwlatdetect to be installed independently of the rest of the tests. This is convenient for build systems that package it separately due to the python dependency.

---
 Makefile | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
Makefile +11 -7
index 1ec7f6a..e5a9942 100644
@@ -131,21 +131,15 @@ changelog:
 	git log >ChangeLog
 
 .PHONY: install
-install: all
+install: all install_hwlatdetect
 	mkdir -p "$(DESTDIR)$(bindir)" "$(DESTDIR)$(mandir)/man4"
 	mkdir -p "$(DESTDIR)$(srcdir)" "$(DESTDIR)$(mandir)/man8"
 	cp $(TARGETS) "$(DESTDIR)$(bindir)"
-	if test -n "$(PYLIB)" ; then \
-		install -D -m 755 src/hwlatdetect/hwlatdetect.py $(DESTDIR)$(PYLIB)/hwlatdetect.py ; \
-		rm -f "$(DESTDIR)$(bindir)/hwlatdetect" ; \
-		ln -s $(PYLIB)/hwlatdetect.py "$(DESTDIR)$(bindir)/hwlatdetect" ; \
-	fi
 	install -D -m 644 src/backfire/backfire.c "$(DESTDIR)$(srcdir)/backfire/backfire.c"
 	install -m 644 src/backfire/Makefile "$(DESTDIR)$(srcdir)/backfire/Makefile"
 	gzip src/backfire/backfire.4 -c >"$(DESTDIR)$(mandir)/man4/backfire.4.gz"
 	gzip src/cyclictest/cyclictest.8 -c >"$(DESTDIR)$(mandir)/man8/cyclictest.8.gz"
 	gzip src/pi_tests/pi_stress.8 -c >"$(DESTDIR)$(mandir)/man8/pi_stress.8.gz"
-	gzip src/hwlatdetect/hwlatdetect.8 -c >"$(DESTDIR)$(mandir)/man8/hwlatdetect.8.gz"
 	gzip src/ptsematest/ptsematest.8 -c >"$(DESTDIR)$(mandir)/man8/ptsematest.8.gz"
 	gzip src/sigwaittest/sigwaittest.8 -c >"$(DESTDIR)$(mandir)/man8/sigwaittest.8.gz"
 	gzip src/svsematest/svsematest.8 -c >"$(DESTDIR)$(mandir)/man8/svsematest.8.gz"
@@ -153,6 +147,16 @@ install: all
 	gzip src/backfire/sendme.8 -c >"$(DESTDIR)$(mandir)/man8/sendme.8.gz"
 	gzip src/hackbench/hackbench.8 -c >"$(DESTDIR)$(mandir)/man8/hackbench.8.gz"
 
+.PHONY: install_hwlatdetect
+install_hwlatdetect: hwlatdetect
+	if test -n "$(PYLIB)" ; then \
+		mkdir -p "$(DESTDIR)$(bindir)" "$(DESTDIR)$(mandir)/man8" ; \
+		install -D -m 755 src/hwlatdetect/hwlatdetect.py $(DESTDIR)$(PYLIB)/hwlatdetect.py ; \
+		rm -f "$(DESTDIR)$(bindir)/hwlatdetect" ; \
+		ln -s $(PYLIB)/hwlatdetect.py "$(DESTDIR)$(bindir)/hwlatdetect" ; \
+		gzip src/hwlatdetect/hwlatdetect.8 -c >"$(DESTDIR)$(mandir)/man8/hwlatdetect.8.gz" ; \
+	fi
+
 .PHONY: release
 release: distclean changelog
 	mkdir -p releases
Signature · 1 line
2.5.0
#5 lore raw

PATCH 3/4 rt-tests: workaround poor gzip implementations

In reply to Josh Cartwright

Some 'gzip' implementations, in particular 'pigz' don't properly handle the '-c' argument if it's passed after the name of the input files.

Work around this by putting the '-c' option before the file names.

Inspired by patches in OpenEmbedded by Robert Yang and Kai Kang.

---
 Makefile | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
Makefile +10 -10
index e5a9942..5c4dd04 100644
@@ -137,15 +137,15 @@ install: all install_hwlatdetect
 	cp $(TARGETS) "$(DESTDIR)$(bindir)"
 	install -D -m 644 src/backfire/backfire.c "$(DESTDIR)$(srcdir)/backfire/backfire.c"
 	install -m 644 src/backfire/Makefile "$(DESTDIR)$(srcdir)/backfire/Makefile"
-	gzip src/backfire/backfire.4 -c >"$(DESTDIR)$(mandir)/man4/backfire.4.gz"
-	gzip src/cyclictest/cyclictest.8 -c >"$(DESTDIR)$(mandir)/man8/cyclictest.8.gz"
-	gzip src/pi_tests/pi_stress.8 -c >"$(DESTDIR)$(mandir)/man8/pi_stress.8.gz"
-	gzip src/ptsematest/ptsematest.8 -c >"$(DESTDIR)$(mandir)/man8/ptsematest.8.gz"
-	gzip src/sigwaittest/sigwaittest.8 -c >"$(DESTDIR)$(mandir)/man8/sigwaittest.8.gz"
-	gzip src/svsematest/svsematest.8 -c >"$(DESTDIR)$(mandir)/man8/svsematest.8.gz"
-	gzip src/pmqtest/pmqtest.8 -c >"$(DESTDIR)$(mandir)/man8/pmqtest.8.gz"
-	gzip src/backfire/sendme.8 -c >"$(DESTDIR)$(mandir)/man8/sendme.8.gz"
-	gzip src/hackbench/hackbench.8 -c >"$(DESTDIR)$(mandir)/man8/hackbench.8.gz"
+	gzip -c src/backfire/backfire.4 >"$(DESTDIR)$(mandir)/man4/backfire.4.gz"
+	gzip -c src/cyclictest/cyclictest.8 >"$(DESTDIR)$(mandir)/man8/cyclictest.8.gz"
+	gzip -c src/pi_tests/pi_stress.8 >"$(DESTDIR)$(mandir)/man8/pi_stress.8.gz"
+	gzip -c src/ptsematest/ptsematest.8 >"$(DESTDIR)$(mandir)/man8/ptsematest.8.gz"
+	gzip -c src/sigwaittest/sigwaittest.8 >"$(DESTDIR)$(mandir)/man8/sigwaittest.8.gz"
+	gzip -c src/svsematest/svsematest.8 >"$(DESTDIR)$(mandir)/man8/svsematest.8.gz"
+	gzip -c src/pmqtest/pmqtest.8 >"$(DESTDIR)$(mandir)/man8/pmqtest.8.gz"
+	gzip -c src/backfire/sendme.8 >"$(DESTDIR)$(mandir)/man8/sendme.8.gz"
+	gzip -c src/hackbench/hackbench.8 >"$(DESTDIR)$(mandir)/man8/hackbench.8.gz"
 
 .PHONY: install_hwlatdetect
 install_hwlatdetect: hwlatdetect
@@ -154,7 +154,7 @@ install_hwlatdetect: hwlatdetect
 		install -D -m 755 src/hwlatdetect/hwlatdetect.py $(DESTDIR)$(PYLIB)/hwlatdetect.py ; \
 		rm -f "$(DESTDIR)$(bindir)/hwlatdetect" ; \
 		ln -s $(PYLIB)/hwlatdetect.py "$(DESTDIR)$(bindir)/hwlatdetect" ; \
-		gzip src/hwlatdetect/hwlatdetect.8 -c >"$(DESTDIR)$(mandir)/man8/hwlatdetect.8.gz" ; \
+		gzip -c src/hwlatdetect/hwlatdetect.8 >"$(DESTDIR)$(mandir)/man8/hwlatdetect.8.gz" ; \
 	fi
 
 .PHONY: release
Signature · 1 line
2.5.0
#6 lore raw

Re: [PATCH rt-tests 3/4] rt-tests: workaround poor gzip implementations

Quoted 54 lines · Josh Cartwright

Some 'gzip' implementations, in particular 'pigz' don't properly handle the '-c' argument if it's passed after the name of the input files.

Work around this by putting the '-c' option before the file names.

Inspired by patches in OpenEmbedded by Robert Yang and Kai Kang.

---
 Makefile | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
Makefile +10 -10
index e5a9942..5c4dd04 100644
@@ -137,15 +137,15 @@ install: all install_hwlatdetect
 	cp $(TARGETS) "$(DESTDIR)$(bindir)"
 	install -D -m 644 src/backfire/backfire.c "$(DESTDIR)$(srcdir)/backfire/backfire.c"
 	install -m 644 src/backfire/Makefile "$(DESTDIR)$(srcdir)/backfire/Makefile"
-	gzip src/backfire/backfire.4 -c >"$(DESTDIR)$(mandir)/man4/backfire.4.gz"
-	gzip src/cyclictest/cyclictest.8 -c >"$(DESTDIR)$(mandir)/man8/cyclictest.8.gz"
-	gzip src/pi_tests/pi_stress.8 -c >"$(DESTDIR)$(mandir)/man8/pi_stress.8.gz"
-	gzip src/ptsematest/ptsematest.8 -c >"$(DESTDIR)$(mandir)/man8/ptsematest.8.gz"
-	gzip src/sigwaittest/sigwaittest.8 -c >"$(DESTDIR)$(mandir)/man8/sigwaittest.8.gz"
-	gzip src/svsematest/svsematest.8 -c >"$(DESTDIR)$(mandir)/man8/svsematest.8.gz"
-	gzip src/pmqtest/pmqtest.8 -c >"$(DESTDIR)$(mandir)/man8/pmqtest.8.gz"
-	gzip src/backfire/sendme.8 -c >"$(DESTDIR)$(mandir)/man8/sendme.8.gz"
-	gzip src/hackbench/hackbench.8 -c >"$(DESTDIR)$(mandir)/man8/hackbench.8.gz"
+	gzip -c src/backfire/backfire.4 >"$(DESTDIR)$(mandir)/man4/backfire.4.gz"
+	gzip -c src/cyclictest/cyclictest.8 >"$(DESTDIR)$(mandir)/man8/cyclictest.8.gz"
+	gzip -c src/pi_tests/pi_stress.8 >"$(DESTDIR)$(mandir)/man8/pi_stress.8.gz"
+	gzip -c src/ptsematest/ptsematest.8 >"$(DESTDIR)$(mandir)/man8/ptsematest.8.gz"
+	gzip -c src/sigwaittest/sigwaittest.8 >"$(DESTDIR)$(mandir)/man8/sigwaittest.8.gz"
+	gzip -c src/svsematest/svsematest.8 >"$(DESTDIR)$(mandir)/man8/svsematest.8.gz"
+	gzip -c src/pmqtest/pmqtest.8 >"$(DESTDIR)$(mandir)/man8/pmqtest.8.gz"
+	gzip -c src/backfire/sendme.8 >"$(DESTDIR)$(mandir)/man8/sendme.8.gz"
+	gzip -c src/hackbench/hackbench.8 >"$(DESTDIR)$(mandir)/man8/hackbench.8.gz"
 
 .PHONY: install_hwlatdetect
 install_hwlatdetect: hwlatdetect
@@ -154,7 +154,7 @@ install_hwlatdetect: hwlatdetect
 		install -D -m 755 src/hwlatdetect/hwlatdetect.py $(DESTDIR)$(PYLIB)/hwlatdetect.py ; \
 		rm -f "$(DESTDIR)$(bindir)/hwlatdetect" ; \
 		ln -s $(PYLIB)/hwlatdetect.py "$(DESTDIR)$(bindir)/hwlatdetect" ; \
-		gzip src/hwlatdetect/hwlatdetect.8 -c >"$(DESTDIR)$(mandir)/man8/hwlatdetect.8.gz" ; \
+		gzip -c src/hwlatdetect/hwlatdetect.8 >"$(DESTDIR)$(mandir)/man8/hwlatdetect.8.gz" ; \
 	fi
 
 .PHONY: release
Signature · 1 line
2.5.0
#7 lore raw

PATCH 4/4 hackbench: cleanup error handling in create_worker

In reply to Josh Cartwright

The childinfo_t union shares the 'long long error' member with a 'pthread_t threadid'. For a "sufficiently large" threadid, it's possible that the error condition is incorrectly hit even though a valid thread was created.

Stop conflating the error condition with legitimate thread/process identifiers by modifying create_worker to explicitly return an error code.

Inspired by a patch in OpenEmbedded authored by Song Li and Jesse Zhang.

---
 src/hackbench/hackbench.c | 36 +++++++++++++++---------------------
 1 file changed, 15 insertions(+), 21 deletions(-)
src/hackbench/hackbench.c +15 -21
index c42257c..ba804f5 100644
@@ -64,7 +64,6 @@ struct receiver_context {
 typedef union {
 	pthread_t threadid;
 	pid_t	  pid;
-	long long error;
 } childinfo_t;
 
 childinfo_t *child_tab = NULL;
@@ -189,52 +188,44 @@ again:
 	return NULL;
 }
 
-static childinfo_t create_worker(void *ctx, void *(*func)(void *))
+static int create_worker(childinfo_t *child, void *ctx, void *(*func)(void *))
 {
 	pthread_attr_t attr;
 	int err;
-	childinfo_t child;
-	pid_t childpid;
 
-	memset(&child, 0, sizeof(child));
 	switch (process_mode) {
 	case PROCESS_MODE: /* process mode */
 		/* Fork the sender/receiver child. */
-		switch ((childpid = fork())) {
+		switch ((child->pid = fork())) {
 			case -1:
 				sneeze("fork()");
-				child.error = -1;
-				return child;
+				return -1;
 			case 0:
 				(*func) (ctx);
 				exit(0);
 		}
-		child.pid = childpid;
 		break;
 
 	case THREAD_MODE: /* threaded mode */
 		if (pthread_attr_init(&attr) != 0) {
 			sneeze("pthread_attr_init()");
-			child.error = -1;
-			return child;
+			return -1;
 		}
 
 #ifndef __ia64__
 		if (pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN) != 0) {
 			sneeze("pthread_attr_setstacksize()");
-			child.error = -1;
-			return child;
+			return -1;
 		}
 #endif
 
-		if ((err=pthread_create(&child.threadid, &attr, func, ctx)) != 0) {
+		if ((err=pthread_create(&child->threadid, &attr, func, ctx)) != 0) {
 			sneeze("pthread_create failed()");
-			child.error = -1;
-			return child;
+			return -1;
 		}
 		break;
 	}
-	return child;
+	return 0;
 }
 
 void signal_workers(childinfo_t *children, unsigned int num_children)
@@ -291,6 +282,7 @@ static unsigned int group(childinfo_t *child,
 	unsigned int i;
 	struct sender_context* snd_ctx = malloc (sizeof(struct sender_context)
 			+num_fds*sizeof(int));
+	int err;
 
 	if (!snd_ctx) {
 		sneeze("malloc() [sender ctx]");
@@ -317,8 +309,9 @@ static unsigned int group(childinfo_t *child,
 		ctx->ready_out = ready_out;
 		ctx->wakefd = wakefd;
 
-		child[tab_offset+i] = create_worker(ctx, (void *)(void *)receiver);
-		if( child[tab_offset+i].error < 0 ) {
+		err = create_worker(&child[tab_offset+i], ctx,
+				    (void *)(void *)receiver);
+		if(err) {
 			return (i > 0 ? i-1 : 0);
 		}
 		snd_ctx->out_fds[i] = fds[1];
@@ -332,8 +325,9 @@ static unsigned int group(childinfo_t *child,
 
 	/* Now we have all the fds, fork the senders */
 	for (i = 0; i < num_fds; i++) {
-		child[tab_offset+num_fds+i] = create_worker(snd_ctx, (void *)(void *)sender);
-		if( child[tab_offset+num_fds+i].error < 0 ) {
+		err = create_worker(&child[tab_offset+num_fds+i], snd_ctx,
+				    (void *)(void *)sender);
+		if(err) {
 			return (num_fds+i)-1;
 		}
 	}
Signature · 1 line
2.5.0
#8 lore raw

Re: [PATCH rt-tests 4/4] hackbench: cleanup error handling in create_worker

Quoted 127 lines · Josh Cartwright

The childinfo_t union shares the 'long long error' member with a 'pthread_t threadid'. For a "sufficiently large" threadid, it's possible that the error condition is incorrectly hit even though a valid thread was created.

Stop conflating the error condition with legitimate thread/process identifiers by modifying create_worker to explicitly return an error code.

Inspired by a patch in OpenEmbedded authored by Song Li and Jesse Zhang.

---
 src/hackbench/hackbench.c | 36 +++++++++++++++---------------------
 1 file changed, 15 insertions(+), 21 deletions(-)
src/hackbench/hackbench.c +15 -21
index c42257c..ba804f5 100644
@@ -64,7 +64,6 @@ struct receiver_context {
 typedef union {
 	pthread_t threadid;
 	pid_t	  pid;
-	long long error;
 } childinfo_t;
 
 childinfo_t *child_tab = NULL;
@@ -189,52 +188,44 @@ again:
 	return NULL;
 }
 
-static childinfo_t create_worker(void *ctx, void *(*func)(void *))
+static int create_worker(childinfo_t *child, void *ctx, void *(*func)(void *))
 {
 	pthread_attr_t attr;
 	int err;
-	childinfo_t child;
-	pid_t childpid;
 
-	memset(&child, 0, sizeof(child));
 	switch (process_mode) {
 	case PROCESS_MODE: /* process mode */
 		/* Fork the sender/receiver child. */
-		switch ((childpid = fork())) {
+		switch ((child->pid = fork())) {
 			case -1:
 				sneeze("fork()");
-				child.error = -1;
-				return child;
+				return -1;
 			case 0:
 				(*func) (ctx);
 				exit(0);
 		}
-		child.pid = childpid;
 		break;
 
 	case THREAD_MODE: /* threaded mode */
 		if (pthread_attr_init(&attr) != 0) {
 			sneeze("pthread_attr_init()");
-			child.error = -1;
-			return child;
+			return -1;
 		}
 
 #ifndef __ia64__
 		if (pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN) != 0) {
 			sneeze("pthread_attr_setstacksize()");
-			child.error = -1;
-			return child;
+			return -1;
 		}
 #endif
 
-		if ((err=pthread_create(&child.threadid, &attr, func, ctx)) != 0) {
+		if ((err=pthread_create(&child->threadid, &attr, func, ctx)) != 0) {
 			sneeze("pthread_create failed()");
-			child.error = -1;
-			return child;
+			return -1;
 		}
 		break;
 	}
-	return child;
+	return 0;
 }
 
 void signal_workers(childinfo_t *children, unsigned int num_children)
@@ -291,6 +282,7 @@ static unsigned int group(childinfo_t *child,
 	unsigned int i;
 	struct sender_context* snd_ctx = malloc (sizeof(struct sender_context)
 			+num_fds*sizeof(int));
+	int err;
 
 	if (!snd_ctx) {
 		sneeze("malloc() [sender ctx]");
@@ -317,8 +309,9 @@ static unsigned int group(childinfo_t *child,
 		ctx->ready_out = ready_out;
 		ctx->wakefd = wakefd;
 
-		child[tab_offset+i] = create_worker(ctx, (void *)(void *)receiver);
-		if( child[tab_offset+i].error < 0 ) {
+		err = create_worker(&child[tab_offset+i], ctx,
+				    (void *)(void *)receiver);
+		if(err) {
 			return (i > 0 ? i-1 : 0);
 		}
 		snd_ctx->out_fds[i] = fds[1];
@@ -332,8 +325,9 @@ static unsigned int group(childinfo_t *child,
 
 	/* Now we have all the fds, fork the senders */
 	for (i = 0; i < num_fds; i++) {
-		child[tab_offset+num_fds+i] = create_worker(snd_ctx, (void *)(void *)sender);
-		if( child[tab_offset+num_fds+i].error < 0 ) {
+		err = create_worker(&child[tab_offset+num_fds+i], snd_ctx,
+				    (void *)(void *)sender);
+		if(err) {
 			return (num_fds+i)-1;
 		}
 	}
Signature · 3 lines
2.5.0

--
#9 lore raw
In reply to Josh Cartwright
Quoted 16 lines · On Thu, 27 Aug 2015 19:19:47 -0500 Josh Cartwright <[email protected]> wrote:

Hey John, Clark-

This series has a few minor rt-tests tweaks that make it a bit easier to build and package rt-tests for the bizarro build demands in the embedded space. With a bug fix thrown in for good measure.

The first patch breaks the assumption that build host == target; the second patch allows a packager to more easily split hwlatdetect into a separate package. (Both of these patches are unchanged since Darren's original submission in 2012[1]).

The third patch works around crappy gzip implementations.

The forth patch fixes a hypothetical (as far as I know) bug in hackbench's error handling.

Quoted 7 lines

A form of all of these patches has been carried out-of-tree in the OpenEmbedded project for years now :(. They are more widely useful; as such, it's time to land them in rt-tests proper.

Thanks,
Josh

These look reasonable to me Josh. I'll pull 'em in and we'll beat on them for a while.

Clark

#10 lore raw
In reply to Josh Cartwright
Quoted 10 lines · Josh Cartwright

Hey John, Clark-

This series has a few minor rt-tests tweaks that make it a bit easier to build and package rt-tests for the bizarro build demands in the embedded space. With a bug fix thrown in for good measure.

The first patch breaks the assumption that build host == target; the second patch allows a packager to more easily split hwlatdetect into a separate package. (Both of these patches are unchanged since Darren's original submission in 2012[1]).

Yikes, did I not submit those to rt-tests? If not, shame on me!

Quoted 21 lines

The third patch works around crappy gzip implementations.

The forth patch fixes a hypothetical (as far as I know) bug in hackbench's error handling.

A form of all of these patches has been carried out-of-tree in the OpenEmbedded project for years now :(. They are more widely useful; as such, it's time to land them in rt-tests proper.

Thanks,
Josh

1: http://permalink.gmane.org/gmane.linux.rt.user/8749

Cc Darren Hart <[email protected]>
Cc Robert Yang <[email protected]>
Cc Kai Kang <[email protected]>
Cc Song.Li <[email protected]>
Cc Jesse Zhang <[email protected]>
Quoted 4 lines

Darren Hart (2):
rt-tests: Allow for user-specified PYLIB
rt-tests: Break out install_hwlatdetect

Re-Acked, thanks Josh.

Signature · 2 lines
Darren Hart
Intel Open Source Technology Center
#11 lore raw
Quoted 7 lines · Darren Hart
Quoted 6 lines · Josh Cartwright

Hey John, Clark-

This series has a few minor rt-tests tweaks that make it a bit easier to build and package rt-tests for the bizarro build demands in the embedded space. With a bug fix thrown in for good measure.

Quoted 6 lines
Quoted 4 lines

The first patch breaks the assumption that build host == target; the second patch allows a packager to more easily split hwlatdetect into a separate package. (Both of these patches are unchanged since Darren's original submission in 2012[1]).

Yikes, did I not submit those to rt-tests? If not, shame on me!

Oh, you did! The linked submission was to linux-rt-users. Looks like the patches just fell through the cracks.

[..]

Quoted 6 lines
Quoted 4 lines

Darren Hart (2):
rt-tests: Allow for user-specified PYLIB
rt-tests: Break out install_hwlatdetect

Re-Acked, thanks Josh.

Thanks!

Josh