Merge branch 'v4-0-test' of git://git.samba.org/samba into 4-0-local
[kai/samba.git] / source / selftest / selftest.pl
index b6ce643eb3abe1ab7403bc6e12fc9e8e65f7d89e..aa4423c7e2d551eb2068e6cacef2b3caebb1c085 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 # Bootstrap Samba and run a number of tests against it.
-# Copyright (C) 2005-2007 Jelmer Vernooij <jelmer@samba.org>
+# Copyright (C) 2005-2008 Jelmer Vernooij <jelmer@samba.org>
 # Published under the GNU GPL, v3 or later.
 
 =pod
@@ -144,6 +144,7 @@ my $opt_expected_failures = undef;
 my @opt_exclude = ();
 my @opt_include = ();
 my $opt_verbose = 0;
+my $opt_image = undef;
 my $opt_testenv = 0;
 my $ldap = undef;
 my $opt_analyse_cmd = undef;
@@ -302,7 +303,7 @@ Samba3 Specific:
  --bindir=PATH              path to binaries
 
 Kvm Specific:
- --image=PATH                path to KVM image
+ --image=PATH               path to KVM image
 
 Behaviour:
  --quick                    run quick overall test
@@ -447,9 +448,36 @@ if ($opt_target eq "samba4") {
        require target::Windows;
        $target = new Windows();
 } elsif ($opt_target eq "kvm") {
+       die("Kvm tests will not run with socket wrapper enabled.") 
+               if ($opt_socket_wrapper);
        require target::Kvm;
        die("No image specified") unless ($opt_image);
-       $target = new Kvm($opt_image);
+       $target = new Kvm($opt_image, undef);
+}
+
+#
+# Start a Virtual Distributed Ethernet Switch
+# Returns the pid of the switch.
+#
+sub start_vde_switch($)
+{
+       my ($path) = @_;
+
+       system("vde_switch --pidfile $path/vde.pid --sock $path/vde.sock --daemon");
+
+       open(PID, "$path/vde.pid");
+       <PID> =~ /([0-9]+)/;
+       my $pid = $1;
+       close(PID);
+
+       return $pid;
+}
+
+# Stop a Virtual Distributed Ethernet Switch
+sub stop_vde_switch($)
+{
+       my ($pid) = @_;
+       kill 9, $pid;
 }
 
 sub read_test_regexes($)
@@ -530,11 +558,13 @@ sub write_clientconf($$)
        if (defined($vars->{WINBINDD_SOCKET_DIR})) {
                print CF "\twinbindd socket directory = $vars->{WINBINDD_SOCKET_DIR}\n";
        }
+       if ($opt_socket_wrapper) {
+               print CF "\tinterfaces = $interfaces\n";
+       }
        print CF "
        private dir = $prefix_abs/client/private
        js include = $srcdir_abs/scripting/libjs
        name resolve order = bcast
-       interfaces = $interfaces
        panic action = $srcdir_abs/script/gdb_backtrace \%PID\% \%PROG\%
        max xmit = 32K
        notify:inotify = false