From 760127420cec852da7e8e72661c9ff70fa1c97c5 Mon Sep 17 00:00:00 2001 From: Anuj Mittal Date: Fri, 25 May 2018 14:20:03 +0800 Subject: gstreamer: enable ptest support Make sure that the tests are packaged and can be executed when ptest is enabled. Also, remove build host specific references from Makefile. (From OE-Core rev: d283b0eb909c78b020794ba78e7ec64c3fbee86f) Signed-off-by: Anuj Mittal Signed-off-by: Richard Purdie --- .../files/add-a-target-to-compile-tests.patch | 69 ++++++++++++++++++++++ meta/recipes-multimedia/gstreamer/files/run-ptest | 3 + .../gstreamer/gstreamer1.0_1.14.0.bb | 26 +++++++- 3 files changed, 96 insertions(+), 2 deletions(-) create mode 100644 meta/recipes-multimedia/gstreamer/files/add-a-target-to-compile-tests.patch create mode 100644 meta/recipes-multimedia/gstreamer/files/run-ptest (limited to 'meta/recipes-multimedia') diff --git a/meta/recipes-multimedia/gstreamer/files/add-a-target-to-compile-tests.patch b/meta/recipes-multimedia/gstreamer/files/add-a-target-to-compile-tests.patch new file mode 100644 index 0000000000..d02d869410 --- /dev/null +++ b/meta/recipes-multimedia/gstreamer/files/add-a-target-to-compile-tests.patch @@ -0,0 +1,69 @@ +From d61414bc17cf2df019510c2908048c4cabf5cf09 Mon Sep 17 00:00:00 2001 +From: Anuj Mittal +Date: Tue, 27 Feb 2018 09:27:01 +0800 +Subject: [PATCH] add targets for test installation + +Targets to make sure tests can be installed and then run on +the target. + +Upstream-Status: Inappropriate [specific to oe setup] + +Signed-off-by: Anuj Mittal + +--- + tests/check/Makefile.am | 27 ++++++++++++++++++++------- + 1 file changed, 20 insertions(+), 7 deletions(-) + +diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am +index 13b916d..a66786d 100644 +--- a/tests/check/Makefile.am ++++ b/tests/check/Makefile.am +@@ -8,11 +8,7 @@ REGISTRY_ENVIRONMENT = \ + GST_REGISTRY=$(CHECK_REGISTRY) + + AM_TESTS_ENVIRONMENT += \ +- GST_STATE_IGNORE_ELEMENTS="$(STATE_IGNORE_ELEMENTS)" \ +- $(REGISTRY_ENVIRONMENT) \ +- GST_PLUGIN_SCANNER_1_0=$(top_builddir)/libs/gst/helpers/gst-plugin-scanner \ +- GST_PLUGIN_SYSTEM_PATH_1_0= \ +- GST_PLUGIN_PATH_1_0=$(top_builddir)/plugins ++ GST_STATE_IGNORE_ELEMENTS="$(STATE_IGNORE_ELEMENTS)" + + plugindir = $(libdir)/gstreamer-@GST_API_VERSION@ + +@@ -178,6 +174,23 @@ noinst_PROGRAMS = + + TESTS = $(check_PROGRAMS) + ++install-ptest: $(TESTS) ++ @$(INSTALL) -d $(DESTDIR) ++ @for dir in `find -maxdepth 1 -type d`; do \ ++ if [ -x $$dir/.libs ]; then \ ++ $(INSTALL) -d $(DESTDIR)/$$dir; \ ++ $(INSTALL_PROGRAM) $$dir/.libs/* $(DESTDIR)/$$dir/; \ ++ fi \ ++ done ++ ++runtests: ++ @for b in $(TESTS); do \ ++ if [ -x $$b ]; then \ ++ $(AM_TESTS_ENVIRONMENT) $(SHELL) test-driver --test-name "$$b" \ ++ --log-file $$b.log --trs-file $$b.trs $$b; \ ++ fi \ ++ done ++ + noinst_HEADERS = \ + gst/capslist.h \ + gst/struct_arm.h \ +@@ -221,9 +234,9 @@ gst_gstprintf_LDADD = \ + $(LDADD) + + elements_fdsrc_CFLAGS=$(GST_OBJ_CFLAGS) $(AM_CFLAGS) \ +- -DTESTFILE=\"$(top_srcdir)/configure.ac\" ++ -DTESTFILE=\"Makefile\" + elements_filesrc_CFLAGS=$(GST_OBJ_CFLAGS) $(AM_CFLAGS) \ +- -DTESTFILE=\"$(top_srcdir)/configure.ac\" ++ -DTESTFILE=\"Makefile\" + + libs_controller_LDADD = \ + $(top_builddir)/libs/gst/controller/libgstcontroller-@GST_API_VERSION@.la \ diff --git a/meta/recipes-multimedia/gstreamer/files/run-ptest b/meta/recipes-multimedia/gstreamer/files/run-ptest new file mode 100644 index 0000000000..473d0b67a7 --- /dev/null +++ b/meta/recipes-multimedia/gstreamer/files/run-ptest @@ -0,0 +1,3 @@ +#!/bin/sh + +make -k runtests diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0_1.14.0.bb b/meta/recipes-multimedia/gstreamer/gstreamer1.0_1.14.0.bb index dec1783fdd..5ce9f24efe 100644 --- a/meta/recipes-multimedia/gstreamer/gstreamer1.0_1.14.0.bb +++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0_1.14.0.bb @@ -8,7 +8,7 @@ LICENSE = "LGPLv2+" DEPENDS = "glib-2.0 glib-2.0-native libcap libxml2 bison-native flex-native" -inherit autotools pkgconfig gettext upstream-version-is-even gobject-introspection gtk-doc +inherit autotools pkgconfig gettext upstream-version-is-even gobject-introspection gtk-doc ptest # This way common/m4/introspection.m4 will come first # (it has a custom INTROSPECTION_INIT macro, and so must be used instead of our common introspection.m4 file) @@ -24,11 +24,14 @@ SRC_URI = " \ file://0001-introspection.m4-prefix-pkgconfig-paths-with-PKG_CON.patch \ file://gtk-doc-tweaks.patch \ file://0001-gst-gstpluginloader.c-when-env-var-is-set-do-not-fal.patch \ + file://add-a-target-to-compile-tests.patch \ + file://run-ptest \ " SRC_URI[md5sum] = "63c7cbfb86aa28c4522e374dc5555b96" SRC_URI[sha256sum] = "fc361367f0d4b780a868a8833f9f30b9c9f4ac9faea4e6b251db8b4b0398466e" -PACKAGECONFIG ??= "" +PACKAGECONFIG ??= "${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)} \ + " PACKAGECONFIG[debug] = "--enable-debug,--disable-debug" PACKAGECONFIG[tests] = "--enable-tests,--disable-tests" @@ -54,6 +57,7 @@ FILES_${PN}-bash-completion += "${datadir}/bash-completion/completions/ ${datadi RRECOMMENDS_${PN}_qemux86 += "kernel-module-snd-ens1370 kernel-module-snd-rawmidi" RRECOMMENDS_${PN}_qemux86-64 += "kernel-module-snd-ens1370 kernel-module-snd-rawmidi" +RDEPENDS_${PN}-ptest += "make" delete_pkg_m4_file() { # This m4 file is out of date and is missing PKG_CONFIG_SYSROOT_PATH tweaks which we need for introspection @@ -67,4 +71,22 @@ do_compile_prepend() { export GIR_EXTRA_LIBS_PATH="${B}/gst/.libs:${B}/libs/gst/base/.libs" } +do_compile_ptest() { + oe_runmake build-checks +} + +do_install_ptest() { + oe_runmake -C tests/check DESTDIR=${D}${PTEST_PATH} install-ptest + install -m 644 ${B}/tests/check/Makefile ${D}${PTEST_PATH} + install -m 755 ${S}/test-driver ${D}${PTEST_PATH} + sed -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \ + -e 's|${DEBUG_PREFIX_MAP}||g' \ + -e 's:${HOSTTOOLS_DIR}/::g' \ + -e 's:${RECIPE_SYSROOT_NATIVE}::g' \ + -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \-e 's/^Makefile:/_Makefile:/' \ + -e 's/^srcdir = \(.*\)/srcdir = ./' -e 's/^top_srcdir = \(.*\)/top_srcdir = ./' \ + -e 's/^builddir = \(.*\)/builddir = ./' -e 's/^top_builddir = \(.*\)/top_builddir = ./' \ + -i ${D}${PTEST_PATH}/Makefile +} + CVE_PRODUCT = "gstreamer" -- cgit v1.2.3-54-g00ecf