]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
run.py: add option to check for os
authorShivani Bhardwaj <shivanib134@gmail.com>
Tue, 11 Jun 2024 10:08:21 +0000 (15:38 +0530)
committerVictor Julien <victor@inliniac.net>
Thu, 4 Jul 2024 04:37:22 +0000 (06:37 +0200)
README.md
run.py

index 9760eb9e9954ba37af549bd17221c860198a3045..20ddb609ec4aba293f02a0eb8346ed011284b452 100644 (file)
--- a/README.md
+++ b/README.md
@@ -55,6 +55,10 @@ requires:
   # release, but 4.0.3 would only match 4.0.3.
   version: 4.0
 
+  # Test is only for the listed OS. For example, the following would make
+  # a test run only on Linux.
+  os: linux
+
   # Require the presence of specific features.
   features:
     # Restrict the test to builds with HAVE_LUA.
diff --git a/run.py b/run.py
index 6b45f10fc0106e265c5dcc1d028d8f3115b90e17..b9a3f1c9929bc0add42fea6d553cb9aa05cef710 100755 (executable)
--- a/run.py
+++ b/run.py
@@ -44,6 +44,7 @@ import filecmp
 import subprocess
 import yaml
 import traceback
+import platform
 
 VALIDATE_EVE = False
 WIN32 = sys.platform == "win32"
@@ -368,6 +369,10 @@ def check_requires(requires, suricata_config: SuricataConfig):
         elif key == "lambda":
             if not eval(requires["lambda"]):
                 raise UnsatisfiedRequirementError(requires["lambda"])
+        elif key == "os":
+            cur_platform = platform.system().lower()
+            if not cur_platform.startswith(requires["os"].lower()):
+                raise UnsatisfiedRequirementError(requires["os"])
         else:
             raise Exception("unknown requires types: %s" % (key))