From 9a00f96f2153270762a8ed432252172115941b2c Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 27 Sep 2006 13:42:16 +0200 Subject: [PATCH] When valgrinding add /usr/lib/debug" to LD_LIBRARY_PATH if available mysql-test/mysql-test-run.pl: Rewrite the setup of LD_LIBRARY_PATH and DYLD_LIBRARY_PATH to make it easier to modify Valgrind need to be run with debug libraries otherwise it's almost impossible to add correct supressions, that means if "/usr/lib/debug" is available, it should be added to LD_LIBRARY_PATH --- mysql-test/mysql-test-run.pl | 37 +++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index f0eb7f3bda4..34b476320f3 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1189,7 +1189,7 @@ sub executable_setup () { sub environment_setup () { - my $extra_ld_library_paths; + my @ld_library_paths; # -------------------------------------------------------------------------- # Setup LD_LIBRARY_PATH so the libraries from this distro/clone @@ -1197,25 +1197,40 @@ sub environment_setup () { # -------------------------------------------------------------------------- if ( $opt_source_dist ) { - $extra_ld_library_paths= "$glob_basedir/libmysql/.libs/"; + push(@ld_library_paths, "$glob_basedir/libmysql/.libs/") } else { - $extra_ld_library_paths= "$glob_basedir/lib"; + push(@ld_library_paths, "$glob_basedir/lib") } # -------------------------------------------------------------------------- # Add the path where mysqld will find udf_example.so # -------------------------------------------------------------------------- - $extra_ld_library_paths .= ":" . - ($lib_udf_example ? dirname($lib_udf_example) : ""); + if ( $lib_udf_example ) + { + push(@ld_library_paths, dirname($lib_udf_example)); + } - $ENV{'LD_LIBRARY_PATH'}= - "$extra_ld_library_paths" . - ($ENV{'LD_LIBRARY_PATH'} ? ":$ENV{'LD_LIBRARY_PATH'}" : ""); - $ENV{'DYLD_LIBRARY_PATH'}= - "$extra_ld_library_paths" . - ($ENV{'DYLD_LIBRARY_PATH'} ? ":$ENV{'DYLD_LIBRARY_PATH'}" : ""); + # -------------------------------------------------------------------------- + #Valgrind need to be run with debug libraries otherwise it's almost + # impossible to add correct supressions, that means if "/usr/lib/debug" + # is available, it should be added to + # LD_LIBRARY_PATH + # -------------------------------------------------------------------------- + my $debug_libraries_path= "/usr/lib/debug"; + if ( $opt_valgrind and -d $debug_libraries_path ) + { + push(@ld_library_paths, $debug_libraries_path); + } + + $ENV{'LD_LIBRARY_PATH'}= join(":", @ld_library_paths, + split(':', $ENV{'LD_LIBRARY_PATH'})); + mtr_debug("LD_LIBRARY_PATH: $ENV{'LD_LIBRARY_PATH'}"); + + $ENV{'DYLD_LIBRARY_PATH'}= join(":", @ld_library_paths, + split(':', $ENV{'DYLD_LIBRARY_PATH'})); + mtr_debug("DYLD_LIBRARY_PATH: $ENV{'DYLD_LIBRARY_PATH'}"); # -------------------------------------------------------------------------- # Also command lines in .opt files may contain env vars