public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Goldish <mgoldish@redhat.com>
To: autotest@test.kernel.org, kvm@vger.kernel.org
Subject: [KVM-AUTOTEST PATCH v2 4/5] [RFC] KVM test: add whql_client_install test
Date: Thu, 22 Jul 2010 13:14:18 +0300	[thread overview]
Message-ID: <1279793659-22486-4-git-send-email-mgoldish@redhat.com> (raw)
In-Reply-To: <1279793659-22486-3-git-send-email-mgoldish@redhat.com>

whql_client_install installs the DTM client on a guest.  It requires a
functioning external DTM server which runs rss.exe like regular Windows VMs.

Signed-off-by: Michael Goldish <mgoldish@redhat.com>
---
 client/tests/kvm/tests/whql_client_install.py |  110 +++++++++++++++++++++++++
 1 files changed, 110 insertions(+), 0 deletions(-)
 create mode 100644 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
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()
-- 
1.5.5.6

  reply	other threads:[~2010-07-22 10:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-22 10:14 [KVM-AUTOTEST PATCH v2 1/5] [RFC] KVM test: DTM automation program for WHQL tests Michael Goldish
2010-07-22 10:14 ` [KVM-AUTOTEST PATCH v2 2/5] [RFC] KVM test: DTM machine deletion tool " Michael Goldish
2010-07-22 10:14   ` [KVM-AUTOTEST PATCH v2 3/5] [RFC] KVM test: add whql_submission test Michael Goldish
2010-07-22 10:14     ` Michael Goldish [this message]
2010-07-22 10:14       ` [KVM-AUTOTEST PATCH v2 5/5] [RFC] KVM test: add WHQL test definitions to tests_base.cfg.sample Michael Goldish
2010-08-11  3:08         ` [Autotest] " Amos Kong
2010-08-05  0:49     ` [Autotest] [KVM-AUTOTEST PATCH v2 3/5] [RFC] KVM test: add whql_submission test Amos Kong
2010-08-05 11:34       ` Michael Goldish

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1279793659-22486-4-git-send-email-mgoldish@redhat.com \
    --to=mgoldish@redhat.com \
    --cc=autotest@test.kernel.org \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox