]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
Fix output in cmdline file for specified command 119/head
authorShivani Bhardwaj <shivanib134@gmail.com>
Thu, 5 Sep 2019 11:43:17 +0000 (17:13 +0530)
committerShivani Bhardwaj <shivanib134@gmail.com>
Thu, 5 Sep 2019 11:48:55 +0000 (17:18 +0530)
So far if a command was specified in test.yaml, it showed up unusable in
cmdline file. Fix it with appropriate environment handling.

run.py

diff --git a/run.py b/run.py
index 334ef4b24e3d5fdf7ed67288a0aeb90acc8a5dd2..976e9dc5f2e08d2c28e336d0d7ecca5cd2015fdd 100755 (executable)
--- a/run.py
+++ b/run.py
@@ -30,6 +30,7 @@ import os.path
 import subprocess
 import threading
 import shutil
+import string
 import argparse
 import yaml
 import glob
@@ -553,8 +554,13 @@ class TestRunner:
             stdout = open(os.path.join(self.output, "stdout"), "w")
             stderr = open(os.path.join(self.output, "stderr"), "w")
 
-            open(os.path.join(self.output, "cmdline"), "w").write(
-                " ".join(args) + "\n")
+            if shell:
+                template = string.Template(args)
+                cmdline = template.substitute(env)
+            else:
+                cmdline = " ".join(args) + "\n"
+
+            open(os.path.join(self.output, "cmdline"), "w").write(cmdline)
 
             p = subprocess.Popen(
                 args, shell=shell, cwd=self.directory, env=env,