From patchwork Mon Sep 5 18:54:53 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: 1125352 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p85It9C2022084 for ; Mon, 5 Sep 2011 18:55:09 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752101Ab1IESzH (ORCPT ); Mon, 5 Sep 2011 14:55:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:26830 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751801Ab1IESzF (ORCPT ); Mon, 5 Sep 2011 14:55:05 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p85It4NU004736 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 5 Sep 2011 14:55:04 -0400 Received: from freedom.local.com (vpn-11-168.rdu.redhat.com [10.11.11.168]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p85It2Hg013055; Mon, 5 Sep 2011 14:55:03 -0400 From: Lucas Meneghel Rodrigues To: autotest@test.kernel.org Cc: kvm@vger.kernel.org, Lucas Meneghel Rodrigues Subject: [PATCH] KVM test: get_started.py: Create from all sample files found Date: Mon, 5 Sep 2011 15:54:53 -0300 Message-Id: <1315248893-12451-1-git-send-email-lmr@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 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]); Mon, 05 Sep 2011 18:55:09 +0000 (UTC) Rather than keeping a list of sample files on the kvm test dir, just glob for them and create the actual config files as needed. This way we won't have to modify the program every time a new config file gets added. Signed-off-by: Lucas Meneghel Rodrigues --- client/tests/kvm/get_started.py | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-) diff --git a/client/tests/kvm/get_started.py b/client/tests/kvm/get_started.py index d97fd8a..1a65613 100755 --- a/client/tests/kvm/get_started.py +++ b/client/tests/kvm/get_started.py @@ -5,7 +5,7 @@ Program to help setup kvm test environment @copyright: Red Hat 2010 """ -import os, sys, logging, shutil +import os, sys, logging, shutil, glob import common from autotest_lib.client.common_lib import logging_manager from autotest_lib.client.bin import utils @@ -85,11 +85,10 @@ if __name__ == "__main__": "config samples to actual config files)") kvm_test_dir = os.path.dirname(sys.modules[__name__].__file__) kvm_test_dir = os.path.abspath(kvm_test_dir) - config_file_list = ["build.cfg", "cdkeys.cfg", "tests_base.cfg", - "tests.cfg", "unittests.cfg", "virtio-win.cfg"] + config_file_list = glob.glob(os.path.join(kvm_test_dir, "*.cfg.sample")) for config_file in config_file_list: - src_file = os.path.join(kvm_test_dir, "%s.sample" % config_file) - dst_file = os.path.join(kvm_test_dir, config_file) + src_file = config_file + dst_file = src_file.rstrip(".sample") if not os.path.isfile(dst_file): logging.debug("Creating config file %s from sample", dst_file) shutil.copyfile(src_file, dst_file)