[OE-core] [PATCH v2] gzip: add ptest

Denys Zagorui denys.zagorui at globallogic.com
Mon Mar 13 16:37:01 UTC 2017


'zless' don't work with less from busybox. In this case test 'help-version'
fails. First of all 'zless' tries to figure out version of 'less' launching
'less -V', 'less' from busybox don't understand key -V. So 'zless' needs
to be fixed so that it can use 'less' from busybox.

'zdiff' test fixed so that it can use 'diff' from busybox
('diff' from busybox and 'diff' from diffutils has different output)

Signed-off-by: Denys Zagorui <denys.zagorui at globallogic.com>
---
 ...zdiff-add-diff-from-busybox-compatibility.patch | 40 ++++++++++++++++++++++
 meta/recipes-extended/gzip/files/run-ptest         |  6 ++++
 meta/recipes-extended/gzip/gzip_1.8.bb             | 19 +++++++++-
 3 files changed, 64 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-extended/gzip/files/0001-tests-zdiff-add-diff-from-busybox-compatibility.patch
 create mode 100644 meta/recipes-extended/gzip/files/run-ptest

diff --git a/meta/recipes-extended/gzip/files/0001-tests-zdiff-add-diff-from-busybox-compatibility.patch b/meta/recipes-extended/gzip/files/0001-tests-zdiff-add-diff-from-busybox-compatibility.patch
new file mode 100644
index 0000000..e64bf82
--- /dev/null
+++ b/meta/recipes-extended/gzip/files/0001-tests-zdiff-add-diff-from-busybox-compatibility.patch
@@ -0,0 +1,40 @@
+From 93673d1bc2af38dec512b05bc6d9262c6b45b5ad Mon Sep 17 00:00:00 2001
+From: Denys Zagorui <denys.zagorui at globallogic.com>
+Date: Fri, 10 Mar 2017 22:59:48 +0200
+Subject: [PATCH] tests/zdiff: add diff from busybox compatibility.
+
+Diff from busybox has another output than diff from diffutils
+
+Signed-off-by: Denys Zagorui <denys.zagorui at globallogic.com>
+Upstream-Status: Pending
+---
+ tests/zdiff | 13 +++++++------
+ 1 file changed, 7 insertions(+), 6 deletions(-)
+
+diff --git a/tests/zdiff b/tests/zdiff
+index 7ed2f34..2567d1a 100755
+--- a/tests/zdiff
++++ b/tests/zdiff
+@@ -24,12 +24,13 @@ echo a > a || framework_failure_
+ echo b > b || framework_failure_
+ gzip a b || framework_failure_
+
+-cat <<EOF > exp
+-1c1
+-< a
+----
+-> b
+-EOF
++diff -v 2>&1 > /dev/null | grep BusyBox
++
++if [ $? == 0 ];then
++    echo -e '--- /dev/fd/5\n+++ -\n@@ -1 +1 @@\n-a\n+b' > exp
++else
++    echo -e '1c1\n< a\n---\n> b' >exp
++fi
+
+ fail=0
+ returns_ 1 zdiff a.gz b.gz > out 2>&1 || fail=1
+--
+1.9.1
+
diff --git a/meta/recipes-extended/gzip/files/run-ptest b/meta/recipes-extended/gzip/files/run-ptest
new file mode 100644
index 0000000..cf7c649
--- /dev/null
+++ b/meta/recipes-extended/gzip/files/run-ptest
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+cd src/tests
+
+make check
+
diff --git a/meta/recipes-extended/gzip/gzip_1.8.bb b/meta/recipes-extended/gzip/gzip_1.8.bb
index 11be846..a4a39a6 100644
--- a/meta/recipes-extended/gzip/gzip_1.8.bb
+++ b/meta/recipes-extended/gzip/gzip_1.8.bb
@@ -2,7 +2,9 @@ require gzip.inc
 
 LICENSE = "GPLv3+"
 
-SRC_URI = "${GNU_MIRROR}/gzip/${BP}.tar.gz"
+SRC_URI = "${GNU_MIRROR}/gzip/${BP}.tar.gz \
+            file://0001-tests-zdiff-add-diff-from-busybox-compatibility.patch \
+            file://run-ptest"
 SRC_URI_append_class-target = " file://wrong-path-fix.patch"
 
 LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504 \
@@ -12,6 +14,21 @@ PROVIDES_append_class-native = " gzip-replacement-native"
 
 BBCLASSEXTEND = "native"
 
+inherit ptest
+
+do_install_ptest() {
+	mkdir -p ${D}${PTEST_PATH}/src/build-aux
+	cp ${S}/build-aux/test-driver ${D}${PTEST_PATH}/src/build-aux/
+	mkdir -p ${D}${PTEST_PATH}/src/tests
+	cp -r ${S}/tests/* ${D}${PTEST_PATH}/src/tests
+	sed -e 's/^abs_srcdir = ..*/abs_srcdir = \.\./' \
+            -e 's/^top_srcdir = ..*/top_srcdir = \.\./' \
+            -e 's/^AWK = ..*/AWK = awk/'                \
+            -e 's/^srcdir = ..*/srcdir = \./'           \
+            -e 's/^Makefile: ..*/Makefile: /'           \
+            ${B}/tests/Makefile > ${D}${PTEST_PATH}/src/tests/Makefile
+}
+
 SRC_URI[md5sum] = "732553152814b22dc35aa0267df5286c"
 SRC_URI[sha256sum] = "1ff7aedb3d66a0d73f442f6261e4b3860df6fd6c94025c2cb31a202c9c60fe0e"
 
-- 
1.9.1




More information about the Openembedded-core mailing list