summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-02-19 03:29:03 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-02-19 03:29:03 +0100
commit12e08782b3bef67395d9508fed9487d0217174d6 (patch)
tree4707254363c094a2ebf3d0359528bfe987974c3e
parenta71c3714323b6dce2fbeea68c2d007c223467f26 (diff)
downloadsamba-12e08782b3bef67395d9508fed9487d0217174d6.tar.gz
samba-12e08782b3bef67395d9508fed9487d0217174d6.tar.bz2
samba-12e08782b3bef67395d9508fed9487d0217174d6.zip
Add Kvm start code.
(This used to be commit 6308c134b225dfa8574aa1370a7874ed6e572ccc)
-rw-r--r--source4/selftest/config.mk3
-rw-r--r--source4/selftest/target/Kvm.pm23
2 files changed, 26 insertions, 0 deletions
diff --git a/source4/selftest/config.mk b/source4/selftest/config.mk
index 7f8f211588..ff470df527 100644
--- a/source4/selftest/config.mk
+++ b/source4/selftest/config.mk
@@ -10,6 +10,9 @@ SELFTEST = $(LD_LIBPATH_OVERRIDE) $(PERL) $(srcdir)/selftest/selftest.pl --prefi
test:: everything
$(SELFTEST) $(DEFAULT_TEST_OPTIONS) --immediate $(TESTS)
+kvmtest:: everything
+ $(SELFTEST) $(DEFAULT_TEST_OPTIONS) --target=kvm --image=$(KVM_IMAGE)
+
testone:: everything
$(SELFTEST) $(DEFAULT_TEST_OPTIONS) --one $(TESTS)
diff --git a/source4/selftest/target/Kvm.pm b/source4/selftest/target/Kvm.pm
index 533fb302d0..efd4fa2f7a 100644
--- a/source4/selftest/target/Kvm.pm
+++ b/source4/selftest/target/Kvm.pm
@@ -40,16 +40,39 @@ sub check_env($$)
return 1;
}
+sub start($)
+{
+ my ($self) = @_;
+
+ my $pidfile = "kvm.pid";
+
+ system("kvm $ENV{KVM_OPTIONS} -daemonize -pidfile $pidfile -net user -vnc unix:kvm.vnc -snapshot $self->{image}");
+
+ open(PID, $pidfile);
+ $self->{pid} = <PID>;
+ close(PID);
+}
+
sub setup_env($$$)
{
my ($self, $envname, $path) = @_;
+ if ($envname eq "dc") {
+ unless (defined($self->{pid})) {
+ $self->start();
+ }
+ } elsif ($envname eq "member") {
+ return undef;
+ }
+
die("No implemented yet");
}
sub stop($)
{
my ($self) = @_;
+
+ kill $self->{pid};
}
1;