From patchwork Sun Aug 2 23:58:16 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Goldish X-Patchwork-Id: 38812 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n72Nswet009571 for ; Sun, 2 Aug 2009 23:54:58 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753946AbZHBXyy (ORCPT ); Sun, 2 Aug 2009 19:54:54 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753945AbZHBXyy (ORCPT ); Sun, 2 Aug 2009 19:54:54 -0400 Received: from mx2.redhat.com ([66.187.237.31]:37218 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753926AbZHBXyw (ORCPT ); Sun, 2 Aug 2009 19:54:52 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n72Ns2hv016637; Sun, 2 Aug 2009 19:54:12 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n72Nrp8n022165; Sun, 2 Aug 2009 19:53:51 -0400 Received: from localhost.localdomain (dhcp-1-188.tlv.redhat.com [10.35.1.188]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n72Nre6N017975; Sun, 2 Aug 2009 19:53:50 -0400 From: Michael Goldish To: autotest@test.kernel.org, kvm@vger.kernel.org Cc: Michael Goldish Subject: [KVM-AUTOTEST PATCH 07/12] KVM test: kvm_config.py: do not fail when including a nonexistent file Date: Mon, 3 Aug 2009 02:58:16 +0300 Message-Id: <603d8e9011205d1586b36dffead3823a2a61a745.1249257056.git.mgoldish@redhat.com> In-Reply-To: <8a2d08b846334a5eb097c2f32348d0c04a6789fb.1249257056.git.mgoldish@redhat.com> References: <1249257501-19337-1-git-send-email-mgoldish@redhat.com> <7845d2fd228ec0232af10e48dbb29e1076a265d6.1249257056.git.mgoldish@redhat.com> <9ec0626f3ca8c20d08cfd2448dbf249632ed969a.1249257056.git.mgoldish@redhat.com> <30ddf2ae0b04eb29d55dcece97fd956b75563045.1249257056.git.mgoldish@redhat.com> <3e87b54663c4483d10912231945fc37741087b8f.1249257056.git.mgoldish@redhat.com> <9d4ca96f1445db6df176825a494d6504a3bddeba.1249257056.git.mgoldish@redhat.com> <8a2d08b846334a5eb097c2f32348d0c04a6789fb.1249257056.git.mgoldish@redhat.com> In-Reply-To: <7845d2fd228ec0232af10e48dbb29e1076a265d6.1249257056.git.mgoldish@redhat.com> References: <7845d2fd228ec0232af10e48dbb29e1076a265d6.1249257056.git.mgoldish@redhat.com> X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Instead of failing, just print a warning. Included files may not always be crucial for tests to run (kvm_cdkeys.cfg for example). Signed-off-by: Michael Goldish --- client/tests/kvm/kvm_config.py | 21 +++++++++++---------- 1 files changed, 11 insertions(+), 10 deletions(-) diff --git a/client/tests/kvm/kvm_config.py b/client/tests/kvm/kvm_config.py index e478a55..7ff7a07 100755 --- a/client/tests/kvm/kvm_config.py +++ b/client/tests/kvm/kvm_config.py @@ -406,17 +406,18 @@ class config: if self.filename: filename = os.path.join(os.path.dirname(self.filename), words[1]) - if not os.path.exists(filename): - e_msg = "Cannot include %s -- file not found" % filename - raise error.AutotestError(e_msg) - new_file = open(filename, "r") - list = self.parse(new_file, list, restricted) - new_file.close() - if self.debug and not restricted: - self.__debug_print("", "Leaving file %s" % words[1]) + if os.path.exists(filename): + new_file = open(filename, "r") + list = self.parse(new_file, list, restricted) + new_file.close() + if self.debug and not restricted: + self.__debug_print("", "Leaving file %s" % words[1]) + else: + print ("WARNING: Cannot include %s -- " + "file not found" % filename) else: - e_msg = "Cannot include anything because no file is open" - raise error.AutotestError(e_msg) + print ("WARNING: Cannot include %s because no file is " + "currently open" % words[1]) # Parse multi-line exceptions # (the block is parsed for each dict separately)