Skip to content
Permalink
Browse files
Fixed #167, debug build crashed on exit.
Also added rlp testing to CI pipeline
  • Loading branch information
klirichek committed Dec 19, 2017
1 parent c627dd6 commit 0cfae4ce27434d7861e621fdb914be17f222131d
Showing with 54 additions and 34 deletions.
  1. +1 −0 .gitignore
  2. +12 −4 CMakeLists.txt
  3. +1 −0 config/config_cmake.h.in
  4. +20 −18 src/sphinxrlp.cpp
  5. +2 −0 test/CMakeLists.txt
  6. +4 −1 test/helpers.inc
  7. +1 −1 test/test_218/model.bin
  8. +4 −5 test/test_218/test.xml
  9. +4 −4 test/test_326/test.xml
  10. +3 −0 test/ubertest.php
  11. +2 −1 test/ubertest.php.in
@@ -58,6 +58,7 @@
/test/test_*/report.txt
/test/test_*/Conf
/test/data
/test/localsettings.inc

# /test/ql/
/test/ql/data/*.log
@@ -309,7 +309,7 @@ else ( WIN32 )
message ( STATUS "Option WITH_RLP ${WITH_RLP}" )
option ( WITH_RLP "compile with RLP library support" OFF )
if ( WITH_RLP )
SET ( RLP_ROOT "${MANTICORE_SOURCE_DIR}/rlp" CACHE PATH "RLP root folder." )
SET ( RLP_ROOT "${MANTICORE_SOURCE_DIR}" CACHE PATH "RLP root folder." )
if ( RLP_PATH )
if ( NOT RLP_ROOT )
set ( RLP_ROOT "${RLP_PATH}" )
@@ -320,7 +320,15 @@ else ( WIN32 )
endif ()

if ( RLP_ROOT )
if ( EXISTS "${RLP_ROOT}/rlp/include/bt_rlp_c.h" )
if ( EXISTS "${RLP_ROOT}/rlp/rlp/include/bt_rlp_c.h" )
set ( USE_RLP 1 )
elseif ( EXISTS "${RLP_ROOT}/rlp/include/bt_rlp_c.h" )
message ( WARNING "RLP_ROOT must point not to RLP sources folder, but to it's parent" )
GET_FILENAME_COMPONENT ( RLP_ROOT_NAME ${RLP_ROOT} NAME )
GET_FILENAME_COMPONENT ( RLP_ROOT ${RLP_ROOT} PATH )
if ( NOT ${RLP_ROOT_NAME} STREQUAL rlp )
message ( SEND_ERROR "RLP sources must be located in folder '${RLP_ROOT}/rlp', not '${RLP_ROOT}/${RLP_ROOT_NAME}'" )
endif ()
set ( USE_RLP 1 )
else ()
message ( SEND_ERROR "missing RLP sources from ${RLP_ROOT}" )
@@ -329,10 +337,10 @@ else ( WIN32 )

if ( USE_RLP )
if ( NOT RLP_LIBPATH )
file ( GLOB RLPLIBS "${RLP_ROOT}/lib/*gcc*" )
file ( GLOB RLPLIBS "${RLP_ROOT}/rlp/lib/*gcc*" )
endif ()

include_directories ( "${RLP_ROOT}/rlp/include" "${RLP_ROOT}/utilities/include" )
include_directories ( "${RLP_ROOT}/rlp/rlp/include" "${RLP_ROOT}/rlp/utilities/include" )
add_definitions ( "-D_REENTRANT" )
find_library ( LIBRLPC btrlpc HINT "${RLPLIBS}" )
find_library ( LIBRLPCORE btrlpcore HINT "${RLPLIBS}" )
@@ -132,6 +132,7 @@

/* RLP library support */
#cmakedefine USE_RLP ${USE_RLP}
#cmakedefine RLP_ROOT "${RLP_ROOT}"

/* define to use POSIX Syslog for logging */
#cmakedefine USE_SYSLOG ${USE_SYSLOG}
@@ -35,13 +35,20 @@
#define SHAREDIR "."
#endif

#ifndef RLP_ROOT
#define RLP_ROOT SHAREDIR
#define RLP_ENV SHAREDIR"/rlp-environment.xml"
#else
#define RLP_ENV RLP_ROOT"/rlp/etc/rlp-environment.xml"
#endif


CSphString g_sRLPRoot = SHAREDIR;
CSphString g_sRLPEnv = SHAREDIR"/rlp-environment.xml";
CSphString g_sRLPRoot { RLP_ROOT };
CSphString g_sRLPEnv { RLP_ENV };
int g_iRLPMaxBatchSize = 51200;
int g_iRLPMaxBatchDocs = 50;

BT_RLP_EnvironmentC * g_pRLPEnv = NULL;
BT_RLP_EnvironmentC * g_pRLPEnv = nullptr;


static void RLPLog ( void *, int iChannel, const char * szMessage )
@@ -74,7 +81,7 @@ static bool sphRLPInit ( const char * szRootPath, const char * szEnvPath, CSphSt
}

BT_RLP_Environment_SetBTRootDirectory ( szRootPath );
BT_RLP_Environment_SetLogCallbackFunction ( NULL, RLPLog );
BT_RLP_Environment_SetLogCallbackFunction ( nullptr, RLPLog );
BT_RLP_Environment_SetLogLevel ( "error" );

g_pRLPEnv = BT_RLP_Environment_Create();
@@ -89,7 +96,7 @@ static bool sphRLPInit ( const char * szRootPath, const char * szEnvPath, CSphSt
{
sError = "Unable to initialize the RLP environment";
BT_RLP_Environment_Destroy ( g_pRLPEnv );
g_pRLPEnv = NULL;
g_pRLPEnv = nullptr;
return false;
}
}
@@ -100,9 +107,9 @@ static bool sphRLPInit ( const char * szRootPath, const char * szEnvPath, CSphSt

void sphRLPDone ()
{
assert ( g_pRLPEnv );
BT_RLP_Environment_Destroy ( g_pRLPEnv );
g_pRLPEnv = NULL;
if ( g_pRLPEnv )
BT_RLP_Environment_Destroy ( g_pRLPEnv );
g_pRLPEnv = nullptr;
}


@@ -113,11 +120,6 @@ class CSphRLPPreprocessor
: m_sRootPath ( szRootPath )
, m_sEnvPath ( szEnvPath )
, m_sCtxPath ( szCtxPath )
, m_pContext ( NULL )
, m_pFactory ( NULL )
, m_pTokenIterator ( NULL )
, m_iNextCompoundComponent ( -1 )
, m_bInitialized ( false )
{
sphUTF8Encode ( m_pMarkerChunkSeparator, PROXY_CHUNK_SEPARATOR );
}
@@ -218,11 +220,11 @@ class CSphRLPPreprocessor
static const int MAX_TOKEN_LEN = 1024;
static const int MAX_CHUNK_SIZE = 10485760;

BT_RLP_ContextC * m_pContext;
BT_RLP_TokenIteratorFactoryC * m_pFactory;
BT_RLP_TokenIteratorC * m_pTokenIterator;
int m_iNextCompoundComponent;
bool m_bInitialized;
BT_RLP_ContextC * m_pContext = nullptr;
BT_RLP_TokenIteratorFactoryC * m_pFactory = nullptr;
BT_RLP_TokenIteratorC * m_pTokenIterator = nullptr;
int m_iNextCompoundComponent = -1;
bool m_bInitialized = false;
CSphTightVector<BYTE> m_dCJKBuffer;
CSphTightVector<BYTE> m_dNonCJKBuffer;
CSphTightVector<TextChunk_t> m_dNonCJKChunks;
@@ -54,6 +54,7 @@ if ( NOT DISABLE_TESTING )
COMMAND php ubertest.php
-b "${MANTICORE_BINARY_DIR}/src/"
-t "${MANTICORE_BINARY_DIR}/test/"
-r "${RLP_ROOT}"
--ctest -u test --strict-verbose --no-demo
t ${onetest} )
add_test ( NAME "\"rt_${tst_name}\""
@@ -62,6 +63,7 @@ if ( NOT DISABLE_TESTING )
COMMAND php ubertest.php
-b "${MANTICORE_BINARY_DIR}/src/"
-t "${MANTICORE_BINARY_DIR}/test/"
-r "${RLP_ROOT}"
--ctest -u test --strict-verbose --no-demo
--rt --ignore-weights
t ${onetest} )
@@ -495,7 +495,7 @@ function StartSearchd ( $config_file, $error_file, $pidfile, &$error, $use_watch
function StopSearchd ( $config, $pidfile )
{
global $g_locals, $action_retries, $action_wait_timeout;

$ret = 0;
$abs_config = testdir($config);
$abs_pidfile = testdir($pidfile);

@@ -512,10 +512,12 @@ function StopSearchd ( $config, $pidfile )
$i++;
}
}
return $ret;
}

function StopWaitSearchd ( $config, $pidfile )
{
return StopSearchd ( $config, $pidfile );
global $g_locals;
$ret = 0;

@@ -3113,6 +3115,7 @@ class SphinxConfig

case "local": fwrite ( $fp, $this->GetLocal ( $node->nodeValue ) ); return;
case "test_root": fwrite ( $fp, dirname(__FILE__) ); return;
case "rlp_root": fwrite ( $fp, $g_locals['rlproot'] ); return;
case "this_test": fwrite ( $fp, $this->_testdir ); return;
case "testdir": {
if ( $g_locals['testdir'] == '' ) {

Large diffs are not rendered by default.

@@ -16,7 +16,6 @@ indexer
searchd
{
<searchd_settings/>
workers = threads
}

source test
@@ -49,7 +48,7 @@ index base
</dynamic>

blend_chars = -, U+23
rlp_context = ../rlp/samples/etc/rlp-chinese-context.xml
rlp_context = <rlp_root/>/rlp/samples/etc/rlp-chinese-context.xml
}

index test : base
@@ -102,13 +101,13 @@ index test_spec
U+F900..U+FAD9, U+20000..U+2FA1D

morphology = rlp_chinese_batched
rlp_context = ../rlp/samples/etc/rlp-chinese-context.xml
rlp_context = <rlp_root/>/rlp/samples/etc/rlp-chinese-context.xml
}

common
{
rlp_root = ..
rlp_environment = ../rlp/etc/rlp-environment.xml
rlp_root = <rlp_root/>
rlp_environment = <rlp_root/>/rlp/etc/rlp-environment.xml
}
</config>

@@ -36,7 +36,7 @@ index test
U+F900..U+FAD9, U+20000..U+2FA1D

morphology = rlp_chinese_batched, stem_enru
rlp_context = ../rlp/samples/etc/rlp-chinese-context.xml
rlp_context = <rlp_root/>/rlp/samples/etc/rlp-chinese-context.xml
index_field_lengths = 1
}

@@ -50,7 +50,7 @@ index rt
U+F900..U+FAD9, U+20000..U+2FA1D

morphology = rlp_chinese_batched, stem_enru
rlp_context = ../rlp/samples/etc/rlp-chinese-context.xml
rlp_context = <rlp_root/>/rlp/samples/etc/rlp-chinese-context.xml

rt_field = content
rt_field = text
@@ -59,8 +59,8 @@ index rt

common
{
rlp_root = ..
rlp_environment = ../rlp/etc/rlp-environment.xml
rlp_root = <rlp_root/>
rlp_environment = <rlp_root/>/rlp/etc/rlp-environment.xml
}
</config>

@@ -40,6 +40,7 @@
print ( "-i, --indexer <PATH>\tpath to indexer\n" );
print ( "-s, --searchd <PATH>\tpath to searchd\n" );
print ( "-b, --bindir <PATH>\tpath to all binaries\n" );
print ( "-r, --rlproot <PATH>\tpath to RLP root (if rlp tested)\n" );
print ( "-t, --testdir <PATH>\tpath where to work and create artefacts\n" );
print ( "--ctest\t\tPrint test report to console (for automatic grabbing)\n" );
print ( "--strict\t\tterminate on the first failure (for automatic runs)\n" );
@@ -70,6 +71,7 @@
$locals['rt_mode'] = false;
$locals['testdir'] = '';
$locals['ctest'] = false;
$locals['rlproot'] = '..';

if ( array_key_exists ( "DBUSER", $_ENV ) && $_ENV["DBUSER"] )
$locals['db-user'] = $_ENV["DBUSER"];
@@ -99,6 +101,7 @@
else if ( $arg=="-s" || $arg=="--searchd" ) $locals['searchd'] = $args[++$i];
else if ( $arg=="-b" || $arg=="--bindir" ) $locals['bin'] = $args[++$i];
else if ( $arg=="-t" || $arg=="--testdir" ) $locals['testdir'] = $args[++$i];
else if ( $arg=="-r" || $arg=="--rlproot" ) $locals['rlproot'] = $args[++$i];
else if ( $arg=="--ctest" ) { $locals['ctest'] = true; $force_guess = false; }
else if ( $arg=="--rt" ) $locals['rt_mode'] = true;
else if ( $arg=="--test-thd-pool" ) $locals['use_pool'] = true;
@@ -6,6 +6,7 @@
$bindir = "@MANTICORE_BINARY_DIR@/src/";
$testdir = "@MANTICORE_BINARY_DIR@/test/";
$testsrc = "@CMAKE_CURRENT_SOURCE_DIR@";
$rlproot = "@RLP_ROOT@";

chdir ("$testsrc");
$shellcmd = PHP_BINARY . " ubertest.php";
@@ -14,7 +15,7 @@ $args = $_SERVER["argv"];
array_shift ( $args );
if ( is_array($args) && !empty($args) )
{
$shellcmd .= " -b \"$bindir\" -t \"$testdir\" ";
$shellcmd .= " -b \"$bindir\" -t \"$testdir\" -r \"$rlproot\" ";
$shellcmd .= join(" ", $args);
}

0 comments on commit 0cfae4c

Please sign in to comment.