From 9feeeb369b913debc41a0c57ac1cd1f6fbdf9b72 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 3 Jul 2013 12:55:29 +0200 Subject: [PATCH] selftest: Pass uid_wrapper library to selftest and preload it. Signed-off-by: Andreas Schneider Reviewed-by: Stefan Metzmacher --- selftest/selftest.pl | 20 +++++++++++++++++++- selftest/wscript | 2 ++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/selftest/selftest.pl b/selftest/selftest.pl index c74eff1cbfb..9478a2b39cf 100755 --- a/selftest/selftest.pl +++ b/selftest/selftest.pl @@ -52,6 +52,7 @@ my $ldap = undef; my $opt_resetup_env = undef; my $opt_binary_mapping = ""; my $opt_load_list = undef; +my $opt_libuid_wrapper_so_path = ""; my @testlists = (); my $srcdir = "."; @@ -201,6 +202,9 @@ Paths: --srcdir=DIR source directory [.] --bindir=DIR binaries directory [./bin] +Preload cwrap: + --uid_wrapper_so_path=FILE the uid_wrapper library to preload + Target Specific: --socket-wrapper-pcap save traffic to pcap directories --socket-wrapper-keep-pcap keep all pcap files, not just those for tests that @@ -239,7 +243,8 @@ my $result = GetOptions ( 'testlist=s' => \@testlists, 'random-order' => \$opt_random_order, 'load-list=s' => \$opt_load_list, - 'binary-mapping=s' => \$opt_binary_mapping + 'binary-mapping=s' => \$opt_binary_mapping, + 'uid_wrapper_so_path=s' => \$opt_libuid_wrapper_so_path ); exit(1) if (not $result); @@ -335,6 +340,19 @@ if ($opt_socket_wrapper_pcap) { $opt_socket_wrapper = 1; } +my $ld_preload = $ENV{LD_PRELOAD}; + +if ($opt_libuid_wrapper_so_path) { + if ($ld_preload) { + $ld_preload = "$ld_preload:$opt_libuid_wrapper_so_path"; + } else { + $ld_preload = "$opt_libuid_wrapper_so_path"; + } +} + +$ENV{LD_PRELOAD} = $ld_preload; +print "LD_PRELOAD=$ENV{LD_PRELOAD}\n"; + my $socket_wrapper_dir; if ($opt_socket_wrapper) { $socket_wrapper_dir = SocketWrapper::setup_dir("$prefix_abs/w", $opt_socket_wrapper_pcap); diff --git a/selftest/wscript b/selftest/wscript index ad77e9105b9..b251370c332 100644 --- a/selftest/wscript +++ b/selftest/wscript @@ -200,6 +200,8 @@ def cmd_testonly(opt): else: env.SELFTEST_TARGET="samba3" + env.OPTIONS += " --uid_wrapper_so_path=" + CONFIG_GET(opt, 'LIBUID_WRAPPER_SO_PATH') + # We use the full path rather than relative path because it cause problems on some plateforms (ie. solaris 8). env.CORE_COMMAND = '${PERL} ${srcdir}/selftest/selftest.pl --target=${SELFTEST_TARGET} --prefix=${SELFTEST_PREFIX} --srcdir=${srcdir} --exclude=${srcdir}/selftest/skip ${TESTLISTS} ${OPTIONS} ${TESTS}' if Options.options.LIST: -- 2.34.1