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

Unified Diff: client/tests/kvm/tests/whql_client_install.py

Issue 6246035: Merge remote branch 'cros/upstream' into master (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@master
Patch Set: patch Created 9 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: client/tests/kvm/tests/whql_client_install.py
diff --git a/client/tests/kvm/tests/whql_client_install.py b/client/tests/kvm/tests/whql_client_install.py
index 84b91bc282431188590d8a08df0dfb09bd682e19..f5d725d4240593461cb1cac395f5c00a0d8785a3 100644
--- a/client/tests/kvm/tests/whql_client_install.py
+++ b/client/tests/kvm/tests/whql_client_install.py
@@ -1,6 +1,6 @@
-import logging, time, os, re
+import logging, time, os
from autotest_lib.client.common_lib import error
-import kvm_subprocess, kvm_test_utils, kvm_utils, rss_file_transfer
+import kvm_test_utils, kvm_utils, rss_file_transfer
def run_whql_client_install(test, params, env):
@@ -13,13 +13,17 @@ def run_whql_client_install(test, params, env):
5) Move the client machine into the server's workgroup
6) Reboot the client machine
7) Install the DTM client software
+ 8) Setup auto logon for the user created by the installation
+ (normally DTMLLUAdminUser)
+ 9) Reboot again
@param test: kvm test object
@param params: Dictionary with the test parameters
@param env: Dictionary with test environment.
"""
- vm = kvm_test_utils.get_living_vm(env, params.get("main_vm"))
- session = kvm_test_utils.wait_for_login(vm, 0, 240)
+ vm = env.get_vm(params["main_vm"])
+ vm.verify_alive()
+ session = vm.wait_for_login(timeout=int(params.get("login_timeout", 360)))
# Collect test params
server_address = params.get("server_address")
@@ -29,6 +33,8 @@ def run_whql_client_install(test, params, env):
"Microsoft Driver Test Manager\\Studio")
server_username = params.get("server_username")
server_password = params.get("server_password")
+ client_username = params.get("client_username")
+ client_password = params.get("client_password")
dsso_delete_machine_binary = params.get("dsso_delete_machine_binary",
"deps/whql_delete_machine_15.exe")
dsso_delete_machine_binary = kvm_utils.get_path(test.bindir,
@@ -50,52 +56,50 @@ def run_whql_client_install(test, params, env):
server_session = kvm_utils.remote_login("nc", server_address,
server_shell_port, "", "",
session.prompt, session.linesep)
+ server_session.set_status_test_command(session.status_test_command)
# Get server and client information
cmd = "echo %computername%"
- server_name = server_session.get_command_output(cmd).strip()
- client_name = session.get_command_output(cmd).strip()
+ server_name = server_session.cmd_output(cmd).strip()
+ client_name = session.cmd_output(cmd).strip()
cmd = "wmic computersystem get domain"
- server_workgroup = server_session.get_command_output(cmd).strip()
+ server_workgroup = server_session.cmd_output(cmd).strip()
server_workgroup = server_workgroup.splitlines()[-1]
regkey = r"HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters"
cmd = "reg query %s /v Domain" % regkey
- o = server_session.get_command_output(cmd).strip().splitlines()[-1]
+ o = server_session.cmd_output(cmd).strip().splitlines()[-1]
try:
server_dns_suffix = o.split(None, 2)[2]
except IndexError:
server_dns_suffix = ""
# Delete the client machine from the server's data store (if it's there)
- server_session.get_command_output("cd %s" % server_studio_path)
+ server_session.cmd("cd %s" % server_studio_path)
cmd = "%s %s %s" % (os.path.basename(dsso_delete_machine_binary),
server_name, client_name)
- server_session.get_command_output(cmd, print_func=logging.info)
+ server_session.cmd(cmd, print_func=logging.info)
server_session.close()
# Rename the client machine
client_name = "autotest_%s" % kvm_utils.generate_random_string(4)
- logging.info("Renaming client machine to '%s'" % client_name)
+ logging.info("Renaming client machine to '%s'", client_name)
cmd = ('wmic computersystem where name="%%computername%%" rename name="%s"'
% client_name)
- if session.get_command_status(cmd, timeout=600) != 0:
- raise error.TestError("Could not rename the client machine")
+ session.cmd(cmd, timeout=600)
# Join the server's workgroup
- logging.info("Joining workgroup '%s'" % server_workgroup)
+ logging.info("Joining workgroup '%s'", server_workgroup)
cmd = ('wmic computersystem where name="%%computername%%" call '
'joindomainorworkgroup name="%s"' % server_workgroup)
- if session.get_command_status(cmd, timeout=600) != 0:
- raise error.TestError("Could not change the client's workgroup")
+ session.cmd(cmd, timeout=600)
# Set the client machine's DNS suffix
- logging.info("Setting DNS suffix to '%s'" % server_dns_suffix)
+ logging.info("Setting DNS suffix to '%s'", server_dns_suffix)
cmd = 'reg add %s /v Domain /d "%s" /f' % (regkey, server_dns_suffix)
- if session.get_command_status(cmd, timeout=300) != 0:
- raise error.TestError("Could not set the client's DNS suffix")
+ session.cmd(cmd, timeout=300)
# Reboot
- session = kvm_test_utils.reboot(vm, session)
+ session = vm.reboot(session)
# Access shared resources on the server machine
logging.info("Attempting to access remote share on server")
@@ -103,9 +107,11 @@ def run_whql_client_install(test, params, env):
server_password)
end_time = time.time() + 120
while time.time() < end_time:
- s = session.get_command_status(cmd)
- if s == 0:
+ try:
+ session.cmd(cmd)
break
+ except:
+ pass
time.sleep(5)
else:
raise error.TestError("Could not access server share from client "
@@ -114,7 +120,17 @@ def run_whql_client_install(test, params, env):
# Install
logging.info("Installing DTM client (timeout=%ds)", install_timeout)
install_cmd = r"cmd /c \\%s\%s" % (server_name, install_cmd.lstrip("\\"))
- if session.get_command_status(install_cmd, timeout=install_timeout) != 0:
- raise error.TestError("Client installation failed")
-
+ session.cmd(install_cmd, timeout=install_timeout)
+
+ # Setup auto logon
+ logging.info("Setting up auto logon for user '%s'", client_username)
+ cmd = ('reg add '
+ '"HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\winlogon" '
+ '/v "%s" /d "%s" /t REG_SZ /f')
+ session.cmd(cmd % ("AutoAdminLogon", "1"))
+ session.cmd(cmd % ("DefaultUserName", client_username))
+ session.cmd(cmd % ("DefaultPassword", client_password))
+
+ # Reboot one more time
+ session = vm.reboot(session)
session.close()

Powered by Google App Engine
This is Rietveld 408576698