selftest: Pass uid_wrapper library to selftest and preload it.
authorAndreas Schneider <asn@samba.org>
Wed, 3 Jul 2013 10:55:29 +0000 (12:55 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 17 Apr 2014 12:56:05 +0000 (14:56 +0200)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
selftest/selftest.pl
selftest/wscript

index c74eff1..9478a2b 100755 (executable)
@@ -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);
index ad77e91..b251370 100644 (file)
@@ -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: