]> granicus.if.org Git - graphviz/commitdiff
fix handling of KFLAGS and TFLAGS in rtest
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 24 Oct 2020 19:32:12 +0000 (12:32 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 31 Oct 2020 02:15:43 +0000 (19:15 -0700)
This was potentially appending empty strings to the command passed to
subprocess.

rtest/rtest.py

index 1584fc211e1f3e1608015a505abcf594c906511a..c44cdc3339c76b65e2d2fda6a92dab2b433e70e6 100755 (executable)
@@ -222,9 +222,12 @@ def doTest(TEST):
     OUTPATH = os.path.join(OUTDIR, OUTFILE)
     KFLAGS = SUBTEST['ALG']
     TFLAGS = SUBTEST['FMT']
-    KFLAGS = KFLAGS and '-K' + KFLAGS
-    TFLAGS = TFLAGS and '-T' + TFLAGS
-    testcmd = [DOT, KFLAGS, TFLAGS] + SUBTEST['FLAGS'] + ['-o', OUTPATH, INFILE]
+    if KFLAGS: KFLAGS = '-K{}'.format(KFLAGS)
+    if TFLAGS: TFLAGS = '-T{}'.format(TFLAGS)
+    testcmd = [DOT]
+    if KFLAGS: testcmd += [KFLAGS]
+    if TFLAGS: testcmd += [TFLAGS]
+    testcmd += SUBTEST['FLAGS'] + ['-o', OUTPATH, INFILE]
     if VERBOSE:
       print(' '.join(testcmd))
     if NOOP: