From patchwork Wed Mar 9 09:21:09 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Meneghel Rodrigues X-Patchwork-Id: 620961 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p299Lqlu007971 for ; Wed, 9 Mar 2011 09:21:52 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756981Ab1CIJVs (ORCPT ); Wed, 9 Mar 2011 04:21:48 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53382 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757024Ab1CIJVr (ORCPT ); Wed, 9 Mar 2011 04:21:47 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p299LjZB019763 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 9 Mar 2011 04:21:46 -0500 Received: from freedom.redhat.com (vpn-8-153.rdu.redhat.com [10.11.8.153]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p299LDHx025539; Wed, 9 Mar 2011 04:21:44 -0500 From: Lucas Meneghel Rodrigues To: autotest@test.kernel.org Cc: kvm@vger.kernel.org, mgoldish@redhat.com, crosa@redhat.com, Lucas Meneghel Rodrigues Subject: [PATCH 6/7] KVM test: Try to load subtests on a shared tests location Date: Wed, 9 Mar 2011 06:21:09 -0300 Message-Id: <1299662470-3017-7-git-send-email-lmr@redhat.com> In-Reply-To: <1299662470-3017-1-git-send-email-lmr@redhat.com> References: <1299662470-3017-1-git-send-email-lmr@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 09 Mar 2011 09:21:52 +0000 (UTC) diff --git a/client/tests/kvm/kvm.py b/client/tests/kvm/kvm.py index 6981b1b..54535ae 100644 --- a/client/tests/kvm/kvm.py +++ b/client/tests/kvm/kvm.py @@ -54,11 +54,19 @@ class kvm(test.test): # test type t_type = params.get("type") # Verify if we have the correspondent source file for it - subtest_dir = os.path.join(self.bindir, "tests") - module_path = os.path.join(subtest_dir, "%s.py" % t_type) - if not os.path.isfile(module_path): - raise error.TestError("No %s.py test file found" % - t_type) + virt_dir = os.path.dirname(virt_utils.__file__) + subtest_dir_virt = os.path.join(virt_dir, "tests") + subtest_dir_kvm = os.path.join(self.bindir, "tests") + subtest_dir = None + for d in [subtest_dir_virt, subtest_dir_kvm]: + module_path = os.path.join(d, "%s.py" % t_type) + if os.path.isfile(module_path): + subtest_dir = d + break + if subtest_dir is None: + raise error.TestError("Could not find test file %s.py " + "on either %s or %s directory" % + subtest_dir_virt, subtest_dir_kvm) # Load the test module f, p, d = imp.find_module(t_type, [subtest_dir]) test_module = imp.load_module(t_type, f, p, d)