From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:39377) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tp7IH-0007oM-8J for qemu-devel@nongnu.org; Sat, 29 Dec 2012 20:02:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tp7IG-0007R3-0S for qemu-devel@nongnu.org; Sat, 29 Dec 2012 20:02:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53995) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tp7IF-0007Qw-Nv for qemu-devel@nongnu.org; Sat, 29 Dec 2012 20:02:23 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qBU12NqT030669 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sat, 29 Dec 2012 20:02:23 -0500 From: Amos Kong Date: Sun, 30 Dec 2012 09:02:09 +0800 Message-Id: <1356829329-30082-2-git-send-email-akong@redhat.com> In-Reply-To: <1356829329-30082-1-git-send-email-akong@redhat.com> References: <1356829329-30082-1-git-send-email-akong@redhat.com> Subject: [Qemu-devel] [Autotest PATCH 2/2] virt run: add three logical case filters List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: autotest-kernel@redhat.com Cc: lmr@redhat.com, Amos Kong , qemu-devel@nongnu.org, virt-test-devel@redhat.com This patch added there options for filtering cases by logics, For example: ./run -t qemu -c tests.cfg --oronly="WinXP Win7" --andonly="boot 64" --not="sp1" (following cases will be executed) Test 1: virtio_blk.smp2.virtio_net.WinXP.64.boot Test 2: virtio_blk.smp2.virtio_net.Win7.64.boot Current '--tests' option will actually added OR case filter. I would like to reserve '--tests', because it's easy to be understood. eg: --tests="Win7 WinXP": cases of those two guests will be filtered. Signed-off-by: Amos Kong --- run | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-) diff --git a/run b/run index aac332a..da02ced 100755 --- a/run +++ b/run @@ -158,6 +158,15 @@ class VirtTestRunParser(optparse.OptionParser): general.add_option("--tests", action="store", dest="tests", help=('List of space separated tests to be executed' ' - example: --tests "boot reboot shutdown"')) + general.add_option("--and", action="store", dest="andstr", + help=('Add AND case filter' + ' - example: --and "RHEL boot"')) + general.add_option("--or", action="store", dest="orstr", + help=('Add OR case filter' + ' - example: --tests "boot shutdown"')) + general.add_option("--not", action="store", dest="nostr", + help=('Add NOT case filter' + ' - example: --not "netperf_win"')) general.add_option("--list-tests", action="store_true", dest="list", help="List tests available") general.add_option("--data-dir", action="store", dest="datadir", @@ -310,6 +319,18 @@ class VirtTestApp(object): tests = self.options.tests.split(" ") self.cartesian_parser.parse_string("only %s" % ", ".join(tests)) + if self.options.type and self.options.andstr: + for i in self.options.andstr.split(" "): + self.cartesian_parser.parse_string("only %s" % i) + + if self.options.type and self.options.orstr: + tests = self.options.orstr.split(" ") + self.cartesian_parser.parse_string("only %s" % ", ".join(tests)) + + if self.options.type and self.options.nostr: + for i in self.options.nostr.split(" "): + self.cartesian_parser.parse_string("no %s" % i) + elif (self.options.type and not self.options.tests and not self.options.config): if self.options.type == 'qemu': -- 1.7.1