media-sound/xmms2: Add knob to disable valgrind at test runtime, bug #424377
authorSergei Trofimovich <slyfox@gentoo.org>
Sat, 2 Apr 2016 12:03:58 +0000 (13:03 +0100)
committerSergei Trofimovich <slyfox@gentoo.org>
Sat, 2 Apr 2016 12:04:07 +0000 (13:04 +0100)
When valgrind is installed in system but is not
working we should still be able to run tests.

Reported-by: Diego Elio Pettenò
Bug: https://bugs.gentoo.org/424377

Package-Manager: portage-2.2.28

media-sound/xmms2/files/xmms2-0.8-rtvg.patch [new file with mode: 0644]
media-sound/xmms2/metadata.xml
media-sound/xmms2/xmms2-0.8-r2.ebuild

diff --git a/media-sound/xmms2/files/xmms2-0.8-rtvg.patch b/media-sound/xmms2/files/xmms2-0.8-rtvg.patch
new file mode 100644 (file)
index 0000000..20be342
--- /dev/null
@@ -0,0 +1,36 @@
+Add knob to disable valgrind at test runtime.
+
+When valgrind is installed in system but is not
+working we should still be able to run tests.
+
+Reported-by: Diego Elio Pettenò
+Bug: https://bugs.gentoo.org/424377
+diff --git a/waftools/unittest.py b/waftools/unittest.py
+index 4317287..6179dfd 100644
+--- a/waftools/unittest.py
++++ b/waftools/unittest.py
+@@ -64,7 +64,8 @@ def generate_coverage(bld):
+ def configure(conf):
+     conf.load("waf_unit_test")
+-    conf.find_program("valgrind", var="VALGRIND", mandatory=False)
++    if conf.options.enable_valgrind is True:
++        conf.find_program("valgrind", var="VALGRIND", mandatory=False)
+     conf.find_program("lcov", var="LCOV", mandatory=False)
+     conf.find_program("genhtml", var="GENHTML", mandatory=False)
+diff --git a/wscript b/wscript
+index 99c1fa3..a98d5e3 100644
+--- a/wscript
++++ b/wscript
+@@ -501,6 +501,10 @@ def options(opt):
+                    dest='ldconfig', help="Run ldconfig after install even if not root")
+     opt.add_option('--without-ldconfig', action='store_false',
+                    dest='ldconfig', help="Don't run ldconfig after install")
++    opt.add_option('--with-valgrind', action='store_true', default=None,
++                   dest='enable_valgrind', help="Run testsuite under valgrind (if present).")
++    opt.add_option('--without-valgrind', action='store_false', default=None,
++                   dest='enable_valgrind', help="Don't run testsuite under valgrind.")
+     opt.sub_options("src/xmms")
+     for o in optional_subdirs + subdirs:
index 099b50138aa510140d7dbf8cbab3876aee6daa8f..acb83130968b6c75155ee931794ca5f5da77cfef 100644 (file)
@@ -40,6 +40,7 @@
                <flag name="phonehome">This client sends anonymous usage-statistics to the xmms2</flag>
                <flag name="server">Build xmms2 player daemon (otherwise only clients are built)</flag>
                <flag name="sid">Support for C64 SID</flag>
+               <flag name="valgrind">Run unit tests under valgrind.</flag>
                <flag name="vocoder">Phase vocoder effect plugin</flag>
                <flag name="mlib-update">Enable building of xmms2-mlib-updater client</flag>
                <flag name="xml">Enable support for various XML based playlists and sources: RSS, XSPF</flag>
index 4500c37e84e44576b09e025aa0b24546a7ad09d2..515550e1f20a324f6ba1139375fc7d6ed5aeee82 100644 (file)
@@ -19,7 +19,7 @@ KEYWORDS="alpha amd64 ppc x86"
 IUSE="aac airplay +alsa ao asf avahi cdda curl cxx ffmpeg flac gvfs ices
 jack mac mlib-update mms +mad modplug mp3 mp4 musepack ofa oss
 perl phonehome pulseaudio python ruby
-samba +server sid sndfile speex test +vorbis vocoder wavpack xml"
+samba +server sid sndfile speex test valgrind +vorbis vocoder wavpack xml"
 
 RDEPEND="server? (
                >=dev-db/sqlite-3.3.4
@@ -73,7 +73,8 @@ DEPEND="${RDEPEND}
        perl? ( dev-perl/Module-Build
                virtual/perl-Module-Metadata )
        virtual/pkgconfig
-       test? ( dev-util/cunit )
+       test? ( dev-util/cunit
+               valgrind? ( dev-util/valgrind ) )
        "
 
 S="${WORKDIR}/${MY_P}"
@@ -116,13 +117,14 @@ src_prepare() {
        epatch "${FILESDIR}/${P}"-ffmpeg2.patch #536232
        epatch "${FILESDIR}/${P}"-cpython.patch
        epatch "${FILESDIR}/${P}"-modpug.patch #536046
-       epatch "${FILESDIR}/${P}"-audio4-p1.patch
+       epatch "${FILESDIR}/${P}"-audio4-p1.patch #540890
        epatch "${FILESDIR}/${P}"-audio4-p2.patch
        epatch "${FILESDIR}/${P}"-audio4-p3.patch
        epatch "${FILESDIR}/${P}"-audio4-p4.patch
        epatch "${FILESDIR}/${P}"-audio4-p5.patch
        epatch "${FILESDIR}/${P}"-audio4-p6.patch
        epatch "${FILESDIR}/${P}"-audio4-p7.patch
+       epatch "${FILESDIR}/${P}"-rtvg.patch #424377
 
        if has_version dev-libs/libcdio-paranoia; then
                sed -i -e 's:cdio/cdda.h:cdio/paranoia/cdda.h:' src/plugins/cdda/cdda.c || die
@@ -242,6 +244,7 @@ src_configure() {
        # pass them explicitely even if empty as we try to avoid magic deps
        waf_params+=" --with-optionals=${optionals:1}" # skip first ',' if yet
        waf_params+=" --with-plugins=${plugins:1}"
+       waf_params+=" $(use_with valgrind)"
 
        CC="$(tc-getCC)"         \
        CPP="$(tc-getCPP)"       \