From patchwork Thu Jul 15 15:57:37 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Goldish X-Patchwork-Id: 112265 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6FFvqNX008977 for ; Thu, 15 Jul 2010 15:57:52 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933608Ab0GOP5r (ORCPT ); Thu, 15 Jul 2010 11:57:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52909 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932992Ab0GOP5n (ORCPT ); Thu, 15 Jul 2010 11:57:43 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o6FFvgJN021675 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 15 Jul 2010 11:57:42 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o6FFvfLQ008395; Thu, 15 Jul 2010 11:57:41 -0400 Received: from localhost.localdomain (dhcp-1-188.tlv.redhat.com [10.35.1.188]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o6FFvUQR021960; Thu, 15 Jul 2010 11:57:40 -0400 From: Michael Goldish To: autotest@test.kernel.org, kvm@vger.kernel.org Cc: Michael Goldish Subject: [KVM-AUTOTEST PATCH 8/9] [RFC] KVM test: add whql_client_install test Date: Thu, 15 Jul 2010 18:57:37 +0300 Message-Id: <1279209458-19590-8-git-send-email-mgoldish@redhat.com> In-Reply-To: <1279209458-19590-7-git-send-email-mgoldish@redhat.com> References: <1279209458-19590-1-git-send-email-mgoldish@redhat.com> <1279209458-19590-2-git-send-email-mgoldish@redhat.com> <1279209458-19590-3-git-send-email-mgoldish@redhat.com> <1279209458-19590-4-git-send-email-mgoldish@redhat.com> <1279209458-19590-5-git-send-email-mgoldish@redhat.com> <1279209458-19590-6-git-send-email-mgoldish@redhat.com> <1279209458-19590-7-git-send-email-mgoldish@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 15 Jul 2010 15:57:52 +0000 (UTC) diff --git a/client/tests/kvm/tests/whql_client_install.py b/client/tests/kvm/tests/whql_client_install.py new file mode 100644 index 0000000..f46939e --- /dev/null +++ b/client/tests/kvm/tests/whql_client_install.py @@ -0,0 +1,110 @@ +import logging, time, os, re +from autotest_lib.client.common_lib import error +import kvm_subprocess, kvm_test_utils, kvm_utils, rss_file_transfer + + +def run_whql_client_install(test, params, env): + """ + WHQL DTM client installation: + 1) Log into the guest (the client machine) and into a DTM server machine + 2) Stop the DTM client service (wttsvc) on the client machine + 3) Delete the client machine from the server's data store + 4) Rename the client machine (give it a randomly generated name) + 5) Move the client machine into the server's workgroup + 6) Reboot the client machine + 7) Install the DTM client software + + @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) + + # Collect test params + server_address = params.get("server_address") + server_shell_port = int(params.get("server_shell_port")) + server_file_transfer_port = int(params.get("server_file_transfer_port")) + server_studio_path = params.get("server_studio_path", "%programfiles%\\ " + "Microsoft Driver Test Manager\\Studio") + server_username = params.get("server_username") + server_password = params.get("server_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, + dsso_delete_machine_binary) + install_timeout = float(params.get("install_timeout", 600)) + install_cmd = params.get("install_cmd") + wtt_services = params.get("wtt_services") + + # Stop WTT service(s) on client + for svc in wtt_services.split(): + kvm_test_utils.stop_windows_service(session, svc) + + # Copy dsso_delete_machine_binary to server + rss_file_transfer.upload(server_address, server_file_transfer_port, + dsso_delete_machine_binary, server_studio_path, + timeout=60) + + # Open a shell session with server + server_session = kvm_utils.remote_login("nc", server_address, + server_shell_port, "", "", + session.prompt, session.linesep) + + # 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() + cmd = "wmic computersystem get workgroup" + server_workgroup = server_session.get_command_output(cmd).strip() + + # Delete the client machine from the server's data store (if it's there) + server_session.get_command_output("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.close() + + # Rename the client machine + client_name = "autotest_%s" % kvm_utils.generate_random_string(4) + logging.info("Renaming client machine to '%s'" % client_name) + cmd = ('wmic computersystem where name="%%computername%%" rename name="%s"' + % client_name) + s = session.get_command_status(cmd, timeout=600) + if s != 0: + raise error.TestError("Could not rename the client machine") + + # Join the server's workgroup + logging.info("Joining workgroup '%s'" % server_workgroup) + cmd = ('wmic computersystem where name="%%computername%%" call ' + 'joindomainorworkgroup name="%s"' % server_workgroup) + s = session.get_command_status(cmd, timeout=600) + if s != 0: + raise error.TestError("Could not change the client's workgroup") + + # Reboot + session = kvm_test_utils.reboot(vm, session) + + # Access shared resources on the server machine + logging.info("Attempting to access remote share on server") + cmd = r"net use \\%s /user:%s %s" % (server_name, server_username, + server_password) + end_time = time.time() + 120 + while time.time() < end_time: + s = session.get_command_status(cmd) + if s == 0: + break + time.sleep(5) + else: + raise error.TestError("Could not access server share from client " + "machine") + + # Install + logging.info("Installing DTM client (timeout=%ds)", install_timeout) + install_cmd = r"cmd /c \\%s\%s" % (server_name, install_cmd.lstrip("\\")) + s, o = session.get_command_status_output(install_cmd, + timeout=install_timeout) + if s != 0: + raise error.TestError("Client installation failed") + + session.close()