]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
test.yaml: allow a test to be skipped if running as a specific uid
authorJason Ish <ish@unx.ca>
Thu, 18 Jan 2018 16:08:55 +0000 (10:08 -0600)
committerJason Ish <ish@unx.ca>
Thu, 18 Jan 2018 16:08:55 +0000 (10:08 -0600)
run.py

diff --git a/run.py b/run.py
index 6b75897a5387b7d990a145a75b8af784e7b9b397..2b8afafa469aeb06ec3813ebe1edd9c26589ba45 100755 (executable)
--- a/run.py
+++ b/run.py
@@ -239,6 +239,18 @@ class TestRunner:
                             shell=True,
                             cwd=self.directory)
 
+    def check_skip(self):
+        if not "skip" in self.config:
+            return
+        for skip in self.config["skip"]:
+            if "uid" in skip:
+                if os.getuid() == skip["uid"]:
+                    if "msg" in skip:
+                        msg = skip["msg"]
+                    else:
+                        msg = "not for uid %d" % (skip["uid"])
+                    raise UnsatisfiedRequirementError(msg)
+
     def check_requires(self):
         if "requires" in self.config:
             requires = self.config["requires"]
@@ -298,6 +310,7 @@ class TestRunner:
         sys.stdout.flush()
 
         self.check_requires()
+        self.check_skip()
 
         shell = False