diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2011-11-30 20:42:58 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2011-11-30 22:58:05 +0100 |
commit | ce359c14f27c21b0f36ac0ca3078331bbcc7e917 (patch) | |
tree | b5560793dd2d11981011d9325242248031a72b3e | |
parent | 454c4502f333cedf32e553b649d235e5c6f1dd05 (diff) | |
download | samba-ce359c14f27c21b0f36ac0ca3078331bbcc7e917.tar.gz |
selftest: Drop broken and unused Kvm target.
-rwxr-xr-x | selftest/selftest.pl | 21 | ||||
-rw-r--r-- | selftest/target/Kvm.pm | 162 |
2 files changed, 5 insertions, 178 deletions
diff --git a/selftest/selftest.pl b/selftest/selftest.pl index bce7535de29..7e66480cc27 100755 --- a/selftest/selftest.pl +++ b/selftest/selftest.pl @@ -26,7 +26,7 @@ selftest - Samba test runner selftest --help -selftest [--srcdir=DIR] [--bindir=DIR] [--exeext=EXT][--target=samba|samba3|win|kvm] [--socket-wrapper] [--quick] [--exclude=FILE] [--include=FILE] [--one] [--prefix=prefix] [--testlist=FILE] [TESTS] +selftest [--srcdir=DIR] [--bindir=DIR] [--exeext=EXT][--target=samba|samba3|win] [--socket-wrapper] [--quick] [--exclude=FILE] [--include=FILE] [--one] [--prefix=prefix] [--testlist=FILE] [TESTS] =head1 DESCRIPTION @@ -56,7 +56,7 @@ Executable extention Change directory to run tests in. Default is 'st'. -=item I<--target samba|samba3|win|kvm> +=item I<--target samba|samba3|win> Specify test target against which to run. Default is 'samba4'. @@ -151,7 +151,6 @@ my $opt_one = 0; my @opt_exclude = (); my @opt_include = (); my $opt_verbose = 0; -my $opt_image = undef; my $opt_testenv = 0; my $opt_list = 0; my $ldap = undef; @@ -300,8 +299,8 @@ Usage: $Script [OPTIONS] TESTNAME-REGEX Generic options: --help this help page - --target=samba[3]|win|kvm Samba version to target - --testlist=FILE file to read available tests from + --target=samba[3]|win Samba version to target + --testlist=FILE file to read available tests from Paths: --prefix=DIR prefix to run tests in [st] @@ -310,7 +309,7 @@ Paths: --exeext=EXT executable extention [] Target Specific: - --socket-wrapper-pcap save traffic to pcap directories + --socket-wrapper-pcap save traffic to pcap directories --socket-wrapper-keep-pcap keep all pcap files, not just those for tests that failed --socket-wrapper enable socket wrapper @@ -318,9 +317,6 @@ Target Specific: Samba4 Specific: --ldap=openldap|fedora-ds back samba onto specified ldap server -Kvm Specific: - --image=PATH path to KVM image - Behaviour: --quick run quick overall test --one abort when the first test fails @@ -350,7 +346,6 @@ my $result = GetOptions ( 'list' => \$opt_list, 'ldap:s' => \$ldap, 'resetup-environment' => \$opt_resetup_env, - 'image=s' => \$opt_image, 'testlist=s' => \@testlists, 'load-list=s' => \$opt_load_list, 'binary-mapping=s' => \$opt_binary_mapping @@ -504,12 +499,6 @@ unless ($opt_list) { $testenv_default = "dc"; 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, undef); } } diff --git a/selftest/target/Kvm.pm b/selftest/target/Kvm.pm deleted file mode 100644 index 70fc4bf88c6..00000000000 --- a/selftest/target/Kvm.pm +++ /dev/null @@ -1,162 +0,0 @@ -#!/usr/bin/perl -# Start a KVM machine and run a number of tests against it. -# Copyright (C) 2005-2008 Jelmer Vernooij <jelmer@samba.org> -# Published under the GNU GPL, v3 or later. - -package Kvm; - -use strict; -use Cwd qw(abs_path); -use FindBin qw($RealBin); -use POSIX; - -sub new($$$$) { - my ($classname, $dc_image, $vdesocket) = @_; - my $self = { - dc_image => $dc_image, - vdesocket => $vdesocket, - }; - bless $self; - return $self; -} - -sub write_kvm_ifup($$$) -{ - my ($self, $path, $ip_prefix) = @_; - open(SCRIPT, ">$path/kvm-ifup"); - - print SCRIPT <<__EOF__; -#!/bin/sh - -PREFIX=$ip_prefix - -/sbin/ifconfig \$1 \$PREFIX.1 up - -cat <<EOF>$path/udhcpd.conf -interface \$1 -start \$PREFIX.20 -end \$PREFIX.20 -max_leases 1 -lease_file $path/udhcpd.leases -pidfile $path/udhcpd.pid -EOF - -touch $path/udhcpd.leases - -/usr/sbin/udhcpd $path/udhcpd.conf - -exit 0 -__EOF__ - close(SCRIPT); - chmod(0755, "$path/kvm-ifup"); - - return ("$path/kvm-ifup", "$path/udhcpd.pid", "$ip_prefix.20"); -} - -sub teardown_env($$) -{ - my ($self, $envvars) = @_; - - print "Killing kvm instance $envvars->{KVM_PID}\n"; - - kill 9, $envvars->{KVM_PID}; - - if (defined($envvars->{DHCPD_PID})) { - print "Killing dhcpd instance $envvars->{DHCPD_PID}\n"; - kill 9, $envvars->{DHCPD_PID}; - } - - return 0; -} - -sub getlog_env($$) -{ - my ($self, $envvars) = @_; - - return ""; -} - -sub check_env($$) -{ - my ($self, $envvars) = @_; - - # FIXME: Check whether $self->{pid} is still running - - return 1; -} - -sub read_pidfile($) -{ - my ($path) = @_; - - open(PID, $path); - <PID> =~ /([0-9]+)/; - my ($pid) = $1; - close(PID); - return $pid; -} - -sub start($$$) -{ - my ($self, $path, $image) = @_; - - my $pidfile = "$path/kvm.pid"; - - my $opts = (defined($ENV{KVM_OPTIONS})?$ENV{KVM_OPTIONS}:"-nographic"); - - if (defined($ENV{KVM_SNAPSHOT})) { - $opts .= " -loadvm $ENV{KVM_SNAPSHOT}"; - } - - 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 $netopts"); - - return (read_pidfile($pidfile), $dhcp_pid, $ip_address); -} - -sub setup_env($$$) -{ - my ($self, $envname, $path) = @_; - - if ($envname eq "dc") { - ($self->{dc_pid}, $self->{dc_dhcpd_pid}, $self->{dc_ip}) = $self->start($path, $self->{dc_image}); - - sub choose_var($$) { - my ($name, $default) = @_; - return defined($ENV{"KVM_DC_$name"})?$ENV{"KVM_DC_$name"}:$default; - } - - if ($envname eq "dc") { - return { - KVM_PID => $self->{dc_pid}, - DHCPD_PID => $self->{dc_dhcpd_pid}, - USERNAME => choose_var("USERNAME", "Administrator"), - PASSWORD => choose_var("PASSWORD", "penguin"), - DOMAIN => choose_var("DOMAIN", "SAMBA"), - REALM => choose_var("REALM", "SAMBA"), - SERVER => choose_var("SERVER", "DC"), - SERVER_IP => $self->{dc_ip}, - NETBIOSNAME => choose_var("NETBIOSNAME", "DC"), - NETBIOSALIAS => choose_var("NETBIOSALIAS", "DC"), - }; - } else { - return undef; - } - } else { - return undef; - } -} - -1; |