From 6083f946eb80b2c48a84f9f91e1320e0cc5e9c89 Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Fri, 17 Jan 2020 16:20:31 +0100 Subject: [PATCH 1/3] Allow passing of colon separated checkpaths * Deprecate using the checkpath command line option multiple times and issue a warning. * Create unittest for colon separated paths. * Add the change to the documentation. --- docs/running.rst | 13 ++++++++++++- reframe/frontend/cli.py | 8 ++++++-- unittests/test_cli.py | 9 +++++++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/docs/running.rst b/docs/running.rst index 448134e894..ccabd4ecdd 100644 --- a/docs/running.rst +++ b/docs/running.rst @@ -306,7 +306,7 @@ ReFrame the does not search recursively into directories specified with the ``-c The ``-c`` option completely overrides the default path. Currently, there is no option to prepend or append to the default regression path. -However, you can build your own check path by specifying multiple times the ``-c`` option. +However, you can build your own check path by specifying multiple colon separate paths to the ``-c`` option. The ``-c``\ option accepts also regular files. This is very useful when you are implementing new regression tests, since it allows you to run only your test: .. code-block:: bash @@ -321,6 +321,17 @@ The ``-c``\ option accepts also regular files. This is very useful when you are .. versionadded:: 2.12 +.. note:: + Using the command line ``-c`` or ``--checkpath`` multiple times is now deprecated and only the last option is going to be taken into account. + Multiple paths should be passed as a colon separated string to the above option: + + .. code-block:: bash + + ./bin/reframe -c /path/to/my/first/test.py:/path/to/my/second/test.py -r + + + .. versionchanged:: 2.22 + Filtering of Regression Tests ----------------------------- diff --git a/reframe/frontend/cli.py b/reframe/frontend/cli.py index c0ed56e9f4..e4471d0d83 100644 --- a/reframe/frontend/cli.py +++ b/reframe/frontend/cli.py @@ -94,7 +94,7 @@ def main(): # Check discovery options locate_options.add_argument( '-c', '--checkpath', action='append', metavar='DIR|FILE', - help='Search for checks in DIR or FILE') + help="Search for checks in DIR or FILE, using `:' for multiple paths") locate_options.add_argument( '-R', '--recursive', action='store_true', help='Load checks recursively') @@ -410,7 +410,11 @@ def main(): # Setup the check loader if options.checkpath: load_path = [] - for d in options.checkpath: + if len(options.checkpath) > 1: + printer.warning("using command line option `--checkpath' " + "multiple times is deprecated, please use " + "`:' for multiple paths") + for d in options.checkpath[-1].split(':'): d = os_ext.expandvars(d) if not os.path.exists(d): printer.warning("%s: path `%s' does not exist. Skipping..." % diff --git a/unittests/test_cli.py b/unittests/test_cli.py index 65ad756883..f8949d76bf 100644 --- a/unittests/test_cli.py +++ b/unittests/test_cli.py @@ -272,6 +272,15 @@ def test_sanity_of_optconfig(self): returncode, *_ = self._run_reframe() self.assertEqual(0, returncode) + def test_checkpath_colon_separated(self): + self.action = 'list' + self.checkpath = ['unittests/resources/checks/hellocheck_make.py:' + 'unittests/resources/checks/hellocheck.py'] + returncode, stdout, _ = self._run_reframe() + num_checks = re.search( + r'Found (\d+) check', stdout, re.MULTILINE).group(1) + self.assertEqual(num_checks, '2') + def test_checkpath_recursion(self): self.action = 'list' self.checkpath = [] From e86521cadfc7c5519357712817f85ba9ebb3db66 Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Fri, 24 Jan 2020 13:42:24 +0100 Subject: [PATCH 2/3] Address PR comments --- docs/running.rst | 10 +++++----- reframe/frontend/cli.py | 11 ++++------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/docs/running.rst b/docs/running.rst index ccabd4ecdd..d7dce8e61b 100644 --- a/docs/running.rst +++ b/docs/running.rst @@ -306,7 +306,7 @@ ReFrame the does not search recursively into directories specified with the ``-c The ``-c`` option completely overrides the default path. Currently, there is no option to prepend or append to the default regression path. -However, you can build your own check path by specifying multiple colon separate paths to the ``-c`` option. +However, you can build your own check path by specifying a colon separated list of paths to the ``-c`` option. The ``-c``\ option accepts also regular files. This is very useful when you are implementing new regression tests, since it allows you to run only your test: .. code-block:: bash @@ -321,16 +321,16 @@ The ``-c``\ option accepts also regular files. This is very useful when you are .. versionadded:: 2.12 -.. note:: - Using the command line ``-c`` or ``--checkpath`` multiple times is now deprecated and only the last option is going to be taken into account. +.. warning:: + Using the command line ``-c`` or ``--checkpath`` multiple times is not supported anymore and only the last option will be considered. Multiple paths should be passed as a colon separated string to the above option: .. code-block:: bash - ./bin/reframe -c /path/to/my/first/test.py:/path/to/my/second/test.py -r + ./bin/reframe -c /path/to/my/first/test.py:/path/to/my/second/ -r - .. versionchanged:: 2.22 + .. versionchanged:: 3.0 Filtering of Regression Tests diff --git a/reframe/frontend/cli.py b/reframe/frontend/cli.py index e4471d0d83..74c8f71c7a 100644 --- a/reframe/frontend/cli.py +++ b/reframe/frontend/cli.py @@ -93,8 +93,9 @@ def main(): # Check discovery options locate_options.add_argument( - '-c', '--checkpath', action='append', metavar='DIR|FILE', - help="Search for checks in DIR or FILE, using `:' for multiple paths") + '-c', '--checkpath', action='store', metavar='DIR|FILE', + help="Search for checks in DIR or FILE; multiple paths can be " + "separated with `:'") locate_options.add_argument( '-R', '--recursive', action='store_true', help='Load checks recursively') @@ -410,11 +411,7 @@ def main(): # Setup the check loader if options.checkpath: load_path = [] - if len(options.checkpath) > 1: - printer.warning("using command line option `--checkpath' " - "multiple times is deprecated, please use " - "`:' for multiple paths") - for d in options.checkpath[-1].split(':'): + for d in options.checkpath.split(':'): d = os_ext.expandvars(d) if not os.path.exists(d): printer.warning("%s: path `%s' does not exist. Skipping..." % From c28393ef7e0474b4150de5d480887f987c86c998 Mon Sep 17 00:00:00 2001 From: Vasileios Karakasis Date: Fri, 24 Jan 2020 18:16:59 +0100 Subject: [PATCH 3/3] Rephrase sentence in documentation --- docs/running.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/running.rst b/docs/running.rst index d7dce8e61b..9497e1bbdd 100644 --- a/docs/running.rst +++ b/docs/running.rst @@ -323,7 +323,7 @@ The ``-c``\ option accepts also regular files. This is very useful when you are .. warning:: Using the command line ``-c`` or ``--checkpath`` multiple times is not supported anymore and only the last option will be considered. - Multiple paths should be passed as a colon separated string to the above option: + Multiple paths should be passed instead as a colon separated list: .. code-block:: bash