]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
runner: allow tests to be loaded from external dir
authorVictor Julien <victor@inliniac.net>
Sat, 13 Jan 2018 17:41:52 +0000 (18:41 +0100)
committerJason Ish <ish@unx.ca>
Tue, 16 Jan 2018 01:20:24 +0000 (19:20 -0600)
Add --dir <directory> 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

diff --git a/run.py b/run.py
index b46a415bca275e3452fd6bb544e1b995d8023152..7dc796f2c075203be82fe36d2daa68090920729e 100755 (executable)
--- 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:] = []