summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;