]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
ftests.py: Allow for skipping of multiple tests
authorTom Hromatka <tom.hromatka@oracle.com>
Wed, 5 May 2021 15:19:17 +0000 (11:19 -0400)
committerTom Hromatka <tom.hromatka@oracle.com>
Wed, 5 May 2021 15:19:17 +0000 (11:19 -0400)
In anticipation of some tests not running nicely on some
distros, make the ftests.py --skip/-S option smarter so that
it can accept a single test or multiple tests separated by a
comma.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
ftests/config.py
ftests/ftests.py

index 55b3da04b853550bdbd2f3725c24f3510f409a0f..dd9180323f33f933097e5be76be390401923f22c 100644 (file)
@@ -28,6 +28,7 @@ import utils
 class Config(object):
     def __init__(self, args, container=None):
         self.args = args
+        self.skip_list = []
 
         if self.args.container:
             if container:
index 13127611a6c2f56c44129d579ec6162db6cda163..31185e6c398a4a2c75f13e1aad8f55437cdffef9 100755 (executable)
@@ -66,8 +66,9 @@ def parse_args():
                         help='Test number to run.  If unspecified, all tests are run',
                         required=False, default=consts.TESTS_RUN_ALL, type=int)
     parser.add_argument('-S', '--skip',
-                        help='Test number to skip.  If unspecified, all tests are run',
-                        required=False, default=consts.TESTS_RUN_ALL, type=int)
+                        help='Test number(s) to skip.  If unspecified, all tests are run.'
+                        'To skip multiple tests, separate them via a \',\', e.g. \'5,7,12\'',
+                        required=False, default='', type=str)
     parser.add_argument('-s', '--suite',
                         help='Test suite to run, e.g. cpuset', required=False,
                         default=consts.TESTS_RUN_ALL_SUITES, type=str)
@@ -89,6 +90,15 @@ def parse_args():
 
     config = Config(parser.parse_args())
 
+    if config.args.skip is None or config.args.skip == '':
+        pass
+    elif config.args.skip.find(',') < 0:
+        config.skip_list.append(int(config.args.skip))
+    else:
+        # multiple tests are being skipped
+        for test_num in config.args.skip.split(','):
+            config.skip_list.append(int(test_num))
+
     if config.args.loglevel:
         log.log_level = config.args.loglevel
     if config.args.logfile:
@@ -211,7 +221,7 @@ def run_tests(config):
                 if config.args.num == consts.TESTS_RUN_ALL or \
                    config.args.num == filenum_int:
 
-                    if config.args.skip == filenum_int:
+                    if filenum_int in config.skip_list:
                         continue
 
                     test = __import__(os.path.splitext(filename)[0])