[OE-core] [PATCH 1/3] LTP: Realtime tests - Allow-mutex-initialization-without-PI-configured

Gary S. Robertson gary.robertson at linaro.org
Fri Jul 25 22:20:43 UTC 2014


From: "Gary S. Robertson" <gary.robertson at linaro.org>

In the OE build environment the features on the build host
may not match those of the runtime host -so- the conditional
compilation clauses were deleted which required the presence
of priority inheriting mutexes in order to compile initialization
of a mutex with priority inheritance.  This allows this code to
execute and fail if the runtime host lacks priority inheritance,
while eliminating any dependence on PI mutexes in the build host.

Signed-off-by: Gary S. Robertson <gary.robertson at linaro.org>
---
 ...utex-initialization-without-PI-configured.patch |   66 ++++++++++++++++++++
 meta/recipes-extended/ltp/ltp_20140422.bb          |    1 +
 2 files changed, 67 insertions(+)
 create mode 100644 meta/recipes-extended/ltp/ltp/0001-Allow-mutex-initialization-without-PI-configured.patch

diff --git a/meta/recipes-extended/ltp/ltp/0001-Allow-mutex-initialization-without-PI-configured.patch b/meta/recipes-extended/ltp/ltp/0001-Allow-mutex-initialization-without-PI-configured.patch
new file mode 100644
index 0000000..2de6e22
--- /dev/null
+++ b/meta/recipes-extended/ltp/ltp/0001-Allow-mutex-initialization-without-PI-configured.patch
@@ -0,0 +1,66 @@
+From 62dfb25fa3b6e71650bc3fff9a4a0eaec0f5ac8e Mon Sep 17 00:00:00 2001
+From: "Gary S. Robertson" <gary.robertson at linaro.org>
+Date: Fri, 25 Jul 2014 09:25:13 -0500
+Subject: [PATCH] Allow mutex initialization without PI configured
+
+LTP is primarily intended to be built and run on the same machine,
+and uses autotools / autoconf to determine the features of the host
+machine's environment prior to compilation.  However in the OE
+environment, LTP may get built into a generic filesystem image
+which will be used with a variety of different kernels later...
+so for the OE environment it is better not to disable features
+based on the compile-time environment.  This patch removes
+compile-time dependencies on priority-inheriting mutexes and
+allows the code to attempt initialization of PI mutexes even
+if the runtime environment lacks that feature... in which case
+the associated test should fail.
+
+Signed-off-by: Gary S. Robertson <gary.robertson at linaro.org>
+---
+ testcases/realtime/lib/librttest.c            |    2 --
+ testcases/realtime/stress/pi-tests/testpi-3.c |    2 --
+ 2 files changed, 4 deletions(-)
+
+diff --git a/testcases/realtime/lib/librttest.c b/testcases/realtime/lib/librttest.c
+index 0dd6019..9f37d08 100644
+--- a/testcases/realtime/lib/librttest.c
++++ b/testcases/realtime/lib/librttest.c
+@@ -586,7 +586,6 @@ void *busy_work_us(int us)
+ 
+ void init_pi_mutex(pthread_mutex_t * m)
+ {
+-#if HAVE_DECL_PTHREAD_PRIO_INHERIT
+ 	pthread_mutexattr_t attr;
+ 	int ret;
+ 	int protocol;
+@@ -609,7 +608,6 @@ void init_pi_mutex(pthread_mutex_t * m)
+ 	if ((ret = pthread_mutex_init(m, &attr)) != 0) {
+ 		printf("Failed to init mutex: %d (%s)\n", ret, strerror(ret));
+ 	}
+-#endif
+ 
+ 	/* FIXME: does any of this need to be destroyed ? */
+ }
+diff --git a/testcases/realtime/stress/pi-tests/testpi-3.c b/testcases/realtime/stress/pi-tests/testpi-3.c
+index 30f38f6..807c9cc 100644
+--- a/testcases/realtime/stress/pi-tests/testpi-3.c
++++ b/testcases/realtime/stress/pi-tests/testpi-3.c
+@@ -365,7 +365,6 @@ int main(int argc, char *argv[])
+ 
+ 	printf("Start %s\n", argv[0]);
+ 
+-#if HAVE_DECL_PTHREAD_PRIO_INHERIT
+ 	if (!nopi) {
+ 		pthread_mutexattr_t mutexattr;
+ 		int protocol;
+@@ -386,7 +385,6 @@ int main(int argc, char *argv[])
+ 			printf("Failed to init mutex: %d\n", retc);
+ 		}
+ 	}
+-#endif
+ 
+ 	startThread(&arg1);
+ 	startThread(&arg2);
+-- 
+1.7.9.5
+
diff --git a/meta/recipes-extended/ltp/ltp_20140422.bb b/meta/recipes-extended/ltp/ltp_20140422.bb
index 30761fd..2ac2187 100644
--- a/meta/recipes-extended/ltp/ltp_20140422.bb
+++ b/meta/recipes-extended/ltp/ltp_20140422.bb
@@ -26,6 +26,7 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git \
     file://0001-Rename-runtests_noltp.sh-script-so-have-unique-name.patch \
     file://ltp-Do-not-link-against-libfl.patch \
     file://automake-foreign.patch \
+    file://0001-Allow-mutex-initialization-without-PI-configured.patch \
 "
 
 S = "${WORKDIR}/git"
-- 
1.7.9.5




More information about the Openembedded-core mailing list