Re: [yocto] [PATCH 3/3] Enable bash-ptest

2012-08-24 Thread Saul Wold

On 08/23/2012 07:20 AM, Björn Stenberg wrote:

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 000..e92fab3
--- /dev/null
+++ b/meta/recipes-extended/bash/bash-4.2/build-tests.patch


Thanks for proposing and getting the initial implementation started, 
this has been something we have been thinking about for a while, great 
to have the things like this become reality!


When introducing new patches, please follow the guidelines for patches 
and commit message:


http://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines

I know this is still and RFC, but your commits themselves also need 
Signed-off-by:




@@ -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 000..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 000..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-all2012-06-14 10:15:15.007467700 +0200
 b/tests/run-all2012-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
+}
+


One thing that we have discussed a couple of times, but no real outcome 
yet is to make the building of tests conditional so as more recipes are 
enabled with this kind of change, we don't extend the default build time 
too long.


What's been discussed is using DISTRO_FEATURE to test first.

Thoughts?



  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}
   

Re: [yocto] [PATCH 3/3] Enable bash-ptest

2012-08-24 Thread Richard Purdie
On Thu, 2012-08-23 at 16:20 +0200, Björn Stenberg wrote:
> 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 000..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.in2012-06-14 10:15:15.063465304 +0200
>  b/Makefile.in2012-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 && \


As it stands, I can bet on upstream saying "no" to this for good reason.
A better concept might be to introduce $(CC_FOR_TEST) which could
default to CC_FOR_BUILD. This would let us do what you're thinking here
yet keep upstream happy too.

Just thinking out loud really...

Cheers,

Richard

___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto