Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Side by Side Diff: client/tests/kvm/tests/whql_client_install.py

Issue 3554003: Merge remote branch 'cros/upstream' into tempbranch3 (Closed) Base URL: http://git.chromium.org/git/autotest.git
Patch Set: Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « client/tests/kvm/tests/virtio_console.py ('k') | client/tests/kvm/tests/whql_submission.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 import logging, time, os, re
2 from autotest_lib.client.common_lib import error
3 import kvm_subprocess, kvm_test_utils, kvm_utils, rss_file_transfer
4
5
6 def run_whql_client_install(test, params, env):
7 """
8 WHQL DTM client installation:
9 1) Log into the guest (the client machine) and into a DTM server machine
10 2) Stop the DTM client service (wttsvc) on the client machine
11 3) Delete the client machine from the server's data store
12 4) Rename the client machine (give it a randomly generated name)
13 5) Move the client machine into the server's workgroup
14 6) Reboot the client machine
15 7) Install the DTM client software
16
17 @param test: kvm test object
18 @param params: Dictionary with the test parameters
19 @param env: Dictionary with test environment.
20 """
21 vm = kvm_test_utils.get_living_vm(env, params.get("main_vm"))
22 session = kvm_test_utils.wait_for_login(vm, 0, 240)
23
24 # Collect test params
25 server_address = params.get("server_address")
26 server_shell_port = int(params.get("server_shell_port"))
27 server_file_transfer_port = int(params.get("server_file_transfer_port"))
28 server_studio_path = params.get("server_studio_path", "%programfiles%\\ "
29 "Microsoft Driver Test Manager\\Studio")
30 server_username = params.get("server_username")
31 server_password = params.get("server_password")
32 dsso_delete_machine_binary = params.get("dsso_delete_machine_binary",
33 "deps/whql_delete_machine_15.exe")
34 dsso_delete_machine_binary = kvm_utils.get_path(test.bindir,
35 dsso_delete_machine_binary)
36 install_timeout = float(params.get("install_timeout", 600))
37 install_cmd = params.get("install_cmd")
38 wtt_services = params.get("wtt_services")
39
40 # Stop WTT service(s) on client
41 for svc in wtt_services.split():
42 kvm_test_utils.stop_windows_service(session, svc)
43
44 # Copy dsso_delete_machine_binary to server
45 rss_file_transfer.upload(server_address, server_file_transfer_port,
46 dsso_delete_machine_binary, server_studio_path,
47 timeout=60)
48
49 # Open a shell session with server
50 server_session = kvm_utils.remote_login("nc", server_address,
51 server_shell_port, "", "",
52 session.prompt, session.linesep)
53
54 # Get server and client information
55 cmd = "echo %computername%"
56 server_name = server_session.get_command_output(cmd).strip()
57 client_name = session.get_command_output(cmd).strip()
58 cmd = "wmic computersystem get domain"
59 server_workgroup = server_session.get_command_output(cmd).strip()
60 server_workgroup = server_workgroup.splitlines()[-1]
61 regkey = r"HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters"
62 cmd = "reg query %s /v Domain" % regkey
63 server_dns_suffix = server_session.get_command_output(cmd).split()[-1]
64
65 # Delete the client machine from the server's data store (if it's there)
66 server_session.get_command_output("cd %s" % server_studio_path)
67 cmd = "%s %s %s" % (os.path.basename(dsso_delete_machine_binary),
68 server_name, client_name)
69 server_session.get_command_output(cmd, print_func=logging.info)
70 server_session.close()
71
72 # Rename the client machine
73 client_name = "autotest_%s" % kvm_utils.generate_random_string(4)
74 logging.info("Renaming client machine to '%s'" % client_name)
75 cmd = ('wmic computersystem where name="%%computername%%" rename name="%s"'
76 % client_name)
77 if session.get_command_status(cmd, timeout=600) != 0:
78 raise error.TestError("Could not rename the client machine")
79
80 # Join the server's workgroup
81 logging.info("Joining workgroup '%s'" % server_workgroup)
82 cmd = ('wmic computersystem where name="%%computername%%" call '
83 'joindomainorworkgroup name="%s"' % server_workgroup)
84 if session.get_command_status(cmd, timeout=600) != 0:
85 raise error.TestError("Could not change the client's workgroup")
86
87 # Set the client machine's DNS suffix
88 logging.info("Setting DNS suffix to '%s'" % server_dns_suffix)
89 cmd = "reg add %s /v Domain /d %s /f" % (regkey, server_dns_suffix)
90 if session.get_command_status(cmd, timeout=300) != 0:
91 raise error.TestError("Could not set the client's DNS suffix")
92
93 # Reboot
94 session = kvm_test_utils.reboot(vm, session)
95
96 # Access shared resources on the server machine
97 logging.info("Attempting to access remote share on server")
98 cmd = r"net use \\%s /user:%s %s" % (server_name, server_username,
99 server_password)
100 end_time = time.time() + 120
101 while time.time() < end_time:
102 s = session.get_command_status(cmd)
103 if s == 0:
104 break
105 time.sleep(5)
106 else:
107 raise error.TestError("Could not access server share from client "
108 "machine")
109
110 # Install
111 logging.info("Installing DTM client (timeout=%ds)", install_timeout)
112 install_cmd = r"cmd /c \\%s\%s" % (server_name, install_cmd.lstrip("\\"))
113 if session.get_command_status(install_cmd, timeout=install_timeout) != 0:
114 raise error.TestError("Client installation failed")
115
116 session.close()
OLDNEW
« no previous file with comments | « client/tests/kvm/tests/virtio_console.py ('k') | client/tests/kvm/tests/whql_submission.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698