1 | This framework uses a VMware Server hosted Windows guest VM to test the
|
---|
2 | behaviour of Windows -> Samba and Samba -> Windows interactions. To setup a
|
---|
3 | Windows host for testing, vm_setup.tar.gz contain some scripts which create
|
---|
4 | an administrative user account, and enable and start the installed telnet
|
---|
5 | service on the Windows host. Optionally, the hostname and workgroup name can
|
---|
6 | also be set. vm_setup.tar.gz is currently located in the SOC/bnh branch of
|
---|
7 | Samba's SVN repository.
|
---|
8 |
|
---|
9 | PREREQUISITES
|
---|
10 |
|
---|
11 | To use these scripts, VMware Server needs to be running with a Windows guest
|
---|
12 | VM installed, IP addressed, and VMware tools needs to be installed and running
|
---|
13 | on the guest VM. The Windows OS I used to test with was Windows Server 2003,
|
---|
14 | but I think this should work with any version of Windows that has the
|
---|
15 | Microsoft telnet service installed. The VMware Server versions I used for
|
---|
16 | testing was 1.0.0 build-27828, and 1.0.0 build-28343.
|
---|
17 |
|
---|
18 | PLEASE NOTE: Due to problems with my original revert_snapshot() code, the initial
|
---|
19 | setup now requires that the VM configuration setting 'When Powering Off' is
|
---|
20 | manually set to 'Revert to snapshot' (snapshot.action="autoRevert" in the
|
---|
21 | guest's .vmx file). This should not be a permanent change, but the original
|
---|
22 | revert_snapshot() code I wrote no longer works and i'm not sure why.
|
---|
23 |
|
---|
24 | On the machine that these scripts are running on (this need not be the same
|
---|
25 | machine as the VMware host), the VMware perl scripting api needs to be
|
---|
26 | installed, as well as the vix-perl api. These come with the VMware Server
|
---|
27 | console package.
|
---|
28 |
|
---|
29 | After unzipping this file, the libraries are installed by extracting the
|
---|
30 | VMware-vix-e.x.p-<revision number>.tar.gz and
|
---|
31 | VMware-VmPerlAPI-e.x.p-<revision number>.tar.gz archives, and running the
|
---|
32 | vmware-install.pl scripts inside their respective directories.
|
---|
33 |
|
---|
34 | On Slackware 10.2, I encountered a problem in that when I tried to use the vix
|
---|
35 | api libraries, I would get the following error:
|
---|
36 |
|
---|
37 | SSLLoadSharedLibrary: Failed to load library /<client program directory>/libcrypto.so.0.9.7:/<client program directory>/libcrypto.so.0.9.7: cannot open a shared object file: No such file or directory.
|
---|
38 |
|
---|
39 | The fix found on the VMware knowledge base (search http://kb.vmware.com for
|
---|
40 | Doc ID: 1837104) states that it's a known problem with the scripting libraries,
|
---|
41 | and can be resolved by installing VMware Server on the host, which properly
|
---|
42 | sets up the SSL module loader. This is what I would suggest if you encounter
|
---|
43 | this, as it solved the problem for me (I don't have VMware Server actually
|
---|
44 | running on that host though).
|
---|
45 |
|
---|
46 | INSTALLATION
|
---|
47 |
|
---|
48 | To use these scripts, modify initial_setup.conf to match your environment. The
|
---|
49 | GUEST_HOSTNAME, GUEST_WORKGROUP, HOST_SERVER_NAME, HOST_SERVER_PORT,
|
---|
50 | HOST_USERNAME, and HOST_PASSWORD variables are optional, and are commented out
|
---|
51 | in this release.
|
---|
52 |
|
---|
53 | Running initial_setup.sh will:
|
---|
54 | * Get the IP address of the Windows guest VM.
|
---|
55 | * Take a snapshot of the pristine Windows guest.
|
---|
56 | * Copy the windows scripts from the windows-scripts directory on the unix host
|
---|
57 | to the directory on the Windows guest specified by the
|
---|
58 | GUEST_SCRIPT_PATH option. This path will be created on the guest if
|
---|
59 | it does not already exist.
|
---|
60 | * Execute win_setup.wsf on the Windows guest in order to create the
|
---|
61 | administrator account specified by GUEST_USERNAME and GUEST_PASSWORD,
|
---|
62 | enable and start the telnet service, and set the GUEST_HOSTNAME and
|
---|
63 | GUEST_WORKGROUP if configured.
|
---|
64 | * If these operations are successful so far, another snapshot is taken at this
|
---|
65 | point. This is the snapshot which is restored if the tests encounter
|
---|
66 | problems they are unable to recover from.
|
---|
67 |
|
---|
68 | These operations leave the Windows guest in a state such that it can be
|
---|
69 | remotely administered with telnet. Specifically, this will allow us to use
|
---|
70 | 'make wintest' in Samba 4 to perform smbtorture tests against a Windows host,
|
---|
71 | and perform tests from a Windows client to a Samba server.
|
---|
72 |
|
---|
73 | INTEGRATING WITH THE BUILD FARM
|
---|
74 |
|
---|
75 | Follow the standard steps to add a host to the build farm. The major
|
---|
76 | difference is that we will need to run these tests as root. To run the
|
---|
77 | Windows tests in the build farm, a .fns file will need to be created for
|
---|
78 | your new host that exports a WINTESTCONF environment variable pointing to a
|
---|
79 | config file used by 'make wintest'. An example of this config file can be
|
---|
80 | found at source/selftest/win/test_win.conf in the Samba 4 source tree.
|
---|
81 |
|
---|
82 | I've also included the bnhtest.fns file that I'm using for my build farm host
|
---|
83 | below, as an example. It was modified from generic.fns.
|
---|
84 |
|
---|
85 | action_test_windows() {
|
---|
86 | do_make wintest
|
---|
87 | w_status=$?
|
---|
88 | echo "WINTEST STATUS: $w_status"
|
---|
89 | return $w_status;
|
---|
90 | }
|
---|
91 |
|
---|
92 | per_run_hook
|
---|
93 |
|
---|
94 | system=`uname`
|
---|
95 |
|
---|
96 | export WINTESTCONF="/home/build/win/test_win.conf"
|
---|
97 |
|
---|
98 | for compiler in gcc cc icc; do
|
---|
99 |
|
---|
100 | # arrgh, "which" gives no err code on solaris
|
---|
101 | path=`which $compiler`
|
---|
102 | if [ -x "$path" ]; then
|
---|
103 |
|
---|
104 | if $compiler -v 2>&1 | grep gcc.version > /dev/null; then
|
---|
105 | isgcc=1
|
---|
106 | CFLAGS="-Wall"
|
---|
107 | export CFLAGS
|
---|
108 | else
|
---|
109 | CFLAGS=""
|
---|
110 | export CFLAGS
|
---|
111 | isgcc=0
|
---|
112 | fi
|
---|
113 | if [ $compiler = gcc -o $isgcc = 0 ]; then
|
---|
114 |
|
---|
115 | # only attempt samba4 if we have perl
|
---|
116 | if which perl > /dev/null; then
|
---|
117 | test_tree samba4 source $compiler configure build install test_windows test
|
---|
118 | fi
|
---|
119 | fi
|
---|
120 | fi
|
---|
121 | done
|
---|