1. reboot before test:
the .au3 or .exe files may be used by other problems in the previous
test, and if the previous test failed, the guest may be not rebooted,
this will cause failure when trying to delete the dir containing the
being used files.
reboot the guest will solve this problem.

2. reboot after test:
the Windows guest may encounter BSOD while rebooting after some tests,
add an option at the end of the test to detect this king of problems.

Signed-off-by: Chen Cao <[email protected]>
---
 client/tests/kvm/tests/autoit.py       |    8 ++++++++
 client/tests/kvm/tests_base.cfg.sample |    1 +
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/client/tests/kvm/tests/autoit.py b/client/tests/kvm/tests/autoit.py
index 9be1abe..e3fa6f6 100644
--- a/client/tests/kvm/tests/autoit.py
+++ b/client/tests/kvm/tests/autoit.py
@@ -17,10 +17,15 @@ def run_autoit(test, params, env):
     @param env: Dictionary with the test environment.
     """
     login_timeout = int(params.get("login_timeout", 360))
+    reboot = params.get("reboot", "no")
 
     vm = kvm_test_utils.get_living_vm(env, params.get("main_vm"))
     session = kvm_test_utils.wait_for_login(vm, timeout=login_timeout)
 
+    if reboot == "yes":
+        logging.debug("Rebooting guest before test ...")
+        session = kvm_test_utils.reboot(vm, session, timeout=login_timeout)
+
     try:
         logging.info("Starting script...")
 
@@ -79,5 +84,8 @@ def run_autoit(test, params, env):
         if status != 0:
             raise error.TestFail("Script execution failed")
 
+        if reboot == "yes":
+            logging.debug("Rebooting guest after test ...")
+            session = kvm_test_utils.reboot(vm, session, timeout=login_timeout)
     finally:
         session.close()
diff --git a/client/tests/kvm/tests_base.cfg.sample 
b/client/tests/kvm/tests_base.cfg.sample
index 7645ffc..63145d4 100644
--- a/client/tests/kvm/tests_base.cfg.sample
+++ b/client/tests/kvm/tests_base.cfg.sample
@@ -208,6 +208,7 @@ variants:
         autoit_binary = D:\AutoIt3.exe
         autoit_script_timeout = 600
         autoit_script_params =
+        reboot = yes
         variants:
             - notepad:
                 autoit_script = autoit/notepad1.au3

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to