From: Michael Goldish Subject: [KVM-AUTOTEST PATCH 1/4] KVM test: kvm_config.py: parse extra strings passed as command line args Date: Thu, 17 Feb 2011 19:51:46 +0200 Message-ID: <1297965109-14293-1-git-send-email-mgoldish@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: autotest@test.kernel.org, kvm@vger.kernel.org Return-path: 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 This allows to quickly see the effect of some extra code, e.g. ./kvm_config.py tests.cfg "only my_set" "no qcow2" The given strings may contain newlines. Signed-off-by: Michael Goldish --- client/tests/kvm/kvm_config.py | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/client/tests/kvm/kvm_config.py b/client/tests/kvm/kvm_config.py index 807a204..cab0022 100755 --- a/client/tests/kvm/kvm_config.py +++ b/client/tests/kvm/kvm_config.py @@ -640,7 +640,9 @@ class FileReader(StrReader): if __name__ == "__main__": - parser = optparse.OptionParser("usage: %prog [options] ") + parser = optparse.OptionParser('usage: %prog [options] filename ' + '[extra code] ...\n\nExample:\n\n ' + '%prog tests.cfg "only my_set" "no qcow2"') parser.add_option("-v", "--verbose", dest="debug", action="store_true", help="include debug messages in console output") parser.add_option("-f", "--fullname", dest="fullname", action="store_true", @@ -653,6 +655,9 @@ if __name__ == "__main__": parser.error("filename required") c = Parser(args[0], debug=options.debug) + for s in args[1:]: + c.parse_string(s) + for i, d in enumerate(c.get_dicts()): if options.fullname: print "dict %4d: %s" % (i + 1, d["name"]) -- 1.7.3.4