Permalink
Browse files

Fix #427, add valgrind support to to ubertests

Either add --valgrind-searchd for one-time run,
either add 'valgrindsearchd'=>true to .sphinx config file.
Suppression file test/valgrind.supp will be in game.
  • Loading branch information...
klirichek committed Aug 21, 2018
1 parent 1d17669 commit 6da0df4ac9946fc59f98d229b90e12c9221dd4c0
Showing with 23 additions and 4 deletions.
  1. +21 −4 test/helpers.inc
  2. +2 −0 test/ubertest.php
@@ -371,11 +371,25 @@ function StartSearchd ( $config_file, $error_file, $pidfile, &$error, $use_watch
$abs_error_file = testdir($error_file);
$abs_pidfile = testdir($pidfile);
$path = $g_locals['searchd'];
if ( !is_executable($path) )
if ( isset ( $g_locals['valgrindsearchd'] ) )
$use_valgrind = $g_locals['valgrindsearchd'];
else
$use_valgrind = false;
if ( $use_valgrind ) {
$path = "valgrind --leak-check=full ";
if ( file_exists("valgrind.supp" ) )
$path .= "--suppressions=" . getcwd() . "/valgrind.supp ";
$path .= $g_locals['searchd'];
}
else
{
$error = "$path: searchd not found";
return 1;
$path = $g_locals['searchd'];
if ( !is_executable($path) )
{
$error = "$path: searchd not found";
return 1;
}
}
if ( !@touch($abs_error_file) )
@@ -417,6 +431,9 @@ function StartSearchd ( $config_file, $error_file, $pidfile, &$error, $use_watch
if ($cd)
chdir($backdir);
if ( $use_valgrind )
usleep ( 2000000 );
// wait until pid appears
for ( $i=0; $i<$action_retries && !file_exists($abs_pidfile); $i++ )
usleep ( $action_wait_timeout );
@@ -48,6 +48,7 @@
print ( "--keep-all\t\tKeep test db and all test data (like generated configs, etc.) after the test (for debugging)\n");
print ( "--no-demo\t\tJust skip all tests without models. Else - run them, but never fail (for debugging)\n");
print ( "--no-marks\t\tDon't mark the output of every test in the logs.\n");
print ( "--valgrind-searchd\t\tRun searchd under valgrind during test.\n");
print ( "--ignore-weights\tIgnore differences in weights. (Useful for testing that reference database changes are ok.)\n" );
print ( "--cwd\t\t\tchange directory to ubertest.php location (for git bisect)\n" );
print ( "\nEnvironment variables are:\n" );
@@ -103,6 +104,7 @@
else if ( $arg=="--test-thd-pool" ) $locals['use_pool'] = true;
else if ( $arg=="--strict" ) $g_strict = true;
else if ( $arg=="--strict-verbose" ) { $g_strict = true; $g_strictverbose = true; }
else if ( $arg=="--valgrind-searchd" ) $locals['valgrindsearchd'] = true;
else if ( $arg=="--ignore-weights" ) $g_ignore_weights = true;
else if ( $arg=="--no-drop-db" ) $locals['no_drop_db'] = true;
else if ( $arg=="--keep-all" ) $locals['keep_all'] = true;

0 comments on commit 6da0df4

Please sign in to comment.