From eb7ee8d26b3b29ee984b48589718728735be3deb Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Sat, 13 Jan 2018 18:41:52 +0100 Subject: [PATCH] runner: allow tests to be loaded from external dir Add --dir option to specify a external directory for loading and running tests. This allows external test repositories for tests that are private or too large to be part of the repo. --- run.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/run.py b/run.py index b46a415bc..7dc796f2c 100755 --- a/run.py +++ b/run.py @@ -441,6 +441,8 @@ def main(): help="Force running of skipped tests") parser.add_argument("--fail", action="store_true", help="Exit on test failure") + parser.add_argument("--dir", action="store", + help="Runs tests from custom directory") parser.add_argument("patterns", nargs="*", default=[]) args = parser.parse_args() @@ -462,11 +464,17 @@ def main(): # Create a SuricataConfig object that is passed to all tests. suricata_config = SuricataConfig(get_suricata_version()) - for dirpath, dirnames, filenames in os.walk(os.path.join(topdir, "tests")): + tdir = os.path.join(topdir, "tests") + if args.dir: + tdir = os.path.abspath(args.dir) + + for dirpath, dirnames, filenames in os.walk(tdir): # The top directory is not a test... if dirpath == os.path.join(topdir, "tests"): continue + if dirpath == tdir: + continue # We only want to go one level deep. dirnames[0:] = [] -- 2.47.2