Patchwork [1/8] busybox: Add ptest

login
register
mail settings
Submitter Björn Stenberg
Date Feb. 19, 2013, 1:13 p.m.
Message ID <1361279644-17675-2-git-send-email-bjst@enea.com>
Download mbox | patch
Permalink /patch/44845/
State New
Headers show

Comments

Björn Stenberg - Feb. 19, 2013, 1:13 p.m.
From: Daniel Dai <daniel.dai@enea.com>


Signed-off-by: Björn Stenberg <bjst@enea.com>
---
 meta/recipes-core/busybox/busybox.inc       |    2 +-
 meta/recipes-core/busybox/busybox_1.20.2.bb |   10 ++++++++++
 meta/recipes-core/busybox/files/run-ptest   |   11 +++++++++++
 3 files changed, 22 insertions(+), 1 deletions(-)
 create mode 100644 meta/recipes-core/busybox/files/run-ptest
Bernhard Reutner-Fischer - Feb. 19, 2013, 2:04 p.m.
On 19 February 2013 14:13, Björn Stenberg <bjst@enea.com> wrote:
> From: Daniel Dai <daniel.dai@enea.com>
>
>
> Signed-off-by: Björn Stenberg <bjst@enea.com>
> ---
>  meta/recipes-core/busybox/busybox.inc       |    2 +-
>  meta/recipes-core/busybox/busybox_1.20.2.bb |   10 ++++++++++
>  meta/recipes-core/busybox/files/run-ptest   |   11 +++++++++++
>  3 files changed, 22 insertions(+), 1 deletions(-)
>  create mode 100644 meta/recipes-core/busybox/files/run-ptest
>
> diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc
> index 972e7d0..bd1581c 100644
> --- a/meta/recipes-core/busybox/busybox.inc
> +++ b/meta/recipes-core/busybox/busybox.inc
> @@ -35,7 +35,7 @@ CONFFILES_${PN}-mdev = "${sysconfdir}/mdev.conf"
>
>  RRECOMMENDS_${PN} = "${PN}-syslog ${PN}-udhcpc"
>
> -inherit cml1 update-rc.d
> +inherit cml1 update-rc.d ptest
>
>  # internal helper
>  def busybox_cfg(feature, features, tokens, cnf, rem):
> diff --git a/meta/recipes-core/busybox/busybox_1.20.2.bb b/meta/recipes-core/busybox/busybox_1.20.2.bb
> index 783261e..b2e5d47 100644
> --- a/meta/recipes-core/busybox/busybox_1.20.2.bb
> +++ b/meta/recipes-core/busybox/busybox_1.20.2.bb
> @@ -28,9 +28,19 @@ SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
>             file://fix-for-spurious-testsuite-failure.patch \
>             file://busybox-1.20.2-kernel_ver.patch \
>             file://stat-usr-bin.patch \
> +           file://run-ptest \
>             file://testsuite-du-du-k-works-fix-false-positive.patch"
>
>  SRC_URI[tarball.md5sum] = "e025414bc6cd79579cc7a32a45d3ae1c"
>  SRC_URI[tarball.sha256sum] = "eb13ff01dae5618ead2ef6f92ba879e9e0390f9583bd545d8789d27cf39b6882"
>
>  EXTRA_OEMAKE += "V=1 ARCH=${TARGET_ARCH} CROSS_COMPILE=${TARGET_PREFIX} SKIP_STRIP=y"
> +
> +do_install_append () {
> +    if [ "${PN}" = "${BPN}" -a ${PTEST_ENABLED} = "1" ]; then
> +        ptest_do_install
> +        cp -r ${B}/testsuite ${D}${PTEST_PATH}/
> +        cp ${B}/.config      ${D}${PTEST_PATH}/
> +        ln -s /bin/busybox   ${D}${PTEST_PATH}/busybox
> +    fi
> +}
> diff --git a/meta/recipes-core/busybox/files/run-ptest b/meta/recipes-core/busybox/files/run-ptest
> new file mode 100644
> index 0000000..8eadce9
> --- /dev/null
> +++ b/meta/recipes-core/busybox/files/run-ptest
> @@ -0,0 +1,11 @@
> +#!/bin/sh
> +
> +current_dir="`readlink -f $0`"

quoting the return value of a subshell is a bit arcane. Furthermore
you should nowadays make habit of using $()
current_dir=$(readlink -f $0)

> +export bindir="`dirname $current_dir`"
likewise
> +
> +cd testsuite
> +if [ $? -ne 0 ]; then
> +        exit 1
> +fi

just
cd testsuite || exit 1

> +
> +./runtest -v | sed  -e 's/^SKIPPED:/SKIP:/' | sed -e 's/^UNTESTED:/SKIP:/'

| sed -e 's/^(SKIPPED|UNTESTED):/SKIP:/'

thanks,

Patch

diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc
index 972e7d0..bd1581c 100644
--- a/meta/recipes-core/busybox/busybox.inc
+++ b/meta/recipes-core/busybox/busybox.inc
@@ -35,7 +35,7 @@  CONFFILES_${PN}-mdev = "${sysconfdir}/mdev.conf"
 
 RRECOMMENDS_${PN} = "${PN}-syslog ${PN}-udhcpc"
 
-inherit cml1 update-rc.d
+inherit cml1 update-rc.d ptest
 
 # internal helper
 def busybox_cfg(feature, features, tokens, cnf, rem):
diff --git a/meta/recipes-core/busybox/busybox_1.20.2.bb b/meta/recipes-core/busybox/busybox_1.20.2.bb
index 783261e..b2e5d47 100644
--- a/meta/recipes-core/busybox/busybox_1.20.2.bb
+++ b/meta/recipes-core/busybox/busybox_1.20.2.bb
@@ -28,9 +28,19 @@  SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
            file://fix-for-spurious-testsuite-failure.patch \
            file://busybox-1.20.2-kernel_ver.patch \
            file://stat-usr-bin.patch \
+           file://run-ptest \
            file://testsuite-du-du-k-works-fix-false-positive.patch"
 
 SRC_URI[tarball.md5sum] = "e025414bc6cd79579cc7a32a45d3ae1c"
 SRC_URI[tarball.sha256sum] = "eb13ff01dae5618ead2ef6f92ba879e9e0390f9583bd545d8789d27cf39b6882"
 
 EXTRA_OEMAKE += "V=1 ARCH=${TARGET_ARCH} CROSS_COMPILE=${TARGET_PREFIX} SKIP_STRIP=y"
+
+do_install_append () {
+    if [ "${PN}" = "${BPN}" -a ${PTEST_ENABLED} = "1" ]; then
+        ptest_do_install
+        cp -r ${B}/testsuite ${D}${PTEST_PATH}/
+        cp ${B}/.config      ${D}${PTEST_PATH}/
+        ln -s /bin/busybox   ${D}${PTEST_PATH}/busybox
+    fi
+}
diff --git a/meta/recipes-core/busybox/files/run-ptest b/meta/recipes-core/busybox/files/run-ptest
new file mode 100644
index 0000000..8eadce9
--- /dev/null
+++ b/meta/recipes-core/busybox/files/run-ptest
@@ -0,0 +1,11 @@ 
+#!/bin/sh
+
+current_dir="`readlink -f $0`"
+export bindir="`dirname $current_dir`"
+
+cd testsuite
+if [ $? -ne 0 ]; then
+        exit 1
+fi
+
+./runtest -v | sed  -e 's/^SKIPPED:/SKIP:/' | sed -e 's/^UNTESTED:/SKIP:/'