[Libvirt-cim] [PATCH 2 of 2] [TEST] Add --test_subset option for specifying a bulk run of a subset of dirs

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Wed Nov 18 21:46:54 UTC 2009


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1258580377 28800
# Node ID 95cc631fc4581c9705ae93088688e1d3af28c55a
# Parent  dfe044c37ec5b9f87db1a377743d9b928180018c
[TEST] Add --test_subset option for specifying a bulk run of a subset of dirs

You can use this option in the following ways:

  CIM_NS=root/virt CIM_USER=root CIM_PASS=pass ./runtests libvirt-cim -i localhost -c -d -v KVM --test_subset [LogicalDisk:RASD]
	-this will run all tests in the LogicalDisk, Memory, NetworkPort,
         Processor, Profile, and RASD directories

  CIM_NS=root/virt CIM_USER=root CIM_PASS=pass ./runtests libvirt-cim -i localhost -c -d -v KVM --test_subset [LogicalDisk,RASD,Memory]
	-this will run all tests in the LogicalDisk, RASD, and Memory dirs

Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>

diff -r dfe044c37ec5 -r 95cc631fc458 suites/libvirt-cim/main.py
--- a/suites/libvirt-cim/main.py	Wed Nov 18 13:39:37 2009 -0800
+++ b/suites/libvirt-cim/main.py	Wed Nov 18 13:39:37 2009 -0800
@@ -68,6 +68,8 @@
 parser.add_option("--print-exec-time", action="store_true", 
                   dest="print_exec_time",
                   help="Print execution time of each test")
+parser.add_option("--test_subset", dest="test_subset",
+                  help="Only run specified dirs [dir,dir,...] or [dir:dir]")
 
 TEST_SUITE = 'cimtest'
 CIMTEST_RCFILE = '%s/.cimtestrc' % os.environ['HOME']
@@ -185,6 +187,11 @@
         parser.print_help()
         return 1
 
+    if options.group and options.test_subset:
+        print "\nPlease specify either a test group or a subset of tests.\n"
+        parser.print_help()
+        return 1
+
     env_ready = pre_check(options.ip, options.virt)
     if env_ready != None: 
         print "\n%s.  Please check your environment.\n" % env_ready
@@ -214,17 +221,27 @@
    
     set_python_path()
 
-    if options.group and options.test:
-        test_list = groups.get_one_test(TEST_SUITE, options.group, options.test)
-    elif options.group and not options.test:
-        test_list = groups.get_group_test_list(TEST_SUITE, options.group)
+    if options.group:
+        if options.test:
+            test_list = groups.get_one_test(TEST_SUITE, options.group, 
+                                            options.test)
+        else:
+            test_list = groups.get_group_test_list(TEST_SUITE, options.group)
+
+        if not test_list:
+            print "Test %s:%s not found" % (options.group, options.test)
+            return 1
+
+    elif options.test_subset:
+        test_list = groups.get_subset_test_list(TEST_SUITE, options.test_subset)
+
+        if not test_list:
+            print "Test subset not found: %s" % (options.test_subset)
+            return 1
+
     else:
         test_list = groups.list_all_tests(TEST_SUITE)
 
-    if not test_list:
-        print "Test %s:%s not found" % (options.group, options.test)
-        return 1
-
     if options.clean:
         remove_old_logs(options.group)
 




More information about the Libvirt-cim mailing list