From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Cao, Chen" Subject: Re: [Autotest] [KVM-AUTOTEST PATCH] Improve kvm subtest AutoIt - add option to download script from remote server Date: Thu, 3 Dec 2009 14:39:33 +0800 Message-ID: <20091203063933.GC2930@rht.nay.redhat.com> References: <1259651792-22609-1-git-send-email-kcao@redhat.com> <1642084429.876051259653783787.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com> <20091201101713.GA3803@rht.nay.redhat.com> <6ac58f4f0912021916y43122725x4085a710b8f42820@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Michael Goldish , autotest@test.kernel.org, kvm@vger.kernel.org To: Lucas Meneghel Rodrigues Return-path: Received: from mx1.redhat.com ([209.132.183.28]:27723 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751643AbZLCGjY (ORCPT ); Thu, 3 Dec 2009 01:39:24 -0500 Content-Disposition: inline In-Reply-To: <6ac58f4f0912021916y43122725x4085a710b8f42820@mail.gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: Hi, Lucas, On Thu, Dec 03, 2009 at 01:16:27AM -0200, Lucas Meneghel Rodrigues wrot= e: > 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 researc= h > and seems that we have a portable version of git that could be kept o= n > winutils.iso for that matter. Please let me know how you guys are > doing this. >=20 We have had msysgit pre-installed i= n windows guests for internal testings, actually for a long time. > So even though the generic idea looks fine, I am a bit concerned abou= t > 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. =46or 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 >=20 > On Tue, Dec 1, 2009 at 8:17 AM, Cao, Chen wrote: > > On Tue, Dec 01, 2009 at 02:49:43AM -0500, Michael Goldish wrote: > >> > >> ----- "Chen Cao" wrote: > >> > >> > 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 sever= al > >> > files. > >> > > >> > new variants: > >> > 1. download, > >> > =A0 =A0if params.get("download") =3D=3D "yes", download the scri= pts to guest, > >> > =A0 =A0else use the original method, echo the code into guest. > >> > 2. download_cmd, > >> > =A0 =A0What tool to use to download. > >> > =A0 =A0User can choose git, as in the sample file, svn, ftp, or = wget, > >> > =A0 =A0or other preferred tools. > >> > =A0 =A0NOTE, this requires that the download tool is installed i= n the > >> > =A0 =A0guest, or the tools have been placed in winutils.iso. > >> > 3. rsc_server, > >> > =A0 =A0Resource server which contains the AutoIt script > >> > =A0 =A0and provide a download service. > >> > 4. dst_rsc_dir, > >> > =A0 =A0Destination of the AutoIt scripts in the guest. > >> > =A0 =A0i.e. the downloaded resource will be saved in this defaul= t dir. > >> > 5. autoit_entry, > >> > =A0 =A0Which .au3 file to start to run. > >> > =A0 =A0this will be useful if a test involves several .au3 files= =2E > >> > > >> > Signed-off-by: Cao, Chen > >> > >> 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), t= hen > >> why not download them in the host and send them to the guest using > >> the echo method? =A0This 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. > > > >> - 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 trans= fer > > functions. > > > > Thanks for your questions, buddy. > > > > > > Regards, > > > > Cao, Chen > > 2009/12/01 > > > >> > >> > --- > >> > =A0client/tests/kvm/kvm_tests.cfg.sample | =A0 =A06 ++++ > >> > =A0client/tests/kvm/tests/autoit.py =A0 =A0 =A0| =A0 45 > >> > ++++++++++++++++++++++---------- > >> > =A02 files changed, 37 insertions(+), 14 deletions(-) > >> > > >> > diff --git a/client/tests/kvm/kvm_tests.cfg.sample > >> > b/client/tests/kvm/kvm_tests.cfg.sample > >> > index 5e15b30..f688b97 100644 > >> > --- a/client/tests/kvm/kvm_tests.cfg.sample > >> > +++ b/client/tests/kvm/kvm_tests.cfg.sample > >> > @@ -169,6 +169,12 @@ variants: > >> > =A0 =A0 =A0 =A0 =A0variants: > >> > =A0 =A0 =A0 =A0 =A0 =A0 =A0- notepad: > >> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0autoit_script =3D autoit/note= pad1.au3 > >> > + =A0 =A0 =A0 =A0 =A0 =A0- stub: > >> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0download =3D yes > >> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0download_cmd =3D "git clone" > >> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0rsc_server =3D "git://the.resou= rce.server/autoit" > >> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0dst_rsc_dir =3D "C:\" > >> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0autoit_entry =3D "C:\autoit\stu= b\stub.au3" > >> > > >> > =A0 =A0 =A0- guest_s4: =A0 =A0 install setup unattended_install > >> > =A0 =A0 =A0 =A0 =A0type =3D guest_s4 > >> > diff --git a/client/tests/kvm/tests/autoit.py > >> > b/client/tests/kvm/tests/autoit.py > >> > index 9435d7c..ed1d491 100644 > >> > --- a/client/tests/kvm/tests/autoit.py > >> > +++ b/client/tests/kvm/tests/autoit.py > >> > @@ -25,23 +25,40 @@ def run_autoit(test, params, env): > >> > =A0 =A0 =A0 =A0 =A0# Collect test parameters > >> > =A0 =A0 =A0 =A0 =A0binary =3D params.get("autoit_binary") > >> > =A0 =A0 =A0 =A0 =A0script =3D params.get("autoit_script") > >> > + =A0 =A0 =A0 =A0autoit_entry =3D params.get("autoit_entry", "sc= ript.au3") > >> > =A0 =A0 =A0 =A0 =A0script_params =3D params.get("autoit_script_p= arams", "") > >> > =A0 =A0 =A0 =A0 =A0timeout =3D float(params.get("autoit_script_t= imeout", 600)) > >> > > >> > - =A0 =A0 =A0 =A0# Send AutoIt script to guest (this code will b= e replaced > >> > once we > >> > - =A0 =A0 =A0 =A0# support sending files to Windows guests) > >> > - =A0 =A0 =A0 =A0session.get_command_output("del script.au3", > >> > internal_timeout=3D0) > >> > - =A0 =A0 =A0 =A0file =3D open(kvm_utils.get_path(test.bindir, s= cript)) > >> > - =A0 =A0 =A0 =A0for line in file.readlines(): > >> > - =A0 =A0 =A0 =A0 =A0 =A0# Insert a '^' before each character > >> > - =A0 =A0 =A0 =A0 =A0 =A0line =3D "".join("^" + c for c in line.= rstrip()) > >> > - =A0 =A0 =A0 =A0 =A0 =A0if line: > >> > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0# Append line to the file > >> > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0session.get_command_output("ech= o %s>>script.au3" % > >> > line, > >> > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 internal_timeout=3D0) > >> > - =A0 =A0 =A0 =A0file.close() > >> > - > >> > - =A0 =A0 =A0 =A0command =3D "cmd /c %s script.au3 %s" % (binary= , > >> > script_params) > >> > + =A0 =A0 =A0 =A0# Download the script resource from a remote se= rver, or > >> > + =A0 =A0 =A0 =A0# prepare the script using rss? > >> > + =A0 =A0 =A0 =A0if params.get("download") =3D=3D "yes": > >> > + =A0 =A0 =A0 =A0 =A0 =A0download_cmd =3D params.get("download_c= md") > >> > + =A0 =A0 =A0 =A0 =A0 =A0rsc_server =3D params.get("rsc_server") > >> > + =A0 =A0 =A0 =A0 =A0 =A0dst_rsc_dir =3D params.get("dst_rsc_dir= ") > >> > + > >> > + =A0 =A0 =A0 =A0 =A0 =A0# Change dir to dst_rsc_dir, and remove= 'autoit' there, > >> > then > >> > + =A0 =A0 =A0 =A0 =A0 =A0# download the resource. > >> > + =A0 =A0 =A0 =A0 =A0 =A0rsc_cmd =3D "cd %s && (rmdir /s /q auto= it || del /s /q > >> > autoit) && " \ > >> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"%s %s" % (dst_rsc_= dir, download_cmd, > >> > rsc_server) > >> > + > >> > + =A0 =A0 =A0 =A0 =A0 =A0if session.get_command_status(rsc_cmd, = timeout=3Dtimeout) > >> > !=3D 0: > >> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0raise error.TestFail("Download = test resource > >> > failed.") > >> > + =A0 =A0 =A0 =A0 =A0 =A0logging.info("Download resource finishe= d.") > >> > + =A0 =A0 =A0 =A0else: > >> > + =A0 =A0 =A0 =A0 =A0 =A0# Send AutoIt script to guest (this cod= e will be replaced > >> > once we > >> > + =A0 =A0 =A0 =A0 =A0 =A0# support sending files to Windows gues= ts) > >> > + =A0 =A0 =A0 =A0 =A0 =A0session.get_command_output("del script.= au3", > >> > internal_timeout=3D0) > >> > + =A0 =A0 =A0 =A0 =A0 =A0file =3D open(kvm_utils.get_path(test.b= indir, script)) > >> > + =A0 =A0 =A0 =A0 =A0 =A0for line in file.readlines(): > >> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0# Insert a '^' before each char= acter > >> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0line =3D "".join("^" + c for c = in line.rstrip()) > >> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if line: > >> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0# Append line to the fi= le > >> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0session.get_command_out= put("echo %s>>script.au3" > >> > % line, > >> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 internal_timeout=3D0) > >> > + =A0 =A0 =A0 =A0 =A0 =A0file.close() > >> > + > >> > + =A0 =A0 =A0 =A0command =3D "cmd /c %s %s %s" % (binary, autoit= _entry, > >> > script_params) > >> > > >> > =A0 =A0 =A0 =A0 =A0logging.info("---------------- Script output > >> > ----------------") > >> > =A0 =A0 =A0 =A0 =A0status =3D session.get_command_status(command= , > >> > -- > >> > 1.5.5.6 > > _______________________________________________ > > Autotest mailing list > > Autotest@test.kernel.org > > http://test.kernel.org/cgi-bin/mailman/listinfo/autotest > > >=20 >=20 >=20 > --=20 > Lucas