1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00
samba-mirror/source4/selftest/win/vm_get_ip.pl

49 lines
1.2 KiB
Perl
Raw Normal View History

#!/usr/bin/perl -w
# A perl script to connect to a VMware server and get the IP address of a VM.
# Copyright Brad Henry <brad@samba.org> 2006
# Released under the GNU GPL v2 or later.
use VMHost;
sub check_error {
my $vm = VMHost;
my $custom_err_str = "";
($vm, $custom_err_str) = @_;
my ($err_code, $err_str) = $vm->error;
if ($err_code != 0) {
undef $vm;
die $custom_err_str . "Returned $err_code: $err_str.\n";
}
}
# Read in parameters from environment.
r21475: Updated vm_get_ip.pl to read the name of the environment variable containing the VM path from the command line. wintest_2k3_dc.sh is a new script which will run a group of tests against a Windows 2003 DC. The group of tests to run should be passed in on the command line. These tests were taken from the source/script/tests/test_win2k3.sh script. tests_win2k3_dc.sh is a new script intended to be called by 'make wintest_dc' (patch to source/main.mk forthcoming). This is intended to provide the basis for Windows 2003 DC testing in the build farm. In order to use these tests, you should have a DC setup as a VM in VMware server. This process is not automated yet, but can be done by following a few steps: 1. Prepare a Windows 2003 VM in VMware Server by downloading and extracting: svn://svn.samba.org/home/svn/samba/branches/SOC/bnh/vm_setup.tar.gz and following the instructions in the README file. 2. Copying the following file onto the filesystem of the VM configured in step 1: svn://svn.samba.org/home/svn/samba/branches/SOC/bnh/dcpromo_2k3dc_newdomain.answerfile.txt and use it to promote the VM. For example: "dcpromo /answer:<path to answerfile>" 3. On the system you are testing from, set the environment variable WINTESTCONF, and SRCDIR. WINTESTCONF should point to the path of a test_win.conf file modified for your environment. There's a default copy in source/script/tests/win/test_win.conf. SRCDIR should point to the base of your Samba 4 source tree. At that point, you should be able to run wintest_2k3_dc.sh by passing a group of tests at the command line. For example: source/script/tests/win/wintest_2k3_dc.sh RPC-DRSUAPI Sorry for the long-winded commit message! (This used to be commit a0d1c690de2e58eddf5517eb974e09c2bba23605)
2007-02-21 01:28:43 +03:00
my $vm_cfg_path = $ENV{"$ARGV[0]"};
my $host_server_name = $ENV{'HOST_SERVER_NAME'};
my $host_server_port = $ENV{'HOST_SERVER_PORT'};
if (!defined($host_server_port)) {
$host_server_port = 902;
}
my $host_username = $ENV{'HOST_USERNAME'};
my $host_password = $ENV{'HOST_PASSWORD'};
my $guest_admin_username = $ENV{'GUEST_ADMIN_USERNAME'};
my $guest_admin_password = $ENV{'GUEST_ADMIN_PASSWORD'};
my $vm = VMHost;
$vm->host_connect($host_server_name, $host_server_port, $host_username,
$host_password, $vm_cfg_path, $guest_admin_username,
$guest_admin_password);
check_error($vm, "Error in \$vm->host_connect().\n");
my $guest_ip = $vm->get_guest_ip();
check_error($vm, "Error in \$vm->get_guest_ip().\n");
print $guest_ip;
undef $vm;
exit 0;