All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Björn Stenberg" <bjst@enea.com>
To: <yocto@yoctoproject.org>
Subject: [PATCH 3/3] Enable bash-ptest
Date: Thu, 23 Aug 2012 16:20:02 +0200	[thread overview]
Message-ID: <1345731602-47313-4-git-send-email-bjst@enea.com> (raw)
In-Reply-To: <1345731602-47313-1-git-send-email-bjst@enea.com>

Patch Makefile.in to allow test programs be built on host and ran on
target.
Patch tests/run-all to output PASS/FAIL for each testcase.
Patch recipe to build and install test programs and test suite.

---
 .../bash/bash-4.2/build-tests.patch                |   29 ++++++++++++++++++++
 meta/recipes-extended/bash/bash-4.2/run-ptest      |    2 +
 .../bash/bash-4.2/test-output.patch                |   19 +++++++++++++
 meta/recipes-extended/bash/bash.inc                |   18 ++++++++++++
 meta/recipes-extended/bash/bash_4.2.bb             |    5 +++-
 5 files changed, 72 insertions(+), 1 deletions(-)
 create mode 100644 meta/recipes-extended/bash/bash-4.2/build-tests.patch
 create mode 100644 meta/recipes-extended/bash/bash-4.2/run-ptest
 create mode 100644 meta/recipes-extended/bash/bash-4.2/test-output.patch

diff --git a/meta/recipes-extended/bash/bash-4.2/build-tests.patch b/meta/recipes-extended/bash/bash-4.2/build-tests.patch
new file mode 100644
index 0000000..e92fab3
--- /dev/null
+++ b/meta/recipes-extended/bash/bash-4.2/build-tests.patch
@@ -0,0 +1,29 @@
+diff -uNr a/Makefile.in b/Makefile.in
+--- a/Makefile.in	2012-06-14 10:15:15.063465304 +0200
++++ b/Makefile.in	2012-06-14 10:47:02.985115849 +0200
+@@ -827,18 +827,21 @@
+ 	fi
+ 
+ recho$(EXEEXT):		$(SUPPORT_SRC)recho.c
+-	@$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) -o $@ $(SUPPORT_SRC)recho.c ${LIBS_FOR_BUILD}
++	@$(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $<
+ 
+ zecho$(EXEEXT):		$(SUPPORT_SRC)zecho.c
+-	@$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) -o $@ $(SUPPORT_SRC)zecho.c ${LIBS_FOR_BUILD}
++	@$(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $<
+ 
+ printenv$(EXEEXT):	$(SUPPORT_SRC)printenv.c
+-	@$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) -o $@ $(SUPPORT_SRC)printenv.c ${LIBS_FOR_BUILD}
++	@$(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $<
+ 
+ xcase$(EXEEXT):	$(SUPPORT_SRC)xcase.c
+-	@$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) -o $@ $(SUPPORT_SRC)xcase.c ${LIBS_FOR_BUILD}
++	@$(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $<
+ 
+ test tests check:	force $(Program) $(TESTS_SUPPORT)
++	$(MAKE) runtest
++
++runtest:
+ 	@-test -d tests || mkdir tests
+ 	@cp $(TESTS_SUPPORT) tests
+ 	@( cd $(srcdir)/tests && \
diff --git a/meta/recipes-extended/bash/bash-4.2/run-ptest b/meta/recipes-extended/bash/bash-4.2/run-ptest
new file mode 100644
index 0000000..8dd3b99
--- /dev/null
+++ b/meta/recipes-extended/bash/bash-4.2/run-ptest
@@ -0,0 +1,2 @@
+#!/bin/sh
+make -k THIS_SH=/bin/bash BUILD_DIR=. runtest
diff --git a/meta/recipes-extended/bash/bash-4.2/test-output.patch b/meta/recipes-extended/bash/bash-4.2/test-output.patch
new file mode 100644
index 0000000..065a85c
--- /dev/null
+++ b/meta/recipes-extended/bash/bash-4.2/test-output.patch
@@ -0,0 +1,19 @@
+diff -uNr a/tests/run-all b/tests/run-all
+--- a/tests/run-all	2012-06-14 10:15:15.007467700 +0200
++++ b/tests/run-all	2012-06-14 10:19:26.464678067 +0200
+@@ -22,6 +22,14 @@
+ 	case $x in
+ 	$0|run-minimal|run-gprof)	;;
+ 	*.orig|*~) ;;
+-	*)	echo $x ; sh $x ;;
++	*)	echo $x
++		output=`sh $x`
++		if [ -n "$output" ]; then
++			echo "$output"
++			echo "FAIL: $x"
++		else
++			echo "PASS: $x"
++		fi
++		;;
+ 	esac
+ done
diff --git a/meta/recipes-extended/bash/bash.inc b/meta/recipes-extended/bash/bash.inc
index 3684191..04f9940 100644
--- a/meta/recipes-extended/bash/bash.inc
+++ b/meta/recipes-extended/bash/bash.inc
@@ -21,18 +21,36 @@ ALTERNATIVE_PRIORITY = "100"
 
 export AUTOHEADER = "true"
 
+RDEPENDS_${PN}-ptest += "make"
+FILES_${PN}-dbg += "${PTEST_PATH}/.debug"
+
 do_configure_prepend () {
 	if [ ! -e acinclude.m4 ]; then
 		cat aclocal.m4 > acinclude.m4
 	fi
 }
 
+do_compile_append () {
+	oe_runmake recho zecho printenv xcase
+}
+
 do_install_append () {
 	# Move /usr/bin/bash to /bin/bash, if need
 	if [ "${base_bindir}" != "${bindir}" ]; then
 		mkdir -p ${D}${base_bindir}
 		mv ${D}${bindir}/bash ${D}${base_bindir}
 	fi
+
+        if [ "${PN}" = "${BPN}" ]; then
+            mkdir -p ${D}${PTEST_PATH}
+            install -m 0755 ${WORKDIR}/run-ptest    ${D}${PTEST_PATH}
+            install -m 0755 ${B}/Makefile           ${D}${PTEST_PATH}
+            install -m 0755 ${B}/recho              ${D}${PTEST_PATH}
+            install -m 0755 ${B}/zecho              ${D}${PTEST_PATH}
+            install -m 0755 ${B}/printenv           ${D}${PTEST_PATH}
+            install -m 0755 ${B}/xcase              ${D}${PTEST_PATH}
+            cp -r ${B}/tests                        ${D}${PTEST_PATH}/
+        fi
 }
 
 pkg_postinst_${PN} () {
diff --git a/meta/recipes-extended/bash/bash_4.2.bb b/meta/recipes-extended/bash/bash_4.2.bb
index 50f2ff6..5e9b50e 100644
--- a/meta/recipes-extended/bash/bash_4.2.bb
+++ b/meta/recipes-extended/bash/bash_4.2.bb
@@ -1,6 +1,6 @@
 require bash.inc
 
-PR = "r4"
+PR = "r5"
 
 SRC_URI = "${GNU_MIRROR}/bash/${BPN}-${PV}.tar.gz;name=tarball \
            ${GNU_MIRROR}/bash/bash-4.2-patches/bash42-001;apply=yes;striplevel=0;name=patch001 \
@@ -14,6 +14,9 @@ SRC_URI = "${GNU_MIRROR}/bash/${BPN}-${PV}.tar.gz;name=tarball \
            ${GNU_MIRROR}/bash/bash-4.2-patches/bash42-009;apply=yes;striplevel=0;name=patch009 \
            ${GNU_MIRROR}/bash/bash-4.2-patches/bash42-010;apply=yes;striplevel=0;name=patch010 \
            file://execute_cmd.patch;striplevel=0 \
+           file://build-tests.patch \
+           file://test-output.patch \
+           file://run-ptest \
            "
 
 SRC_URI[tarball.md5sum] = "3fb927c7c33022f1c327f14a81c0d4b0"
-- 
1.7.5.4



  parent reply	other threads:[~2012-08-23 14:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-23 14:19 [PATCH 0/3] RFC: Package testing Björn Stenberg
2012-08-23 14:20 ` [PATCH 1/3] Add -ptest package group Björn Stenberg
2012-08-23 14:42   ` Paul Eggleton
2012-08-24  6:51     ` Björn Stenberg
2012-08-24 15:37   ` Richard Purdie
2012-08-28 11:17     ` Björn Stenberg
2012-08-23 14:20 ` [PATCH 2/3] New recipe: ptest-runner Björn Stenberg
2012-08-23 14:20 ` Björn Stenberg [this message]
2012-08-24 15:40   ` [PATCH 3/3] Enable bash-ptest Richard Purdie
2012-08-24 19:10   ` Saul Wold
2012-08-23 21:53 ` [PATCH 0/3] RFC: Package testing Burton, Ross
2012-08-24  6:49   ` Björn Stenberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1345731602-47313-4-git-send-email-bjst@enea.com \
    --to=bjst@enea.com \
    --cc=yocto@yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is 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.