summaryrefslogtreecommitdiff
path: root/source4/selftest
diff options
context:
space:
mode:
Diffstat (limited to 'source4/selftest')
-rwxr-xr-xsource4/selftest/samba4_tests.sh2
-rwxr-xr-xsource4/selftest/selftest.pl29
-rw-r--r--source4/selftest/target/Kvm.pm26
3 files changed, 48 insertions, 9 deletions
diff --git a/source4/selftest/samba4_tests.sh b/source4/selftest/samba4_tests.sh
index 6beff6f279..c57ec4d6bd 100755
--- a/source4/selftest/samba4_tests.sh
+++ b/source4/selftest/samba4_tests.sh
@@ -294,7 +294,7 @@ plantest "wbinfo -a against member server with domain creds" member $VALGRIND $s
NBT_TESTS=`$smb4torture --list | grep "^NBT-" | xargs`
for t in $NBT_TESTS; do
- plansmbtorturetest "$t" dc //\$SERVER/_none_ $f -U\$USERNAME%\$PASSWORD
+ plansmbtorturetest "$t" dc //\$SERVER/_none_ -U\$USERNAME%\$PASSWORD
done
WB_OPTS="--option=\"torture:strict mode=yes\""
diff --git a/source4/selftest/selftest.pl b/source4/selftest/selftest.pl
index c17e790f63..aa4423c7e2 100755
--- a/source4/selftest/selftest.pl
+++ b/source4/selftest/selftest.pl
@@ -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
@@ -452,7 +452,32 @@ if ($opt_target eq "samba4") {
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($)
diff --git a/source4/selftest/target/Kvm.pm b/source4/selftest/target/Kvm.pm
index 253f3b53af..3b17a2909c 100644
--- a/source4/selftest/target/Kvm.pm
+++ b/source4/selftest/target/Kvm.pm
@@ -11,9 +11,10 @@ use FindBin qw($RealBin);
use POSIX;
sub new($$$$) {
- my ($classname, $dc_image) = @_;
+ my ($classname, $dc_image, $vdesocket) = @_;
my $self = {
dc_image => $dc_image,
+ vdesocket => $vdesocket,
};
bless $self;
return $self;
@@ -60,8 +61,10 @@ sub teardown_env($$)
kill 9, $envvars->{KVM_PID};
- print "Killing dhcpd instance $envvars->{DHCPD_PID}\n";
- kill 9, $envvars->{DHCPD_PID};
+ if (defined($envvars->{DHCPD_PID})) {
+ print "Killing dhcpd instance $envvars->{DHCPD_PID}\n";
+ kill 9, $envvars->{DHCPD_PID};
+ }
return 0;
}
@@ -105,11 +108,22 @@ sub start($$$)
$opts .= " -loadvm $ENV{KVM_SNAPSHOT}";
}
- my ($ifup_script, $dhcpd_pidfile, $ip_address) = $self->write_kvm_ifup($path, "192.168.9");
+ my $netopts;
+ my $dhcp_pid;
+ my $ip_address;
+
+ if ($self->{vdesocket}) {
+ $netopts = "vde,socket=$self->{vdesocket}";
+ } else {
+ my $ifup_script, $dhcpd_pidfile;
+ ($ifup_script, $dhcpd_pidfile, $ip_address) = $self->write_kvm_ifup($path, "192.168.9");
+ $netopts = "tap,script=$ifup_script";
+ $dhcp_pid = read_pidfile($dhcpd_pidfile);
+ }
- system("kvm -name \"Samba 4 Test Subject\" $opts -monitor unix:$path/kvm.monitor,server,nowait -daemonize -pidfile $pidfile -snapshot $image -net nic -net tap,script=$ifup_script");
+ system("kvm -name \"Samba 4 Test Subject\" $opts -monitor unix:$path/kvm.monitor,server,nowait -daemonize -pidfile $pidfile -snapshot $image -net nic -net $netopts");
- return (read_pidfile($pidfile), read_pidfile($dhcpd_pidfile), $ip_address);
+ return (read_pidfile($pidfile), $dhcp_pid, $ip_address);
}
sub setup_env($$$)