]> xenbits.xensource.com Git - people/liuw/xtf.git/commitdiff
mkinfo: Fix JSON damage from splitting an empty string
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 2 Aug 2016 18:08:43 +0000 (19:08 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 2 Aug 2016 18:08:43 +0000 (19:08 +0100)
In python, splitting an empty string results in a single-entry list containing
an empty string.  This causes the variations list to be wrong when no
variations are in use.

It is only by chance that doesn't cause an issue for ./xtf-runner

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
build/mkinfo.py

index 02567e518f71009ed1158afdd9e3f704968df39a..94891a9bd96f5576f065b05e4eb75d3517a93773 100644 (file)
@@ -9,10 +9,15 @@ _, out, name, cat, envs, variations = sys.argv
 template = {
     "name": name,
     "category": cat,
-    "environments": envs.split(" "),
-    "variations": variations.split(" "),
+    "environments": [],
+    "variations": [],
     }
 
+if envs:
+    template["environments"] = envs.split(" ")
+if variations:
+    template["variations"] = variations.split(" ")
+
 open(out, "w").write(
     json.dumps(template, indent=4, separators=(',', ': '))
     + "\n"