Skip to contentSkip to conversation

Improve kvm subtest AutoIt - add option to download script from remote server

PATCH In review Cao, Chen 3 participants 6 messages Dec 1, 2009 – Dec 4, 2009 KVM

lore
Share & tools
lore

Cao, Chen

author
#0 lore raw

PATCH 1/1 Improve kvm subtest AutoIt - add option to download script from remote server

Add an option to let user download the .au3 script from a remote server, and keep the original method to prepare the script.

This makes it possible to employ AutoIt tests that involve several files.

new variants:
1. download,
if params.get("download") == "yes", download the scripts to guest, else use the original method, echo the code into guest.
2. download_cmd,
What tool to use to download.
User can choose git, as in the sample file, svn, ftp, or wget, or other preferred tools.
NOTE, this requires that the download tool is installed in the guest, or the tools have been placed in winutils.iso.
3. rsc_server,
Resource server which contains the AutoIt script
and provide a download service.
4. dst_rsc_dir,
Destination of the AutoIt scripts in the guest.
i.e. the downloaded resource will be saved in this default dir.
5. autoit_entry,
Which .au3 file to start to run.
this will be useful if a test involves several .au3 files.

---
 client/tests/kvm/kvm_tests.cfg.sample |    6 ++++
 client/tests/kvm/tests/autoit.py      |   45 ++++++++++++++++++++++----------
 2 files changed, 37 insertions(+), 14 deletions(-)
client/tests/kvm/kvm_tests.cfg.sample +6 -0
index 5e15b30..f688b97 100644
@@ -169,6 +169,12 @@ variants:
         variants:
             - notepad:
                 autoit_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"
 
     - guest_s4:     install setup unattended_install
         type = guest_s4
client/tests/kvm/tests/autoit.py +31 -14

54 lines not on this page · raw message

Signature · 1 line
1.5.5.6
#1 lore raw
Quoted 26 lines · ----- "Chen Cao

Add an option to let user download the .au3 script from a remote server, and keep the original method to prepare the script.

This makes it possible to employ AutoIt tests that involve several files.

new variants:
1. download,
if params.get("download") == "yes", download the scripts to guest, else use the original method, echo the code into guest.
2. download_cmd,
What tool to use to download.
User can choose git, as in the sample file, svn, ftp, or wget, or other preferred tools.
NOTE, this requires that the download tool is installed in the guest, or the tools have been placed in winutils.iso.
3. rsc_server,
Resource server which contains the AutoIt script
and provide a download service.
4. dst_rsc_dir,
Destination of the AutoIt scripts in the guest.
i.e. the downloaded resource will be saved in this default dir.
5. autoit_entry,
Which .au3 file to start to run.
this will be useful if a test involves several .au3 files.

Quoted 1 line

I haven't reviewed the code yet, but I have 2 quick questions:

- If the files we'll be downloading are text files (.au3 files), then why not download them in the host and send them to the guest using the echo method? This imposes less requirements on the guest.

- Why not add the ability to send multiple files from the host to the guest, using the echo method, without downloading them?

BTW, this echo method is meant to be used only until we add file transfer support to rss.exe (I'm not sure when exactly that will happen).

Quoted 100 lines
---
 client/tests/kvm/kvm_tests.cfg.sample |    6 ++++
 client/tests/kvm/tests/autoit.py      |   45
++++++++++++++++++++++----------
 2 files changed, 37 insertions(+), 14 deletions(-)
client/tests/kvm/kvm_tests.cfg.sample +6 -0
index 5e15b30..f688b97 100644
@@ -169,6 +169,12 @@ variants:
         variants:
             - notepad:
                 autoit_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"
 
     - guest_s4:     install setup unattended_install
         type = guest_s4
client/tests/kvm/tests/autoit.py +1 -1
index 9435d7c..ed1d491 100644
@@ -25,23 +25,40 @@ def run_autoit(test, params, env):
         # 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))
 
-        # Send AutoIt script to guest (this code will be replaced

once we

client/tests/kvm/tests/autoit.py +0 -2
-        # support sending files to Windows guests)
-        session.get_command_output("del script.au3",

internal_timeout=0)

client/tests/kvm/tests/autoit.py +0 -7
-        file = open(kvm_utils.get_path(test.bindir, script))
-        for line in file.readlines():
-            # Insert a '^' before each character
-            line = "".join("^" + c for c in line.rstrip())
-            if line:
-                # Append line to the file
-                session.get_command_output("echo %s>>script.au3" %

line,

client/tests/kvm/tests/autoit.py +0 -4
-                                           internal_timeout=0)
-        file.close()
-
-        command = "cmd /c %s script.au3 %s" % (binary,

script_params)

client/tests/kvm/tests/autoit.py +8 -0
+        # Download the script resource from a remote server, or
+        # prepare the script using rss?
+        if params.get("download") == "yes":
+            download_cmd = params.get("download_cmd")
+            rsc_server = params.get("rsc_server")
+            dst_rsc_dir = params.get("dst_rsc_dir")
+
+            # Change dir to dst_rsc_dir, and remove 'autoit' there,

then

client/tests/kvm/tests/autoit.py +2 -0
+            # download the resource.
+            rsc_cmd = "cd %s && (rmdir /s /q autoit || del /s /q

autoit) && " \
+ "%s %s" % (dst_rsc_dir, download_cmd,
rsc_server)

client/tests/kvm/tests/autoit.py +2 -0
+
+            if session.get_command_status(rsc_cmd, timeout=timeout)

!= 0:
+ raise error.TestFail("Download test resource
failed.")

client/tests/kvm/tests/autoit.py +3 -0
+            logging.info("Download resource finished.")
+        else:
+            # Send AutoIt script to guest (this code will be replaced

once we

client/tests/kvm/tests/autoit.py +2 -0
+            # support sending files to Windows guests)
+            session.get_command_output("del script.au3",

internal_timeout=0)

client/tests/kvm/tests/autoit.py +7 -0
+            file = open(kvm_utils.get_path(test.bindir, script))
+            for line in file.readlines():
+                # Insert a '^' before each character
+                line = "".join("^" + c for c in line.rstrip())
+                if line:
+                    # Append line to the file
+                    session.get_command_output("echo %s>>script.au3"

% line,

client/tests/kvm/tests/autoit.py +4 -0
+                                               internal_timeout=0)
+            file.close()
+
+        command = "cmd /c %s %s %s" % (binary, autoit_entry,

script_params)

         logging.info("---------------- Script output

----------------")
status = session.get_command_status(command,

Signature · 1 line
1.5.5.6
author
#2 lore raw
Quoted 29 lines · Michael Goldish
Quoted 26 lines · ----- "Chen Cao

Add an option to let user download the .au3 script from a remote server, and keep the original method to prepare the script.

This makes it possible to employ AutoIt tests that involve several files.

new variants:
1. download,
if params.get("download") == "yes", download the scripts to guest, else use the original method, echo the code into guest.
2. download_cmd,
What tool to use to download.
User can choose git, as in the sample file, svn, ftp, or wget, or other preferred tools.
NOTE, this requires that the download tool is installed in the guest, or the tools have been placed in winutils.iso.
3. rsc_server,
Resource server which contains the AutoIt script
and provide a download service.
4. dst_rsc_dir,
Destination of the AutoIt scripts in the guest.
i.e. the downloaded resource will be saved in this default dir.
5. autoit_entry,
Which .au3 file to start to run.
this will be useful if a test involves several .au3 files.

Quoted 8 lines
Quoted 1 line

I haven't reviewed the code yet, but I have 2 quick questions:

- If the files we'll be downloading are text files (.au3 files), then why not download them in the host and send them to the guest using the echo method? This imposes less requirements on the guest.

downloading/preparing them in the host also requires extra effects before the test.

and we may also need testing tools, which are binary executables, to aid our tests. then we have to wait for the improved rss.exe, it is bad for the users/testers.

Quoted 7 lines

- Why not add the ability to send multiple files from the host to the guest, using the echo method, without downloading them?

BTW, this echo method is meant to be used only until we add file transfer support to rss.exe (I'm not sure when exactly that will happen).

I just like to give the users/testers more choices to focus on the tests. especially, for now it is a little hard to echo multiple files into guest.

I am also looking forward to the new version of rss with file transfer functions.

Thanks for your questions, buddy.

Regards,

Cao, Chen
2009/12/01

Quoted 101 lines
Quoted 101 lines
---
 client/tests/kvm/kvm_tests.cfg.sample |    6 ++++
 client/tests/kvm/tests/autoit.py      |   45
++++++++++++++++++++++----------
 2 files changed, 37 insertions(+), 14 deletions(-)
client/tests/kvm/kvm_tests.cfg.sample +6 -0
index 5e15b30..f688b97 100644
@@ -169,6 +169,12 @@ variants:
         variants:
             - notepad:
                 autoit_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"
 
     - guest_s4:     install setup unattended_install
         type = guest_s4
client/tests/kvm/tests/autoit.py +1 -1
index 9435d7c..ed1d491 100644
@@ -25,23 +25,40 @@ def run_autoit(test, params, env):
         # 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))
 
-        # Send AutoIt script to guest (this code will be replaced

once we

client/tests/kvm/tests/autoit.py +0 -2
-        # support sending files to Windows guests)
-        session.get_command_output("del script.au3",

internal_timeout=0)

client/tests/kvm/tests/autoit.py +0 -7
-        file = open(kvm_utils.get_path(test.bindir, script))
-        for line in file.readlines():
-            # Insert a '^' before each character
-            line = "".join("^" + c for c in line.rstrip())
-            if line:
-                # Append line to the file
-                session.get_command_output("echo %s>>script.au3" %

line,

client/tests/kvm/tests/autoit.py +0 -4
-                                           internal_timeout=0)
-        file.close()
-
-        command = "cmd /c %s script.au3 %s" % (binary,

script_params)

client/tests/kvm/tests/autoit.py +8 -0
+        # Download the script resource from a remote server, or
+        # prepare the script using rss?
+        if params.get("download") == "yes":
+            download_cmd = params.get("download_cmd")
+            rsc_server = params.get("rsc_server")
+            dst_rsc_dir = params.get("dst_rsc_dir")
+
+            # Change dir to dst_rsc_dir, and remove 'autoit' there,

then

client/tests/kvm/tests/autoit.py +2 -0
+            # download the resource.
+            rsc_cmd = "cd %s && (rmdir /s /q autoit || del /s /q

autoit) && " \
+ "%s %s" % (dst_rsc_dir, download_cmd,
rsc_server)

client/tests/kvm/tests/autoit.py +2 -0
+
+            if session.get_command_status(rsc_cmd, timeout=timeout)

!= 0:
+ raise error.TestFail("Download test resource
failed.")

client/tests/kvm/tests/autoit.py +3 -0
+            logging.info("Download resource finished.")
+        else:
+            # Send AutoIt script to guest (this code will be replaced

once we

client/tests/kvm/tests/autoit.py +2 -0
+            # support sending files to Windows guests)
+            session.get_command_output("del script.au3",

internal_timeout=0)

client/tests/kvm/tests/autoit.py +7 -0
+            file = open(kvm_utils.get_path(test.bindir, script))
+            for line in file.readlines():
+                # Insert a '^' before each character
+                line = "".join("^" + c for c in line.rstrip())
+                if line:
+                    # Append line to the file
+                    session.get_command_output("echo %s>>script.au3"

% line,

client/tests/kvm/tests/autoit.py +4 -0
+                                               internal_timeout=0)
+            file.close()
+
+        command = "cmd /c %s %s %s" % (binary, autoit_entry,

script_params)

         logging.info("---------------- Script output

----------------")
status = session.get_command_status(command,

Signature · 1 line
1.5.5.6
#3 lore raw

Chen, I have verified your patch, code looks good, but I am indeed a bit concerned about putting extra requirements on winutils.iso. How hard it is to get git working under windows? I did some quick research and seems that we have a portable version of git that could be kept on winutils.iso for that matter. Please let me know how you guys are doing this.

So even though the generic idea looks fine, I am a bit concerned about the defaults you've put in, so I will wait for your considerations about how exactly we are planning to get git under the windows guests, OK?

Quoted 174 lines · Chen
Quoted 29 lines · Michael Goldish
Quoted 26 lines · ----- "Chen Cao

Add an option to let user download the .au3 script from a remote server, and keep the original method to prepare the script.

This makes it possible to employ AutoIt tests that involve several files.

new variants:
1. download,
   if params.get("download") == "yes", download the scripts to guest, else use the original method, echo the code into guest.
2. download_cmd,
   What tool to use to download.
   User can choose git, as in the sample file, svn, ftp, or wget, or other preferred tools.
   NOTE, this requires that the download tool is installed in the guest, or the tools have been placed in winutils.iso.
3. rsc_server,
   Resource server which contains the AutoIt script
   and provide a download service.
4. dst_rsc_dir,
   Destination of the AutoIt scripts in the guest.
   i.e. the downloaded resource will be saved in this default dir.
5. autoit_entry,
   Which .au3 file to start to run.
   this will be useful if a test involves several .au3 files.

Quoted 8 lines
Quoted 1 line

I haven't reviewed the code yet, but I have 2 quick questions:

- If the files we'll be downloading are text files (.au3 files), then why not download them in the host and send them to the guest using the echo method?  This imposes less requirements on the guest.

downloading/preparing them in the host also requires extra effects before the test.

and we may also need testing tools, which are binary executables, to aid our tests. then we have to wait for the improved rss.exe, it is bad for the users/testers.

Quoted 7 lines

- Why not add the ability to send multiple files from the host to the guest, using the echo method, without downloading them?

BTW, this echo method is meant to be used only until we add file transfer support to rss.exe (I'm not sure when exactly that will happen).

I just like to give the users/testers more choices to focus on the tests. especially, for now it is a little hard to echo multiple files into guest.

I am also looking forward to the new version of rss with file transfer functions.

Thanks for your questions, buddy.

Regards,

Cao, Chen
2009/12/01

Quoted 96 lines
Quoted 96 lines

---
 client/tests/kvm/kvm_tests.cfg.sample |    6 ++++ client/tests/kvm/tests/autoit.py      |   45
++++++++++++++++++++++----------

 2 files changed, 37 insertions(+), 14 deletions(-)
client/tests/kvm/kvm_tests.cfg.sample +0 -0
index 5e15b30..f688b97 100644
@@ -169,6 +169,12 @@ variants:

         variants:
             - notepad:
                 autoit_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"

     - guest_s4:     install setup unattended_install type = guest_s4

client/tests/kvm/tests/autoit.py +1 -1
index 9435d7c..ed1d491 100644
@@ -25,23 +25,40 @@ def run_autoit(test, params, env):
          # 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))
 
-        # Send AutoIt script to guest (this code will be replaced

once we
-        # support sending files to Windows guests)
-        session.get_command_output("del script.au3", internal_timeout=0)
-        file = open(kvm_utils.get_path(test.bindir, script))
-        for line in file.readlines():
-            # Insert a '^' before each character
-            line = "".join("^" + c for c in line.rstrip())
-            if line:
-                # Append line to the file
-                session.get_command_output("echo %s>>script.au3" % line,
-                                           internal_timeout=0)
-        file.close()
-
-        command = "cmd /c %s script.au3 %s" % (binary, script_params)
+        # Download the script resource from a remote server, or
+        # prepare the script using rss?
+        if params.get("download") == "yes":
+            download_cmd = params.get("download_cmd")
+            rsc_server = params.get("rsc_server")
+            dst_rsc_dir = params.get("dst_rsc_dir")
+
+            # Change dir to dst_rsc_dir, and remove 'autoit' there, then
+            # download the resource.
+            rsc_cmd = "cd %s && (rmdir /s /q autoit || del /s /q autoit) && " \
+                      "%s %s" % (dst_rsc_dir, download_cmd, rsc_server)
+
+            if session.get_command_status(rsc_cmd, timeout=timeout) != 0:
+                raise error.TestFail("Download test resource failed.")
+            logging.info("Download resource finished.")
+        else:
+            # Send AutoIt script to guest (this code will be replaced once we
+            # support sending files to Windows guests)
+            session.get_command_output("del script.au3", internal_timeout=0)
+            file = open(kvm_utils.get_path(test.bindir, script))
+            for line in file.readlines():
+                # Insert a '^' before each character
+                line = "".join("^" + c for c in line.rstrip())
+                if line:
+                    # Append line to the file
+                    session.get_command_output("echo %s>>script.au3" % line,
+                                               internal_timeout=0)
+            file.close()
+
+        command = "cmd /c %s %s %s" % (binary, autoit_entry, script_params)

Quoted 5 lines
Quoted 5 lines

         logging.info("---------------- Script output ----------------")
         status = session.get_command_status(command, --
1.5.5.6

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

Signature · 1 line
Lucas
author
#4 lore raw

Hi, Lucas,

Quoted 7 lines · Lucas Meneghel Rodrigues

Chen, I have verified your patch, code looks good, but I am indeed a bit concerned about putting extra requirements on winutils.iso. How hard it is to get git working under windows? I did some quick research and seems that we have a portable version of git that could be kept on winutils.iso for that matter. Please let me know how you guys are doing this.

We have had msysgit <http://code.google.com/p/msysgit/> pre-installed in windows guests for internal testings, actually for a long time.

Quoted 4 lines

So even though the generic idea looks fine, I am a bit concerned about the defaults you've put in, so I will wait for your considerations about how exactly we are planning to get git under the windows guests, OK?

I think the download method is just an option that frees the users. and we do not require the defaults.

because if the users do not like the git way, they could use rss.exe to echo/transfer the files into guests as we provide now, however, they should do some preparations on host anyway, i.e. put the scripts/resource files in the hosts
(using scp/git/svn/wget/nfs/any_other_way, which also demands the pre-existance of extra tools).

if users like to try the download method, they can also use wget, svn, or even ftp (with command file from the command line), we just try to provide options but not limitations.

For your concerns, I think you mean to make autotest(kvm) easy to use, and more user-friendly, but from my point of view, it is very hard to let a user take actually advantages from the autotest framework and the kvm subtests if s/he knows nothing or very little about these.

Besides, I think the best argument for the download method is that the rss.exe way does not meet the testing requirements. our tests involve binary testing tools for floating point tests, for example, and video/audio files for multimedia tests, and other non-text files, which we cannot manage with only rss.exe, at least for now.

So, I suggest we make our testcases more open.

Thanks for your review, advice and extra researching effort.

Regards,

Cao, Chen
2009/12/03

Quoted 181 lines · Chen
Quoted 174 lines · Michael Goldish
Quoted 29 lines
Quoted 26 lines · ----- "Chen Cao

Add an option to let user download the .au3 script from a remote server, and keep the original method to prepare the script.

This makes it possible to employ AutoIt tests that involve several files.

new variants:
1. download,
   if params.get("download") == "yes", download the scripts to guest, else use the original method, echo the code into guest.
2. download_cmd,
   What tool to use to download.
   User can choose git, as in the sample file, svn, ftp, or wget, or other preferred tools.
   NOTE, this requires that the download tool is installed in the guest, or the tools have been placed in winutils.iso.
3. rsc_server,
   Resource server which contains the AutoIt script
   and provide a download service.
4. dst_rsc_dir,
   Destination of the AutoIt scripts in the guest.
   i.e. the downloaded resource will be saved in this default dir.
5. autoit_entry,
   Which .au3 file to start to run.
   this will be useful if a test involves several .au3 files.

Quoted 8 lines
Quoted 1 line

I haven't reviewed the code yet, but I have 2 quick questions:

- If the files we'll be downloading are text files (.au3 files), then why not download them in the host and send them to the guest using the echo method?  This imposes less requirements on the guest.

downloading/preparing them in the host also requires extra effects before the test.

and we may also need testing tools, which are binary executables, to aid our tests. then we have to wait for the improved rss.exe, it is bad for the users/testers.

Quoted 7 lines

- Why not add the ability to send multiple files from the host to the guest, using the echo method, without downloading them?

BTW, this echo method is meant to be used only until we add file transfer support to rss.exe (I'm not sure when exactly that will happen).

I just like to give the users/testers more choices to focus on the tests. especially, for now it is a little hard to echo multiple files into guest.

I am also looking forward to the new version of rss with file transfer functions.

Thanks for your questions, buddy.

Regards,

Cao, Chen
2009/12/01

Quoted 96 lines
Quoted 96 lines

---
 client/tests/kvm/kvm_tests.cfg.sample |    6 ++++ client/tests/kvm/tests/autoit.py      |   45
++++++++++++++++++++++----------

 2 files changed, 37 insertions(+), 14 deletions(-)
client/tests/kvm/kvm_tests.cfg.sample +0 -0
index 5e15b30..f688b97 100644
@@ -169,6 +169,12 @@ variants:

         variants:
             - notepad:
                 autoit_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"

     - guest_s4:     install setup unattended_install type = guest_s4

client/tests/kvm/tests/autoit.py +1 -1
index 9435d7c..ed1d491 100644
@@ -25,23 +25,40 @@ def run_autoit(test, params, env):
          # 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))
 
-        # Send AutoIt script to guest (this code will be replaced

once we
-        # support sending files to Windows guests)
-        session.get_command_output("del script.au3", internal_timeout=0)
-        file = open(kvm_utils.get_path(test.bindir, script))
-        for line in file.readlines():
-            # Insert a '^' before each character
-            line = "".join("^" + c for c in line.rstrip())
-            if line:
-                # Append line to the file
-                session.get_command_output("echo %s>>script.au3" % line,
-                                           internal_timeout=0)
-        file.close()
-
-        command = "cmd /c %s script.au3 %s" % (binary, script_params)
+        # Download the script resource from a remote server, or
+        # prepare the script using rss?
+        if params.get("download") == "yes":
+            download_cmd = params.get("download_cmd")
+            rsc_server = params.get("rsc_server")
+            dst_rsc_dir = params.get("dst_rsc_dir")
+
+            # Change dir to dst_rsc_dir, and remove 'autoit' there, then
+            # download the resource.
+            rsc_cmd = "cd %s && (rmdir /s /q autoit || del /s /q autoit) && " \
+                      "%s %s" % (dst_rsc_dir, download_cmd, rsc_server)
+
+            if session.get_command_status(rsc_cmd, timeout=timeout) != 0:
+                raise error.TestFail("Download test resource failed.")
+            logging.info("Download resource finished.")
+        else:
+            # Send AutoIt script to guest (this code will be replaced once we
+            # support sending files to Windows guests)
+            session.get_command_output("del script.au3", internal_timeout=0)
+            file = open(kvm_utils.get_path(test.bindir, script))
+            for line in file.readlines():
+                # Insert a '^' before each character
+                line = "".join("^" + c for c in line.rstrip())
+                if line:
+                    # Append line to the file
+                    session.get_command_output("echo %s>>script.au3" % line,
+                                               internal_timeout=0)
+            file.close()
+
+        command = "cmd /c %s %s %s" % (binary, autoit_entry, script_params)

Quoted 5 lines
Quoted 5 lines

         logging.info("---------------- Script output ----------------")
         status = session.get_command_status(command, --
1.5.5.6

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

Signature · 1 line
Lucas
#5 lore raw

Ok, fair enough, applied! Thanks Chen

Quoted 245 lines · Chen

Hi, Lucas,

Quoted 7 lines · Lucas Meneghel Rodrigues

Chen, I have verified your patch, code looks good, but I am indeed a bit concerned about putting extra requirements on winutils.iso. How hard it is to get git working under windows? I did some quick research and seems that we have a portable version of git that could be kept on winutils.iso for that matter. Please let me know how you guys are doing this.

We have had msysgit <http://code.google.com/p/msysgit/> pre-installed in windows guests for internal testings, actually for a long time.

Quoted 4 lines

So even though the generic idea looks fine, I am a bit concerned about the defaults you've put in, so I will wait for your considerations about how exactly we are planning to get git under the windows guests, OK?

I think the download method is just an option that frees the users. and we do not require the defaults.

because if the users do not like the git way, they could use rss.exe to echo/transfer the files into guests as we provide now, however, they should do some preparations on host anyway, i.e. put the scripts/resource files in the hosts
(using scp/git/svn/wget/nfs/any_other_way, which also demands the pre-existance of extra tools).

if users like to try the download method, they can also use wget, svn, or even ftp (with command file from the command line), we just try to provide options but not limitations.

For your concerns, I think you mean to make autotest(kvm) easy to use, and more user-friendly, but from my point of view, it is very hard to let a user take actually advantages from the autotest framework and the kvm subtests if s/he knows nothing or very little about these.

Besides, I think the best argument for the download method is that the rss.exe way does not meet the testing requirements. our tests involve binary testing tools for floating point tests, for example, and video/audio files for multimedia tests, and other non-text files, which we cannot manage with only rss.exe, at least for now.

So, I suggest we make our testcases more open.

Thanks for your review, advice and extra researching effort.

Regards,

Cao, Chen
2009/12/03

Quoted 179 lines · Chen
Quoted 164 lines · Michael Goldish
Quoted 29 lines
Quoted 26 lines · ----- "Chen Cao

Add an option to let user download the .au3 script from a remote server, and keep the original method to prepare the script.

This makes it possible to employ AutoIt tests that involve several files.

new variants:
1. download,
   if params.get("download") == "yes", download the scripts to guest, else use the original method, echo the code into guest.
2. download_cmd,
   What tool to use to download.
   User can choose git, as in the sample file, svn, ftp, or wget, or other preferred tools.
   NOTE, this requires that the download tool is installed in the guest, or the tools have been placed in winutils.iso.
3. rsc_server,
   Resource server which contains the AutoIt script
   and provide a download service.
4. dst_rsc_dir,
   Destination of the AutoIt scripts in the guest.
   i.e. the downloaded resource will be saved in this default dir.
5. autoit_entry,
   Which .au3 file to start to run.
   this will be useful if a test involves several .au3 files.

Quoted 8 lines
Quoted 1 line

I haven't reviewed the code yet, but I have 2 quick questions:

- If the files we'll be downloading are text files (.au3 files), then why not download them in the host and send them to the guest using the echo method?  This imposes less requirements on the guest.

downloading/preparing them in the host also requires extra effects before the test.

and we may also need testing tools, which are binary executables, to aid our tests. then we have to wait for the improved rss.exe, it is bad for the users/testers.

Quoted 7 lines

- Why not add the ability to send multiple files from the host to the guest, using the echo method, without downloading them?

BTW, this echo method is meant to be used only until we add file transfer support to rss.exe (I'm not sure when exactly that will happen).

I just like to give the users/testers more choices to focus on the tests. especially, for now it is a little hard to echo multiple files into guest.

I am also looking forward to the new version of rss with file transfer functions.

Thanks for your questions, buddy.

Regards,

Cao, Chen
2009/12/01

Quoted 96 lines
Quoted 96 lines

---
 client/tests/kvm/kvm_tests.cfg.sample |    6 ++++ client/tests/kvm/tests/autoit.py      |   45
++++++++++++++++++++++----------

 2 files changed, 37 insertions(+), 14 deletions(-)
client/tests/kvm/kvm_tests.cfg.sample +0 -0
index 5e15b30..f688b97 100644
@@ -169,6 +169,12 @@ variants:

         variants:
             - notepad:
                 autoit_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"

     - guest_s4:     install setup unattended_install type = guest_s4

client/tests/kvm/tests/autoit.py +1 -1
index 9435d7c..ed1d491 100644
@@ -25,23 +25,40 @@ def run_autoit(test, params, env):
          # 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))
 
-        # Send AutoIt script to guest (this code will be replaced

once we
-        # support sending files to Windows guests)
-        session.get_command_output("del script.au3", internal_timeout=0)
-        file = open(kvm_utils.get_path(test.bindir, script))
-        for line in file.readlines():
-            # Insert a '^' before each character
-            line = "".join("^" + c for c in line.rstrip())
-            if line:
-                # Append line to the file
-                session.get_command_output("echo %s>>script.au3" % line,
-                                           internal_timeout=0)
-        file.close()
-
-        command = "cmd /c %s script.au3 %s" % (binary, script_params)
+        # Download the script resource from a remote server, or
+        # prepare the script using rss?
+        if params.get("download") == "yes":
+            download_cmd = params.get("download_cmd")
+            rsc_server = params.get("rsc_server")
+            dst_rsc_dir = params.get("dst_rsc_dir")
+
+            # Change dir to dst_rsc_dir, and remove 'autoit' there, then
+            # download the resource.
+            rsc_cmd = "cd %s && (rmdir /s /q autoit || del /s /q autoit) && " \
+                      "%s %s" % (dst_rsc_dir, download_cmd, rsc_server)
+
+            if session.get_command_status(rsc_cmd, timeout=timeout) != 0:
+                raise error.TestFail("Download test resource failed.")
+            logging.info("Download resource finished.")
+        else:
+            # Send AutoIt script to guest (this code will be replaced once we
+            # support sending files to Windows guests)
+            session.get_command_output("del script.au3", internal_timeout=0)
+            file = open(kvm_utils.get_path(test.bindir, script))
+            for line in file.readlines():
+                # Insert a '^' before each character
+                line = "".join("^" + c for c in line.rstrip())
+                if line:
+                    # Append line to the file
+                    session.get_command_output("echo %s>>script.au3" % line,
+                                               internal_timeout=0)
+            file.close()
+
+        command = "cmd /c %s %s %s" % (binary, autoit_entry, script_params)

Quoted 10 lines
Quoted 5 lines
Quoted 5 lines

         logging.info("---------------- Script output ----------------")
         status = session.get_command_status(command, --
1.5.5.6

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

Quoted 2 lines

--
Lucas

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

Signature · 1 line
Lucas