From: Jason Ish Date: Wed, 14 Jun 2023 17:49:47 +0000 (-0700) Subject: run.py: allow python lambda expression for requires X-Git-Tag: suricata-6.0.13~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c6ded9ec0bb5e25c332f4416f37e41b6379fbe86;p=thirdparty%2Fsuricata-verify.git run.py: allow python lambda expression for requires Add a new require type, "lambda" which will require the Python lambda expression to return a truthy value. --- diff --git a/README.md b/README.md index 674e4803b..be5b2afa6 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,10 @@ requires: - command2 - ... + # Require the output of a Python expression to be true. For example, + # this will run on all platforms other than win32. + lambda: "sys.platform != win32" + skip: # Skip a test if a feature is present, with a message that is logged. - feature: RUST diff --git a/run.py b/run.py index af79c1360..8e2f1acee 100755 --- a/run.py +++ b/run.py @@ -365,6 +365,9 @@ def check_requires(requires, suricata_config: SuricataConfig): elif key == "pcap": # A valid requires argument, but not verified here. pass + elif key == "lambda": + if not eval(requires["lambda"]): + raise UnsatisfiedRequirementError(requires["lambda"]) else: raise Exception("unknown requires types: %s" % (key))