aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Slater <jslater@windriver.com>2016-01-12 14:56:04 -0800
committerMartin Jansa <Martin.Jansa@gmail.com>2016-02-10 15:08:19 +0100
commite28e6e1241ba6326c2a2dddb607bc525ab82ce5c (patch)
tree01e97850bc618c8b6dac1c9dfe4ecc583e2bc57b
parent9ab08d7b9ca47d85c07780b5c000abb21a9402ca (diff)
downloadmeta-openembedded-contrib-e28e6e1241ba6326c2a2dddb607bc525ab82ce5c.tar.gz
meta-openembedded-contrib-e28e6e1241ba6326c2a2dddb607bc525ab82ce5c.tar.bz2
meta-openembedded-contrib-e28e6e1241ba6326c2a2dddb607bc525ab82ce5c.zip
geoip: add ptest functionality
Also make geoip package rdepend on geoip-database and add symbolic link to GeoIPCity.dat. Signed-off-by: Joe Slater <jslater@windriver.com> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com> Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r--meta-networking/recipes-support/geoip/files/run-ptest11
-rw-r--r--meta-networking/recipes-support/geoip/geoip_1.6.6.bb38
2 files changed, 49 insertions, 0 deletions
diff --git a/meta-networking/recipes-support/geoip/files/run-ptest b/meta-networking/recipes-support/geoip/files/run-ptest
new file mode 100644
index 0000000000..14e96191f3
--- /dev/null
+++ b/meta-networking/recipes-support/geoip/files/run-ptest
@@ -0,0 +1,11 @@
+#!/bin/sh
+pdir=`dirname $0`
+cd ${pdir}/tests
+for i in ./benchmark ./test-geoip-city ; do
+ ${i} 1>/dev/null 2>&1;
+ if [ $? == 0 ]; then
+ echo PASS: $i;
+ else
+ echo FAIL: $i;
+ fi;
+done
diff --git a/meta-networking/recipes-support/geoip/geoip_1.6.6.bb b/meta-networking/recipes-support/geoip/geoip_1.6.6.bb
index 5037ae3009..06051542c5 100644
--- a/meta-networking/recipes-support/geoip/geoip_1.6.6.bb
+++ b/meta-networking/recipes-support/geoip/geoip_1.6.6.bb
@@ -13,6 +13,7 @@ SRC_URI = "git://github.com/maxmind/geoip-api-c.git \
http://geolite.maxmind.com/download/geoip/database/GeoIPv6.dat.gz;apply=no;name=GeoIPv6-dat \
http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz;apply=no;name=GeoLiteCity-dat \
http://geolite.maxmind.com/download/geoip/database/GeoLiteCityv6-beta/GeoLiteCityv6.dat.gz;apply=no;name=GeoLiteCityv6-dat \
+ file://run-ptest \
"
SRCREV = "ed3f3e2b87fba05a8f2a5b9b1328e7d55be8bf30"
@@ -47,9 +48,46 @@ do_install() {
install ${WORKDIR}/GeoIPv6.dat ${D}/${datadir}/GeoIP/
install ${WORKDIR}/GeoLiteCity.dat ${D}/${datadir}/GeoIP/
install ${WORKDIR}/GeoLiteCityv6.dat ${D}/${datadir}/GeoIP/
+ ln -s GeoLiteCity.dat ${D}${datadir}/GeoIP/GeoIPCity.dat
}
PACKAGES =+ "${PN}-database"
FILES_${PN}-database = ""
FILES_${PN}-database += "${datadir}/GeoIP/*"
+# We cannot do much looking up without databases.
+#
+RDEPENDS_${PN} += "${PN}-database"
+
+inherit ptest
+
+do_configure_ptest() {
+ sed -i -e "s/noinst_PROGRAMS = /test_PROGRAMS = /g" \
+ -e 's:SRCDIR=\\"$(top_srcdir)\\":SRCDIR=\\"$(testdir)\\":' \
+ ${S}/test/Makefile.am
+
+ if ! grep "^testdir = " ${S}/test/Makefile.am ; then
+ sed -e '/EXTRA_PROGRAMS = /itestdir = ${PTEST_PATH}/tests' \
+ -i ${S}/test/Makefile.am
+ fi
+
+ sed -i -e "s:/usr/local/share:/usr/share:g" \
+ ${S}/test/benchmark.c
+
+ sed -i -e 's:"../data/:"/usr/share/GeoIP/:g' \
+ ${S}/test/test-geoip-city.c \
+ ${S}/test/test-geoip-isp.c \
+ ${S}/test/test-geoip-asnum.c \
+ ${S}/test/test-geoip-netspeed.c \
+ ${S}/test/test-geoip-org.c \
+ ${S}/test/test-geoip-region.c
+}
+
+
+do_install_ptest() {
+ oe_runmake -C test DESTDIR=${D} install-testPROGRAMS
+ install ${S}/test/*.txt ${D}${PTEST_PATH}/tests
+}
+
+
+