Subject: bug#36675: [PATCH] gnu: kodi: Disable intermittently failing test.

From: Josh Holland <[email-masked]>
Date: Tue, 3 Dec 2019 13:52:14 +0000

As reported in <https://issues.guix.gnu.org/issue/36675>, occasionally the
TestMassEvent.General test in kodi crashes with a mutex error.

* gnu/packages/patches/kodi-skip-testmasseventgeneral.patch: New file.
* gnu/packages/kodi.scm (kodi)[source]: Use it.
* gnu/local.mk: (dist_patch_DATA): Add it.
---
I have tested building the kodi-wayland package with this patch, and
it successfully builds and the tests pass.

 gnu/local.mk                                  |  1 +
 gnu/packages/kodi.scm                         |  3 +-
 .../kodi-skip-testmasseventgeneral.patch      | 59 +++++++++++++++++++
 3 files changed, 62 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/kodi-skip-testmasseventgeneral.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index e2d922373e..4fc690c785 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1036,6 +1036,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/kodi-increase-test-timeout.patch		\
   %D%/packages/patches/kodi-set-libcurl-ssl-parameters.patch		\
   %D%/packages/patches/kodi-skip-test-449.patch		\
+  %D%/packages/patches/kodi-skip-testmasseventgeneral.patch     \
   %D%/packages/patches/laby-make-install.patch			\
   %D%/packages/patches/lcalc-default-parameters-1.patch		\
   %D%/packages/patches/lcalc-default-parameters-2.patch		\
diff --git a/gnu/packages/kodi.scm b/gnu/packages/kodi.scm
index 59ea11f812..04d879bd17 100644
--- a/gnu/packages/kodi.scm
+++ b/gnu/packages/kodi.scm
@@ -281,7 +281,8 @@ alternatives. In compilers, this can reduce the cascade of secondary errors.")
                 "1m0295czxabdcqyqf5m94av9d88pzhnzjvyfs1q07xqq82h313p7"))
               (patches (search-patches "kodi-skip-test-449.patch"
                                        "kodi-increase-test-timeout.patch"
-                                       "kodi-set-libcurl-ssl-parameters.patch"))
+                                       "kodi-set-libcurl-ssl-parameters.patch"
+                                       "kodi-skip-testmasseventgeneral.patch"))
               (snippet
                '(begin
                   (use-modules (guix build utils))
diff --git a/gnu/packages/patches/kodi-skip-testmasseventgeneral.patch b/gnu/packages/patches/kodi-skip-testmasseventgeneral.patch
new file mode 100644
index 0000000000..89fe60b598
--- /dev/null
+++ b/gnu/packages/patches/kodi-skip-testmasseventgeneral.patch
@@ -0,0 +1,59 @@
+This test has been intermittently failing since version 18.2 (see Guix
+bug 36675).
+
+438/521 Test #438: TestMassEvent.General ....................................................Child aborted***Exception:   0.82 sec
+Note: Google Test filter = TestMassEvent.General
+[==========] Running 1 test from 1 test case.
+[----------] Global test environment set-up.
+[----------] 1 test from TestMassEvent
+[ RUN      ] TestMassEvent.General
+[       OK ] TestMassEvent.General (105 ms)
+[----------] 1 test from TestMassEvent (105 ms total)
+
+[----------] Global test environment tear-down
+[==========] 1 test from 1 test case ran. (142 ms total)
+[  PASSED  ] 1 test.
+kodi-test: ../nptl/pthread_mutex_lock.c:434: __pthread_mutex_lock_full: Assertion `robust || (oldval & FUTEX_OWNER_DIED) == 0' failed.
+
+---
+ xbmc/threads/test/TestEvent.cpp | 19 +++++++++----------
+ 1 file changed, 9 insertions(+), 10 deletions(-)
+
+diff --git a/xbmc/threads/test/TestEvent.cpp b/xbmc/threads/test/TestEvent.cpp
+index 40e644c0ed..8fe329caa4 100644
+--- a/xbmc/threads/test/TestEvent.cpp
++++ b/xbmc/threads/test/TestEvent.cpp
+@@ -592,17 +592,17 @@ template <class W> void RunMassEventTest(std::vector<std::shared_ptr<W>>& m, boo
+ }
+
+
+-TEST(TestMassEvent, General)
+-{
+-  g_event = new CEvent();
++// TEST(TestMassEvent, General)
++// {
++//   g_event = new CEvent();
+
+-  std::vector<std::shared_ptr<mass_waiter>> m(NUMTHREADS);
+-  for(size_t i=0; i<NUMTHREADS; i++)
+-    m[i].reset(new mass_waiter());
++//   std::vector<std::shared_ptr<mass_waiter>> m(NUMTHREADS);
++//   for(size_t i=0; i<NUMTHREADS; i++)
++//     m[i].reset(new mass_waiter());
+
+-  RunMassEventTest(m,true);
+-  delete g_event;
+-}
++//   RunMassEventTest(m,true);
++//   delete g_event;
++// }
+
+ TEST(TestMassEvent, Polling)
+ {
+@@ -615,4 +615,3 @@ TEST(TestMassEvent, Polling)
+   RunMassEventTest(m,false);
+   delete g_event;
+ }
+-
+--
+2.24.0
--
2.24.0