From: Jason Ish Date: Wed, 24 Jan 2018 22:49:33 +0000 (-0600) Subject: requires: allow require to be a script that returns true X-Git-Tag: suricata-6.0.4~510 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=255a40d774ab6b7ceee12c000653a82fae9db592;p=thirdparty%2Fsuricata-verify.git requires: allow require to be a script that returns true --- diff --git a/run.py b/run.py index 52728c23a..662b9ea1b 100755 --- a/run.py +++ b/run.py @@ -134,7 +134,10 @@ def find_value(name, obj): obj = obj[name] if index is not None: - obj = obj[int(index)] + try: + obj = obj[int(index)] + except: + return None return obj @@ -293,6 +296,14 @@ class TestRunner: raise UnsatisfiedRequirementError( "requires file %s" % (filename)) + if "script" in requires: + for script in requires["script"]: + try: + subprocess.check_call("%s" % script, shell=True) + except: + raise UnsatisfiedRequirementError( + "requires script returned false") + # Check if a pcap is required or not. By default a pcap is # required unless a "command" has been provided. if not "command" in self.config: