[OE-core] [poky][meta][sumo][PATCH] lighttpd: added ptest

Aditya Tayade Aditya.Tayade at kpit.com
Mon Mar 4 18:21:15 UTC 2019


Reused lighttpd internal tests and did minimal patching to fix paths.

Upstream-Status: Pending

Signed-off-by: Aditya Tayade <Aditya.Tayade at kpit.com>
---
 ...-use-standard-sbin-and-lib-path-for-ptest.patch | 37 ++++++++++++
 meta/recipes-extended/lighttpd/lighttpd/run-ptest  |  4 ++
 meta/recipes-extended/lighttpd/lighttpd_1.4.48.bb  | 66 +++++++++++++++++++++-
 3 files changed, 106 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-extended/lighttpd/lighttpd/0002-use-standard-sbin-and-lib-path-for-ptest.patch
 create mode 100644 meta/recipes-extended/lighttpd/lighttpd/run-ptest

diff --git a/meta/recipes-extended/lighttpd/lighttpd/0002-use-standard-sbin-and-lib-path-for-ptest.patch b/meta/recipes-extended/lighttpd/lighttpd/0002-use-standard-sbin-and-lib-path-for-ptest.patch
new file mode 100644
index 0000000..cd4b2b3
--- /dev/null
+++ b/meta/recipes-extended/lighttpd/lighttpd/0002-use-standard-sbin-and-lib-path-for-ptest.patch
@@ -0,0 +1,37 @@
+lighttpd-ptest: use standard installation path
+
+ptest should do testing against installed library or executable
+at standard installation path, hence using standard installation
+path for MODULES_PATH and LIGHTTPD_PATH variables.
+
+Upsteam-Status: Pending
+
+Signed-off-by: Aditya Tayade <aditya.tayade at kpit.com>
+
+diff --git a/tests/LightyTest.pm b/tests/LightyTest.pm
+index 74caea1..2de02d0 100644
+--- a/tests/LightyTest.pm
++++ b/tests/LightyTest.pm
+@@ -65,19 +65,10 @@ sub new {
+ $lpath = (defined $ENV{'srcdir'} ? $ENV{'srcdir'} : '.');
+ $self->{SRCDIR} = abs_path($lpath);
+
++$self->{SBINDIR} = '/usr/sbin';
++$self->{MODULES_PATH} = '/usr/lib';
+
+-if (mtime($self->{BASEDIR}.'/src/lighttpd') > mtime($self->{BASEDIR}.'/build/lighttpd')) {
+-$self->{BINDIR} = $self->{BASEDIR}.'/src';
+-if (mtime($self->{BASEDIR}.'/src/.libs')) {
+-$self->{MODULES_PATH} = $self->{BASEDIR}.'/src/.libs';
+-} else {
+-$self->{MODULES_PATH} = $self->{BASEDIR}.'/src';
+-}
+-} else {
+-$self->{BINDIR} = $self->{BASEDIR}.'/build';
+-$self->{MODULES_PATH} = $self->{BASEDIR}.'/build';
+-}
+-$self->{LIGHTTPD_PATH} = $self->{BINDIR}.'/lighttpd';
++$self->{LIGHTTPD_PATH} = $self->{SBINDIR}.'/lighttpd';
+ $self->{PORT} = 2048;
+
+ my ($name, $aliases, $addrtype, $net) = gethostbyaddr(inet_aton("127.0.0.1"), AF_INET);
diff --git a/meta/recipes-extended/lighttpd/lighttpd/run-ptest b/meta/recipes-extended/lighttpd/lighttpd/run-ptest
new file mode 100644
index 0000000..b6781c0
--- /dev/null
+++ b/meta/recipes-extended/lighttpd/lighttpd/run-ptest
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+make -C tests -k check-TESTS
+make -C src -k runtest-TESTS
diff --git a/meta/recipes-extended/lighttpd/lighttpd_1.4.48.bb b/meta/recipes-extended/lighttpd/lighttpd_1.4.48.bb
index 3c4444c..6a9677e 100644
--- a/meta/recipes-extended/lighttpd/lighttpd_1.4.48.bb
+++ b/meta/recipes-extended/lighttpd/lighttpd_1.4.48.bb
@@ -9,6 +9,42 @@ SECTION = "net"
 RDEPENDS_${PN} = "lighttpd-module-dirlisting \
                   lighttpd-module-indexfile \
                   lighttpd-module-staticfile"
+
+RDEPENDS_${PN}-ptest += "bash \
+                         ${PN} \
+                         ${PN}-module-compress \
+                         ${PN}-module-simple-vhost \
+                         ${PN}-module-rewrite \
+                         ${PN}-module-cgi \
+                         ${PN}-module-evhost \
+                         ${PN}-module-redirect \
+                         ${PN}-module-fastcgi \
+                         ${PN}-module-setenv \
+                         ${PN}-module-extforward \
+                         ${PN}-module-secdownload \
+                         ${PN}-module-auth \
+                         ${PN}-module-authn-file \
+                         ${PN}-module-status \
+                         ${PN}-module-expire \
+                         ${PN}-module-userdir \
+                         ${PN}-module-ssi \
+                         ${PN}-module-proxy \
+                         perl-module-tap-base \
+                         perl-module-tap-parser-sourcehandler-executable \
+                         perl-module-tap-formatter-file \
+                         perl-module-tap-formatter-file-session \
+                         perl-module-tap-formatter-base \
+                         perl-module-tap-formatter-session \
+                         perl-module-tap-formatter-console-session \
+                         perl-module-tap-parser-scheduler \
+                         perl-module-tap-parser \
+                         perl-module-io-socket \
+                         perl-module-test-more \
+                         perl-module-test-harness \
+                         perl-module-tap-object \
+                         perl-module-tap-formatter-console \
+                        "
+
 RRECOMMENDS_${PN} = "lighttpd-module-access \
                      lighttpd-module-accesslog"

@@ -18,6 +54,8 @@ SRC_URI = "http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-${PV}.t
         file://lighttpd \
         file://lighttpd.service \
         file://0001-Use-pkg-config-for-pcre-dependency-instead-of-config.patch \
+        file://run-ptest \
+        file://0002-use-standard-sbin-and-lib-path-for-ptest.patch \
         "

 SRC_URI[md5sum] = "1e3a9eb5078f481e3a8a1d0aaac8c3c8"
@@ -49,7 +87,7 @@ PACKAGECONFIG[lua] = "--with-lua,--without-lua,lua5.1"

 EXTRA_OECONF += "--enable-lfs"

-inherit autotools pkgconfig update-rc.d gettext systemd
+inherit autotools pkgconfig update-rc.d gettext systemd ptest

 INITSCRIPT_NAME = "lighttpd"
 INITSCRIPT_PARAMS = "defaults 70"
@@ -73,6 +111,32 @@ do_install_append() {
 ln -sf ${localstatedir}/tmp ${D}/www/var
 }

+do_install_ptest() {
+    t="${D}${PTEST_PATH}"
+    for i in tests src
+    do
+        cp -r "${S}/${i}" "${t}"
+        cp -r "${B}/${i}"/* "${t}/${i}"
+        rm -rf "${t}/${i}"/*.lo "${t}/${i}"/*.la "${t}/${i}"/*.c "${t}/${i}"/*.o "${t}/${i}"/*.h
+    done
+
+    install -D "${B}/${TARGET_PREFIX}libtool" "${t}/${TARGET_PREFIX}libtool"
+
+    # Remove build host references...
+    find "${t}" -name "Makefile" | xargs \
+    sed -i -e "s/^srcdir = \(.*\)/srcdir = ./" \
+           -e "s/^Makefile/_Makefile/" \
+           -e "s,--sysroot=${STAGING_DIR_TARGET},,g" \
+           -e "s/^abs_builddir = \(.*\)/abs_builddir = ./" \
+           -e "s/^abs_srcdir = \(.*\)/abs_srcdir = ./" \
+           -e "s/^top_srcdir = \(.*\)/abs_srcdir = ../" \
+           -e "s,${TARGET_PREFIX}gcc,gcc,g" \
+           -e "s/^abs_top_srcdir = \(.*\)/abs_top_srcdir = ./" \
+           -e "s,${S},,g" \
+           -e "s,${B},,g" \
+           -e "s,${STAGING_DIR_NATIVE},,g"
+}
+
 FILES_${PN} += "${sysconfdir} /www"

 CONFFILES_${PN} = "${sysconfdir}/lighttpd.conf"
--
2.7.4

This message contains information that may be privileged or confidential and is the property of the KPIT Technologies Ltd. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. KPIT Technologies Ltd. does not accept any liability for virus infected mails.


More information about the Openembedded-core mailing list