commit:     426319a77ffacc477bb625eabf2ab34cdcaf156c
Author:     Kacper Słomiński <kacper.slominski72 <AT> gmail <DOT> com>
AuthorDate: Sat Feb 17 15:01:58 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Feb 18 00:03:56 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=426319a7

media-libs/noise-suppression-for-voice: Fix tests with gcc[-sanitize]

Upstream unconditionally adds -fsanitize=undefined to the test
executable target, but this is too unreliable to be worth the trouble
(e.g. doesn't work with gcc[-sanitize], and it probably causes other
issues).

Also fix running tests. The CMakeLists.txt configuration causes the
CTest file to end up in a subdirectory, which cmake_src_test doesn't
expect.

Also add USE="test", as the tests actually take a noticable amount of
time to compile compared to the rest of the files.

Closes: https://bugs.gentoo.org/924145
Signed-off-by: Kacper Słomiński <kacper.slominski72 <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/35396
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../noise-suppression-for-voice-1.03-tests.patch   | 28 ++++++++++++++++++++++
 .../noise-suppression-for-voice-1.03.ebuild        | 15 ++++++++++--
 .../noise-suppression-for-voice-9999.ebuild        | 15 ++++++++++--
 3 files changed, 54 insertions(+), 4 deletions(-)

diff --git 
a/media-libs/noise-suppression-for-voice/files/noise-suppression-for-voice-1.03-tests.patch
 
b/media-libs/noise-suppression-for-voice/files/noise-suppression-for-voice-1.03-tests.patch
new file mode 100644
index 000000000000..d9f8bd5a0d33
--- /dev/null
+++ 
b/media-libs/noise-suppression-for-voice/files/noise-suppression-for-voice-1.03-tests.patch
@@ -0,0 +1,28 @@
+From bf7a468427048f91b0759b9f5eb320cf61ca3ea9 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Kacper=20S=C5=82omi=C5=84ski?=
+ <[email protected]>
+Date: Sat, 17 Feb 2024 15:25:53 +0100
+Subject: [PATCH] Get rid of -fsanitize=undefined for tests
+
+Upstream PR: https://github.com/werman/noise-suppression-for-voice/pull/189
+
+---
+ src/common/CMakeLists.txt | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
+index 4c2300e..273d76e 100644
+--- a/src/common/CMakeLists.txt
++++ b/src/common/CMakeLists.txt
+@@ -33,8 +33,6 @@ if (BUILD_TESTS)
+             $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/external/catch2>
+             $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+     target_link_libraries(common_plugin_tests PRIVATE ${LIBRARIES})
+-    target_compile_options(common_plugin_tests PRIVATE -fsanitize=undefined)
+-    target_link_options(common_plugin_tests PRIVATE -fsanitize=undefined)
+ 
+     include(CTest)
+     include(Catch)
+-- 
+2.43.0
+

diff --git 
a/media-libs/noise-suppression-for-voice/noise-suppression-for-voice-1.03.ebuild
 
b/media-libs/noise-suppression-for-voice/noise-suppression-for-voice-1.03.ebuild
index fd064b4d1b2b..78ff0308a9d3 100644
--- 
a/media-libs/noise-suppression-for-voice/noise-suppression-for-voice-1.03.ebuild
+++ 
b/media-libs/noise-suppression-for-voice/noise-suppression-for-voice-1.03.ebuild
@@ -1,4 +1,4 @@
-# Copyright 2020-2023 Gentoo Authors
+# Copyright 2020-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -14,13 +14,18 @@ if [[ "${PV}" == "9999" ]]; then
 else
        
SRC_URI="https://github.com/werman/noise-suppression-for-voice/archive/v${PV}.tar.gz
 -> ${P}.tar.gz"
        KEYWORDS="~amd64 ~x86"
+
+       PATCHES=(
+               "${FILESDIR}/${P}-tests.patch"
+       )
 fi
 
 LICENSE="GPL-3+"
 SLOT="0"
 
-IUSE="+ladspa lv2 vst vst3"
+IUSE="+ladspa lv2 vst vst3 test"
 REQUIRED_USE="|| ( ladspa lv2 vst vst3 )"
+RESTRICT="!test? ( test )"
 
 COMMON_DEPEND="
        media-libs/freetype
@@ -44,8 +49,14 @@ src_configure() {
                -DBUILD_LV2_PLUGIN=$(usex lv2 ON OFF)
                -DBUILD_VST_PLUGIN=$(usex vst ON OFF)
                -DBUILD_VST3_PLUGIN=$(usex vst3 ON OFF)
+               -DBUILD_TESTS=$(usex test ON OFF)
                -DBUILD_AU_PLUGIN=OFF
                -DBUILD_AUV3_PLUGIN=OFF
        )
        cmake_src_configure
 }
+
+src_test() {
+       cp "${BUILD_DIR}/src/common/CTestTestfile.cmake" 
"${BUILD_DIR}/CTestTestfile.cmake" || die
+       cmake_src_test
+}

diff --git 
a/media-libs/noise-suppression-for-voice/noise-suppression-for-voice-9999.ebuild
 
b/media-libs/noise-suppression-for-voice/noise-suppression-for-voice-9999.ebuild
index fd064b4d1b2b..78ff0308a9d3 100644
--- 
a/media-libs/noise-suppression-for-voice/noise-suppression-for-voice-9999.ebuild
+++ 
b/media-libs/noise-suppression-for-voice/noise-suppression-for-voice-9999.ebuild
@@ -1,4 +1,4 @@
-# Copyright 2020-2023 Gentoo Authors
+# Copyright 2020-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -14,13 +14,18 @@ if [[ "${PV}" == "9999" ]]; then
 else
        
SRC_URI="https://github.com/werman/noise-suppression-for-voice/archive/v${PV}.tar.gz
 -> ${P}.tar.gz"
        KEYWORDS="~amd64 ~x86"
+
+       PATCHES=(
+               "${FILESDIR}/${P}-tests.patch"
+       )
 fi
 
 LICENSE="GPL-3+"
 SLOT="0"
 
-IUSE="+ladspa lv2 vst vst3"
+IUSE="+ladspa lv2 vst vst3 test"
 REQUIRED_USE="|| ( ladspa lv2 vst vst3 )"
+RESTRICT="!test? ( test )"
 
 COMMON_DEPEND="
        media-libs/freetype
@@ -44,8 +49,14 @@ src_configure() {
                -DBUILD_LV2_PLUGIN=$(usex lv2 ON OFF)
                -DBUILD_VST_PLUGIN=$(usex vst ON OFF)
                -DBUILD_VST3_PLUGIN=$(usex vst3 ON OFF)
+               -DBUILD_TESTS=$(usex test ON OFF)
                -DBUILD_AU_PLUGIN=OFF
                -DBUILD_AUV3_PLUGIN=OFF
        )
        cmake_src_configure
 }
+
+src_test() {
+       cp "${BUILD_DIR}/src/common/CTestTestfile.cmake" 
"${BUILD_DIR}/CTestTestfile.cmake" || die
+       cmake_src_test
+}

Reply via email to