From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lucas Meneghel Rodrigues Subject: Re: [PATCH 3/3] KVM Test: Add ioquit test case Date: Thu, 6 May 2010 20:32:33 -0300 Message-ID: References: <1270630156-9904-1-git-send-email-fyang@redhat.com> <1270630156-9904-2-git-send-email-fyang@redhat.com> <1270630156-9904-3-git-send-email-fyang@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Cc: autotest@test.kernel.org, kvm@vger.kernel.org To: Feng Yang Return-path: In-Reply-To: <1270630156-9904-3-git-send-email-fyang@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: autotest-bounces@test.kernel.org Errors-To: autotest-bounces@test.kernel.org List-Id: kvm.vger.kernel.org On Wed, Apr 7, 2010 at 5:49 AM, Feng Yang wrote: > Signed-off-by: Feng Yang > --- > =A0client/tests/kvm/tests/ioquit.py =A0 =A0 =A0 | =A0 54 ++++++++++++++++= ++++++++++++++++ > =A0client/tests/kvm/tests_base.cfg.sample | =A0 =A04 ++ > =A02 files changed, 58 insertions(+), 0 deletions(-) > =A0create mode 100644 client/tests/kvm/tests/ioquit.py > > diff --git a/client/tests/kvm/tests/ioquit.py b/client/tests/kvm/tests/io= quit.py > new file mode 100644 > index 0000000..c75a0e3 > --- /dev/null > +++ b/client/tests/kvm/tests/ioquit.py > @@ -0,0 +1,54 @@ > +import logging, time, random, signal, os > +from autotest_lib.client.common_lib import error > +import kvm_test_utils, kvm_utils > + > + > +def run_ioquit(test, params, env): > + =A0 =A0""" > + =A0 =A0Emulate the poweroff under IO workload(dbench so far) using moni= tor > + =A0 =A0command 'quit'. > + > + =A0 =A0@param test: Kvm test object > + =A0 =A0@param params: Dictionary with the test parameters. > + =A0 =A0@param env: Dictionary with test environment. > + =A0 =A0""" Hi Feng, after reading your test I *think* I got the idea. You want to put some heavy load on the system, quit the VM through a monitor command and then we pray for it to not segfault during the process. However: 1) Using autotest in the background to generate the high load certainly seems overkill. I'd say to use a rather standard shell one liner to generate the load, put it to run in background, and that is it. 2) In no moment this test actually issues a 'quit' through monitor 3) When sending 'quit' is implemented, then if the VM segfaults the crash handler will pick up the core dump So, please simplify the test removing the function that forks autotest and runs it on background, actually send quit through the monitor, give it a good round of testing and then send it again. I am still not 100% convinced of the usefulness of the test, but it's worth a try. > + =A0 =A0vm =3D kvm_test_utils.get_living_vm(env, params.get("main_vm")) > + =A0 =A0session =3D kvm_test_utils.wait_for_login(vm, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0timeout=3Dint(params.get("login_time= out", 360))) > + =A0 =A0session2 =3D kvm_test_utils.wait_for_login(vm, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0timeout=3Dint(params.get("login_time= out", 360))) > + =A0 =A0def is_autotest_launched(): > + =A0 =A0 =A0 =A0if session.get_command_status("pgrep autotest") !=3D 0: > + =A0 =A0 =A0 =A0 =A0 =A0logging.debug("Autotest process not found") > + =A0 =A0 =A0 =A0 =A0 =A0return False > + =A0 =A0 =A0 =A0return True > + > + =A0 =A0test_name =3D params.get("background_test", "dbench") > + =A0 =A0control_file =3D params.get("control_file", "dbench.control") > + =A0 =A0timeout =3D int(params.get("test_timeout", 300)) > + =A0 =A0control_path =3D os.path.join(test.bindir, "autotest_control", > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0control_= file) > + =A0 =A0outputdir =3D test.outputdir > + > + =A0 =A0pid =3D kvm_test_utils.run_autotest_background(vm, session2, con= trol_path, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 timeout, test_name, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 outputdir) > + =A0 =A0if pid < 0: > + =A0 =A0 =A0 =A0raise error.TestError("Could not create child process to= execute " > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"autotest ba= ckground") > + > + =A0 =A0if kvm_utils.wait_for(is_autotest_launched, 240, 0, 2): > + =A0 =A0 =A0 =A0logging.debug("Background autotest successfully") > + =A0 =A0else: > + =A0 =A0 =A0 =A0logging.debug("Background autotest failed, start the tes= t anyway") > + > + =A0 =A0time.sleep(100 + random.randrange(0,100)) > + =A0 =A0logging.info("Kill the virtual machine") > + =A0 =A0vm.process.close() > + > + =A0 =A0logging.info("Kill the tracking process") > + =A0 =A0kvm_utils.safe_kill(pid, signal.SIGKILL) > + =A0 =A0kvm_test_utils.wait_autotest_background(pid) > + =A0 =A0session.close() > + =A0 =A0session2.close() > + > diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/te= sts_base.cfg.sample > index 9b12fc2..d8530f6 100644 > --- a/client/tests/kvm/tests_base.cfg.sample > +++ b/client/tests/kvm/tests_base.cfg.sample > @@ -305,6 +305,10 @@ variants: > =A0 =A0 =A0 =A0 =A0 =A0 - ksm_parallel: > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ksm_mode =3D "parallel" > > + =A0 =A0- ioquit: > + =A0 =A0 =A0 =A0type =3D ioquit > + =A0 =A0 =A0 =A0control_file =3D dbench.control.200 > + =A0 =A0 =A0 =A0background_test =3D dbench > =A0 =A0 # system_powerdown, system_reset and shutdown *must* be the last = ones > =A0 =A0 # defined (in this order), since the effect of such tests can lea= ve > =A0 =A0 # the VM on a bad state. > -- > 1.5.5.6 > > _______________________________________________ > Autotest mailing list > Autotest@test.kernel.org > http://test.kernel.org/cgi-bin/mailman/listinfo/autotest > -- = Lucas