Received: from eggs.gnu.org ([2001:4830:134:3::10]:48896) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYGaE-0002fT-9v for qemu-devel@nongnu.org; Sat, 05 Sep 2015 12:44:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZYGaD-00008a-HO for qemu-devel@nongnu.org; Sat, 05 Sep 2015 12:44:54 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:2365 helo=relay.sw.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYGaD-00007H-5N for qemu-devel@nongnu.org; Sat, 05 Sep 2015 12:44:53 -0400 From: Vladimir Sementsov-Ogievskiy Date: Sat, 5 Sep 2015 19:43:58 +0300 Message-Id: <1441471439-6157-17-git-send-email-vsementsov@virtuozzo.com> In-Reply-To: <1441471439-6157-1-git-send-email-vsementsov@virtuozzo.com> References: <1441471439-6157-1-git-send-email-vsementsov@virtuozzo.com> Subject: [Qemu-devel] [PATCH 16/17] iotests: add VM.test_launcn() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, vsementsov@virtuozzo.com, stefanha@redhat.com, pbonzini@redhat.com, den@openvz.org, jsnow@redhat.com Test vm can launch and print output in case of fail. This function is needed for testing erroneous cases Signed-off-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/iotests.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 85c5a99..7fb330a 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -200,6 +200,25 @@ class VM(object): os.remove(self._monitor_path) raise + def test_launch(self): + '''Launch the VM, an error is expected''' + try: + self.launch() + except: + self._popen.wait() + print "Test launch failed: %d" % self._popen.returncode + print "--- qemu output ---" + for line in open(self._qemu_log_path): + #filter qtest comments + if not "] OPENED" in line: + print line + print "--- end qemu output ---" + return False + + print "Tast launch successed!" + self.shutdown() + return True + def shutdown(self): '''Terminate the VM and clean up''' if not self._popen is None: -- 2.1.4