commit:     c418a02ed3285e2c08c109e207ba9d48f005cac8
Author:     Marco Scardovi <mscardovi <AT> icloud <DOT> com>
AuthorDate: Thu Nov 24 23:10:04 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Dec  6 11:57:10 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c418a02e

app-office/gnucash: make tests working

Signed-off-by: Marco Scardovi <mscardovi <AT> icloud.com>
Closes: https://github.com/gentoo/gentoo/pull/28349
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/gnucash-4.12-drop-broken-test.patch      | 30 ++++++++++++++++++++++
 .../gnucash/files/gnucash-4.12-fix-test.patch      | 24 +++++++++++++++++
 app-office/gnucash/gnucash-4.12.ebuild             | 25 +++++++++---------
 3 files changed, 67 insertions(+), 12 deletions(-)

diff --git a/app-office/gnucash/files/gnucash-4.12-drop-broken-test.patch 
b/app-office/gnucash/files/gnucash-4.12-drop-broken-test.patch
new file mode 100644
index 000000000000..c2b396bcf04f
--- /dev/null
+++ b/app-office/gnucash/files/gnucash-4.12-drop-broken-test.patch
@@ -0,0 +1,30 @@
+From a52795b022e040d7a93bb4dc352780d832c55390 Mon Sep 17 00:00:00 2001
+From: Marco Scardovi <[email protected]>
+Date: Sat, 26 Nov 2022 22:38:02 +0100
+Subject: [PATCH] Fix test
+
+Signed-off-by: Marco Scardovi <[email protected]>
+---
+ libgnucash/core-utils/test/CMakeLists.txt | 5 +----
+ 1 file changed, 1 insertion(+), 4 deletions(-)
+
+diff --git a/libgnucash/core-utils/test/CMakeLists.txt 
b/libgnucash/core-utils/test/CMakeLists.txt
+index 3b724c7c632..07add8b8699 100644
+--- a/libgnucash/core-utils/test/CMakeLists.txt
++++ b/libgnucash/core-utils/test/CMakeLists.txt
+@@ -19,9 +19,6 @@ endmacro()
+ add_core_utils_test(test-gnc-glib-utils test-gnc-glib-utils.c)
+ add_core_utils_test(test-resolve-file-path test-resolve-file-path.c)
+ add_core_utils_test(test-userdata-dir test-userdata-dir.c)
+-if (NOT MAC_INTEGRATION AND NOT WIN32)
+-  add_core_utils_test(test-userdata-dir-invalid-home 
test-userdata-dir-invalid-home.c)
+-endif()
+ if (MAC_INTEGRATION)
+   target_compile_options(test-userdata-dir PRIVATE ${OSX_EXTRA_COMPILE_FLAGS})
+   target_compile_definitions(test-userdata-dir PRIVATE 
${GTK_MAC_CFLAGS_OTHER})
+@@ -53,4 +50,4 @@ gnc_add_test(test-gnc-path-util 
"${test_gnc_path_util_SOURCES}"
+ 
+ set_dist_list(test_core_utils_DIST CMakeLists.txt
+   test-gnc-glib-utils.c test-resolve-file-path.c test-userdata-dir.c
+-  test-userdata-dir-invalid-home.c gtest-path-utilities.cpp)
++  gtest-path-utilities.cpp)

diff --git a/app-office/gnucash/files/gnucash-4.12-fix-test.patch 
b/app-office/gnucash/files/gnucash-4.12-fix-test.patch
new file mode 100644
index 000000000000..e80c712214e6
--- /dev/null
+++ b/app-office/gnucash/files/gnucash-4.12-fix-test.patch
@@ -0,0 +1,24 @@
+From 6fe2028bca49f455b7841d178a712baec8f72919 Mon Sep 17 00:00:00 2001
+From: Marco Scardovi <[email protected]>
+Date: Thu, 24 Nov 2022 23:20:07 +0100
+Subject: [PATCH] Fix test
+
+Signed-off-by: Marco Scardovi <[email protected]>
+---
+ libgnucash/engine/mocks/fake-qofquery.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libgnucash/engine/mocks/fake-qofquery.cpp 
b/libgnucash/engine/mocks/fake-qofquery.cpp
+index 15341189aa8..a82dadebf02 100644
+--- a/libgnucash/engine/mocks/fake-qofquery.cpp
++++ b/libgnucash/engine/mocks/fake-qofquery.cpp
+@@ -59,8 +59,8 @@ static class QofFakeQueryPool
+     {
+         ASSERT_TRUE(query_used((QofQuery*)query));
+         auto it = std::find(m_queriesUsed.begin(), m_queriesUsed.end(), 
query);
+-        m_queriesUsed.erase(it);
+         m_queriesConsumed.push_back(*it);
++        m_queriesUsed.erase(it);
+     }
+ 
+     /* Remove a formerly added QofFakeQueryObject from the pool */

diff --git a/app-office/gnucash/gnucash-4.12.ebuild 
b/app-office/gnucash/gnucash-4.12.ebuild
index 15c424472fbc..d19d9983eb5e 100644
--- a/app-office/gnucash/gnucash-4.12.ebuild
+++ b/app-office/gnucash/gnucash-4.12.ebuild
@@ -78,11 +78,11 @@ RDEPEND="
 
 DEPEND="
        ${RDEPEND}
-       >=dev-cpp/gtest-1.8.0
        >=sys-devel/gettext-0.20
        dev-lang/perl
        dev-perl/XML-Parser
        sys-devel/libtool
+       test? ( >=dev-cpp/gtest-1.8.0 )
 "
 
 BDEPEND="
@@ -106,16 +106,15 @@ PDEPEND="
 PATCHES=(
        "${FILESDIR}/${PN}"-3.8-examples-subdir.patch
        "${FILESDIR}/${PN}"-3.8-exclude-license.patch
+       "${FILESDIR}/${P}"-drop-broken-test.patch
+       # will be fixed on future version, see
+       # https://github.com/Gnucash/gnucash/pull/1472
+       "${FILESDIR}/${P}"-fix-test.patch
 )
 
-S="${WORKDIR}/${PN}-$(ver_cut 1-2)"
-
-# scardracs: 2022-11-21
-# I don't like that solution but actually these QA warnings
-# are false positives. If You are able to find a better
-# solution feel free to fix it.
-# bugs #734044 #814134
-QA_FLAGS_IGNORED=".*"
+# guile generates ELF files without use of C or machine code
+# It's a portage's false positive. bug #677600
+QA_PREBUILT='*[.]go'
 
 pkg_setup() {
        use python && python-single-r1_pkg_setup
@@ -124,6 +123,9 @@ pkg_setup() {
 src_prepare() {
        cmake_src_prepare
 
+       # http://debbugs.gnu.org/cgi/bugreport.cgi?bug=38112
+       find "${S}" -name "*.scm" -exec touch {} + || die
+
        # Fix tests writing to /tmp
        local fixtestfiles=(
                gnucash/report/test/test-report-html.scm
@@ -187,15 +189,14 @@ src_test() {
                        > "${BUILD_DIR}"/CTestCustom.cmake || die "Failed to 
disable test-qof and test-gnc-numeric!"
        fi
 
+       cd "${BUILD_DIR}" || die "Failed to enter ${BUILD_DIR}"
+       XDG_DATA_HOME="${T}/$(whoami)" eninja check
        cmake_src_test
 }
 
 src_install() {
        cmake_src_install
 
-       # strip is unable to recognise the format of the input files (*.go)
-       dostrip -x /usr/$(get_libdir)/guile
-
        if use examples ; then
                docompress -x /usr/share/doc/"${PF}"/examples
        else

Reply via email to