The autoit.py wrapper can actually support guest scripts more than AutoIt, so generalize the variables in it. Signed-off-by: Chen Cao <kcao@xxxxxxxxxx> --- client/tests/kvm/tests/autoit.py | 27 +++++++++++++++------------ client/tests/kvm/tests_base.cfg.sample | 10 +++++----- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/client/tests/kvm/tests/autoit.py b/client/tests/kvm/tests/autoit.py index e3fa6f6..0373f38 100644 --- a/client/tests/kvm/tests/autoit.py +++ b/client/tests/kvm/tests/autoit.py @@ -5,10 +5,10 @@ import kvm_utils, kvm_test_utils def run_autoit(test, params, env): """ - A wrapper for AutoIt scripts. + A wrapper for running customized tests in guests. 1) Log into a guest. - 2) Run AutoIt script. + 2) Run script. 3) Wait for script execution to complete. 4) Pass/fail according to exit status of script. @@ -30,12 +30,13 @@ def run_autoit(test, params, env): logging.info("Starting script...") # Collect test parameters - binary = params.get("autoit_binary") - script = params.get("autoit_script") - autoit_entry = params.get("autoit_entry", "script.au3") - script_params = params.get("autoit_script_params", "") - timeout = float(params.get("autoit_script_timeout", 600)) + interpreter = params.get("interpreter") + script = params.get("guest_script") + dst_rsc_path = params.get("dst_rsc_path", "script.au3") + script_params = params.get("script_params", "") + test_timeout = float(params.get("test_timeout", 600)) + logging.debug("Starting preparing resouce files...") # Download the script resource from a remote server, or # prepare the script using rss? if params.get("download") == "yes": @@ -44,16 +45,16 @@ def run_autoit(test, params, env): rsc_dir = os.path.basename(rsc_server) dst_rsc_dir = params.get("dst_rsc_dir") - # Change dir to dst_rsc_dir, and remove 'autoit' there, + # Change dir to dst_rsc_dir, and remove the guest script dir there rm_cmd = "cd %s && (rmdir /s /q %s || del /s /q %s)" % \ (dst_rsc_dir, rsc_dir, rsc_dir) - if session.get_command_status(rm_cmd, timeout=timeout) != 0: + if session.get_command_status(rm_cmd, timeout=test_timeout) != 0: raise error.TestFail("Remove %s failed." % rsc_dir) logging.debug("Clean directory succeeded.") # then download the resource. rsc_cmd = "cd %s && %s %s" %(dst_rsc_dir, download_cmd, rsc_server) - if session.get_command_status(rsc_cmd, timeout=timeout) != 0: + if session.get_command_status(rsc_cmd, timeout=test_timeout) != 0: raise error.TestFail("Download test resource failed.") logging.info("Download resource finished.") else: @@ -70,12 +71,12 @@ def run_autoit(test, params, env): internal_timeout=0) file.close() - command = "cmd /c %s %s %s" % (binary, autoit_entry, script_params) + command = "cmd /c %s %s %s" %(interpreter, dst_rsc_path, script_params) logging.info("---------------- Script output ----------------") status = session.get_command_status(command, print_func=logging.info, - timeout=timeout) + timeout=test_timeout) logging.info("---------------- End of script output ----------------") if status is None: @@ -87,5 +88,7 @@ def run_autoit(test, params, env): if reboot == "yes": logging.debug("Rebooting guest after test ...") session = kvm_test_utils.reboot(vm, session, timeout=login_timeout) + + logging.debug("guest test PASSED.") finally: session.close() diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample index fc4fb0b..5b0da6a 100644 --- a/client/tests/kvm/tests_base.cfg.sample +++ b/client/tests/kvm/tests_base.cfg.sample @@ -251,19 +251,19 @@ variants: - autoit: install setup unattended_install.cdrom type = autoit login_timeout = 360 - autoit_binary = D:\AutoIt3.exe - autoit_script_timeout = 600 - autoit_script_params = + interpreter = D:\AutoIt3.exe + test_timeout = 600 + script_params = reboot = yes variants: - notepad: - autoit_script = autoit/notepad1.au3 + guest_script = autoit/notepad1.au3 - stub: download = yes download_cmd = "git clone" rsc_server = "git://the.resource.server/autoit" dst_rsc_dir = "C:\" - autoit_entry = "C:\autoit\stub\stub.au3" + dst_rsc_path = "C:\autoit\stub\stub.au3" - iozone_windows: unattended_install.cdrom type = iozone_windows -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html