Resolves: rhbz#1703972 Fix test suite
See upstream <https://sourceforge.net/p/clucene/bugs/232/> "Patches for TestIndexSearcher failures" for details. In the %check section: * "||:" is probably still needed to make some other failures "for ppc and s390 (big endian 32 bit archs)" non-fatal. * "--timeout 300" could presumably be removed now that 0002-Avoid-deadlock-in-TestIndexSearcher.patch takes care of the deadlock I occasionally experienced when running the tests. (It had been added with3693cab5ba
"2.3.3.4-14.20130812.e8e3d20git", but only mentioning "fix tests".) * "export CTEST_OUTPUT_ON_FAILURE=1" and "--output-on-failure" may or may not be relevant any longer. (They too had been added with3693cab5ba
"2.3.3.4-14.20130812.e8e3d20git", but only mentioning "fix tests".)
This commit is contained in:
parent
f29006b49a
commit
67d5de8487
40
0001-Make-sure-to-return-value-from-non-void-function.patch
Normal file
40
0001-Make-sure-to-return-value-from-non-void-function.patch
Normal file
@ -0,0 +1,40 @@
|
||||
From 44cc1d696b6528712d92d33660dd8017dcd0b3e2 Mon Sep 17 00:00:00 2001
|
||||
From: Stephan Bergmann <sbergman@redhat.com>
|
||||
Date: Wed, 31 Jul 2019 16:57:31 +0200
|
||||
Subject: [PATCH 1/2] Make sure to return value from non-void function
|
||||
|
||||
This had been commented out with 92145f058c88a9607341d8a20c3944a96ec00cf8
|
||||
"All remaining memory leaks int tests removed. Fixes made by Veit and Anthony
|
||||
Novatsis are incorporated" for no apparent reason---presumably by accident.
|
||||
|
||||
The effect (besides a -Wreturn-type warning) when building e.g. RelWithDebInfo
|
||||
(i.e., with optimizations) on Fedora 30 (with GCC 9.1) was that the implicit
|
||||
call to ~WhitespaceAnalyzer at the end of searchDocs was directly followed
|
||||
(lacking the code sequence corresponding to "return 0;") by some compiler-
|
||||
generated code to jump into some _Z10searchDocsPv.cold code (which is apparently
|
||||
meant as an optimization, to be called from certain cold conditions) which
|
||||
happened to also call ~WhitespaceAnalyzer. The net effect was that the
|
||||
|
||||
WhitespaceAnalyzer an;
|
||||
|
||||
object was deleted twice, causing a SIGSEGV.
|
||||
---
|
||||
src/test/search/TestIndexSearcher.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/test/search/TestIndexSearcher.cpp b/src/test/search/TestIndexSearcher.cpp
|
||||
index 5c410ff4..02c21aaf 100644
|
||||
--- a/src/test/search/TestIndexSearcher.cpp
|
||||
+++ b/src/test/search/TestIndexSearcher.cpp
|
||||
@@ -28,7 +28,7 @@ _LUCENE_THREAD_FUNC(searchDocs, _searcher) {
|
||||
_CLLDELETE(query);
|
||||
|
||||
CONDITION_WAIT(deleteMutex, deleteCondition);
|
||||
-// _LUCENE_THREAD_FUNC_RETURN(0);
|
||||
+ _LUCENE_THREAD_FUNC_RETURN(0);
|
||||
}
|
||||
|
||||
void testEndThreadException(CuTest *tc) {
|
||||
--
|
||||
2.21.0
|
||||
|
112
0002-Avoid-deadlock-in-TestIndexSearcher.patch
Normal file
112
0002-Avoid-deadlock-in-TestIndexSearcher.patch
Normal file
@ -0,0 +1,112 @@
|
||||
From bdc374bfbb0ca34ddb40713eb51d8535fdf11952 Mon Sep 17 00:00:00 2001
|
||||
From: Stephan Bergmann <sbergman@redhat.com>
|
||||
Date: Wed, 31 Jul 2019 16:27:33 +0200
|
||||
Subject: [PATCH 2/2] Avoid deadlock in TestIndexSearcher
|
||||
|
||||
---
|
||||
src/test/search/TestIndexSearcher.cpp | 51 +++++++++++++++++++++------
|
||||
1 file changed, 41 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/src/test/search/TestIndexSearcher.cpp b/src/test/search/TestIndexSearcher.cpp
|
||||
index 02c21aaf..a6dde5ba 100644
|
||||
--- a/src/test/search/TestIndexSearcher.cpp
|
||||
+++ b/src/test/search/TestIndexSearcher.cpp
|
||||
@@ -8,9 +8,11 @@
|
||||
|
||||
DEFINE_MUTEX(searchMutex);
|
||||
DEFINE_CONDITION(searchCondition);
|
||||
+bool searchReady;
|
||||
|
||||
DEFINE_MUTEX(deleteMutex);
|
||||
DEFINE_CONDITION(deleteCondition);
|
||||
+bool deleteReady;
|
||||
|
||||
_LUCENE_THREAD_FUNC(searchDocs, _searcher) {
|
||||
|
||||
@@ -19,15 +21,20 @@ _LUCENE_THREAD_FUNC(searchDocs, _searcher) {
|
||||
Query * query = QueryParser::parse(_T("one"), _T("content"), &an);
|
||||
Hits * hits = searcher->search(query);
|
||||
|
||||
-// _LUCENE_SLEEP(9999); //make sure that searchMutex is being waited on...
|
||||
+ {
|
||||
+ SCOPED_LOCK_MUTEX(searchMutex);
|
||||
+ searchReady = true;
|
||||
+ CONDITION_NOTIFYALL(searchCondition);
|
||||
+ }
|
||||
|
||||
- CONDITION_NOTIFYALL(searchCondition);
|
||||
SCOPED_LOCK_MUTEX(deleteMutex);
|
||||
|
||||
_CLLDELETE(hits);
|
||||
_CLLDELETE(query);
|
||||
|
||||
- CONDITION_WAIT(deleteMutex, deleteCondition);
|
||||
+ while (!deleteReady) {
|
||||
+ CONDITION_WAIT(deleteMutex, deleteCondition);
|
||||
+ }
|
||||
_LUCENE_THREAD_FUNC_RETURN(0);
|
||||
}
|
||||
|
||||
@@ -55,13 +62,24 @@ void testEndThreadException(CuTest *tc) {
|
||||
|
||||
// this sequence is OK: delete searcher after search thread finish
|
||||
{
|
||||
+ searchReady = false;
|
||||
+ deleteReady = false;
|
||||
+
|
||||
IndexSearcher * searcher = _CLNEW IndexSearcher(&ram);
|
||||
_LUCENE_THREADID_TYPE thread = _LUCENE_THREAD_CREATE(&searchDocs, searcher);
|
||||
- SCOPED_LOCK_MUTEX(searchMutex);
|
||||
|
||||
- CONDITION_WAIT(searchMutex, searchCondition);
|
||||
-// _LUCENE_SLEEP(9999); //make sure that deleteMutex is being waited on...
|
||||
- CONDITION_NOTIFYALL(deleteCondition);
|
||||
+ {
|
||||
+ SCOPED_LOCK_MUTEX(searchMutex);
|
||||
+ while (!searchReady) {
|
||||
+ CONDITION_WAIT(searchMutex, searchCondition);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ {
|
||||
+ SCOPED_LOCK_MUTEX(deleteMutex);
|
||||
+ deleteReady = true;
|
||||
+ CONDITION_NOTIFYALL(deleteCondition);
|
||||
+ }
|
||||
|
||||
_LUCENE_THREAD_JOIN(thread);
|
||||
|
||||
@@ -71,14 +89,27 @@ void testEndThreadException(CuTest *tc) {
|
||||
|
||||
// this produces memory exception: delete searcher after search finish but before thread finish
|
||||
{
|
||||
+ searchReady = false;
|
||||
+ deleteReady = false;
|
||||
+
|
||||
IndexSearcher * searcher = _CLNEW IndexSearcher(&ram);
|
||||
_LUCENE_THREADID_TYPE thread = _LUCENE_THREAD_CREATE(&searchDocs, searcher);
|
||||
- SCOPED_LOCK_MUTEX(searchMutex);
|
||||
|
||||
- CONDITION_WAIT(searchMutex, searchCondition);
|
||||
+ {
|
||||
+ SCOPED_LOCK_MUTEX(searchMutex);
|
||||
+ while (!searchReady) {
|
||||
+ CONDITION_WAIT(searchMutex, searchCondition);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
searcher->close();
|
||||
_CLLDELETE(searcher);
|
||||
- CONDITION_NOTIFYALL(deleteCondition);
|
||||
+
|
||||
+ {
|
||||
+ SCOPED_LOCK_MUTEX(deleteMutex);
|
||||
+ deleteReady = true;
|
||||
+ CONDITION_NOTIFYALL(deleteCondition);
|
||||
+ }
|
||||
|
||||
_LUCENE_THREAD_JOIN(thread);
|
||||
}
|
||||
--
|
||||
2.21.0
|
||||
|
@ -38,6 +38,10 @@ Patch51: clucene-core-2.3.3.4-install_contribs_lib.patch
|
||||
Patch52: clucene-core-2.3.3.4-CLuceneConfig.patch
|
||||
# Fix tests for undefined usleep
|
||||
Patch53: clucene-core-2.3.3.4-usleep.patch
|
||||
# Upstream at <https://sourceforge.net/p/clucene/bugs/232/> "Patches for
|
||||
# TestIndexSearcher failures":
|
||||
Patch54: 0001-Make-sure-to-return-value-from-non-void-function.patch
|
||||
Patch55: 0002-Avoid-deadlock-in-TestIndexSearcher.patch
|
||||
|
||||
%description
|
||||
CLucene is a C++ port of the popular Apache Lucene search engine
|
||||
@ -79,6 +83,8 @@ Requires: %{name}-core%{?_isa} = %{version}-%{release}
|
||||
%patch51 -p1 -b .install_contribs_lib
|
||||
%patch52 -p1 -b .CLuceneConfig
|
||||
%patch53 -p1 -b .usleep
|
||||
%patch54 -p1 -b .return-value
|
||||
%patch55 -p1 -b .avoid-deadlock
|
||||
|
||||
# nuke bundled code
|
||||
rm -rfv src/ext/{boost/,zlib/}
|
||||
|
Loading…
Reference in New Issue
Block a user