From 71e07ce8d1e4c2a50e937f0c819f025afd4677cb Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Wed, 19 Dec 2012 17:18:31 +0100 Subject: Add ptest for bash. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Björn Stenberg Signed-off-by: Saul Wold --- .../bash/bash-4.2/build-tests.patch | 48 ++++++++++++++++++++++ meta/recipes-extended/bash/bash-4.2/run-ptest | 2 + .../bash/bash-4.2/test-output.patch | 25 +++++++++++ meta/recipes-extended/bash/bash.inc | 16 +++++++- meta/recipes-extended/bash/bash_4.2.bb | 3 ++ 5 files changed, 93 insertions(+), 1 deletion(-) 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 (limited to 'meta/recipes-extended/bash') 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 0000000000..036088116d --- /dev/null +++ b/meta/recipes-extended/bash/bash-4.2/build-tests.patch @@ -0,0 +1,48 @@ +Add 'ptest' target to Makefile, to run tests without checking dependencies. + +Signed-off-by: Anders Roxell +Upstream-Status: Pending +--- +diff -uNr a/Makefile.in b/Makefile.in +--- a/Makefile.in 2012-11-06 08:40:07.552403063 +0100 ++++ b/Makefile.in 2012-11-06 11:13:36.958297555 +0100 +@@ -827,20 +827,34 @@ + fi + + recho$(EXEEXT): $(SUPPORT_SRC)recho.c +- @$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) -o $@ $(SUPPORT_SRC)recho.c ${LIBS_FOR_BUILD} ++ @$(CC) $(CCFLAGS) -o $@ $< + + zecho$(EXEEXT): $(SUPPORT_SRC)zecho.c +- @$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) -o $@ $(SUPPORT_SRC)zecho.c ${LIBS_FOR_BUILD} ++ @$(CC) $(CCFLAGS) -o $@ $< + + printenv$(EXEEXT): $(SUPPORT_SRC)printenv.c +- @$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) -o $@ $(SUPPORT_SRC)printenv.c ${LIBS_FOR_BUILD} ++ @$(CC) $(CCFLAGS) -o $@ $< + + xcase$(EXEEXT): $(SUPPORT_SRC)xcase.c +- @$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) -o $@ $(SUPPORT_SRC)xcase.c ${LIBS_FOR_BUILD} ++ @$(CC) $(CCFLAGS) -o $@ $< + +-test tests check: force $(Program) $(TESTS_SUPPORT) ++test tests check: ++ @$(MAKE) install-test ++ @$(MAKE) runtest ++ ++install-test: buildtest ++ifeq ($(origin INSTALL_TEST_DIR), undefined) + @-test -d tests || mkdir tests + @cp $(TESTS_SUPPORT) tests ++else ++ @-test -d $(INSTALL_TEST_DIR) || mkdir -p $(INSTALL_TEST_DIR) ++ @cp -r $(srcdir)/tests/* $(INSTALL_TEST_DIR)/ ++ @cp $(TESTS_SUPPORT) $(INSTALL_TEST_DIR) ++endif ++ ++buildtest: force $(Program) $(TESTS_SUPPORT) ++ ++runtest: + @( cd $(srcdir)/tests && \ + PATH=$(BUILD_DIR)/tests:$$PATH THIS_SH=$(THIS_SH) $(SHELL) ${TESTSCRIPT} ) + 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 0000000000..66f1eee543 --- /dev/null +++ b/meta/recipes-extended/bash/bash-4.2/run-ptest @@ -0,0 +1,2 @@ +#!/bin/sh +echo Makefile: | make -f Makefile -f - -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 0000000000..7d0ce63f30 --- /dev/null +++ b/meta/recipes-extended/bash/bash-4.2/test-output.patch @@ -0,0 +1,25 @@ +Add FAIL/PASS output to test output. + +Signed-off-by: Björn Stenberg +Upstream-status: Pending +--- +diff -uNr a/tests/run-all b/tests/run-all +--- a/tests/run-all 1999-10-08 17:07:46.000000000 +0200 ++++ b/tests/run-all 2012-10-27 21:04:18.663331887 +0200 +@@ -22,7 +22,15 @@ + 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 f1de931e82..20a23f030f 100644 --- a/meta/recipes-extended/bash/bash.inc +++ b/meta/recipes-extended/bash/bash.inc @@ -4,7 +4,7 @@ SECTION = "base/shell" DEPENDS = "ncurses bison-native" -inherit autotools gettext update-alternatives +inherit autotools gettext update-alternatives ptest PARALLEL_MAKE = "" @@ -17,18 +17,32 @@ ALTERNATIVE_PRIORITY = "100" export AUTOHEADER = "true" +RDEPENDS_${PN}-ptest += "make" + do_configure_prepend () { if [ ! -e acinclude.m4 ]; then cat aclocal.m4 > acinclude.m4 fi } +do_compile_append () { + if [ "${PN}" = "${BPN}" -a ${PTEST_ENABLED} = "1" ]; then + oe_runmake buildtest + fi +} + 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}" -a ${PTEST_ENABLED} = "1" ]; then + ptest_do_install + make INSTALL_TEST_DIR=${D}${PTEST_PATH}/tests install-test + cp ${B}/Makefile ${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 07dda09e83..fefe7b799d 100644 --- a/meta/recipes-extended/bash/bash_4.2.bb +++ b/meta/recipes-extended/bash/bash_4.2.bb @@ -19,6 +19,9 @@ SRC_URI = "${GNU_MIRROR}/bash/${BPN}-${PV}.tar.gz;name=tarball \ ${GNU_MIRROR}/bash/bash-4.2-patches/bash42-010;apply=yes;striplevel=0;name=patch010 \ file://execute_cmd.patch;striplevel=0 \ file://mkbuiltins_have_stringize.patch \ + file://build-tests.patch \ + file://test-output.patch \ + file://run-ptest \ " SRC_URI[tarball.md5sum] = "3fb927c7c33022f1c327f14a81c0d4b0" -- cgit 1.2.3-korg