selftesthelpers: Cope with empty binary mappings list, simplify handling of perl.
authorJelmer Vernooij <jelmer@samba.org>
Sun, 13 Nov 2011 20:51:53 +0000 (21:51 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Mon, 14 Nov 2011 14:49:36 +0000 (15:49 +0100)
selftest/selftesthelpers.py

index c2f434896fc88db412cd8afbf409bdd19ba98438..f4b032198be947bcd28ceee6c158fa15db83b516 100644 (file)
@@ -40,13 +40,15 @@ def binpath(name):
 binary_mapping_string = os.getenv("BINARY_MAPPING", None)
 if binary_mapping_string is not None:
     for binmapping_entry in binary_mapping_string.split(','):
-        binmapping = binmapping_entry.split(':')
-        binary_mapping[binmapping[0]] = binmapping[1]
+        try:
+            (from_path, to_path) = binmapping_entry.split(':', 1)
+        except ValueError:
+            continue
+        binary_mapping[from_path] = to_path
 
 perl = os.getenv("PERL", "perl")
-perl = perl.split()
 
-if subprocess.call(perl + ["-e", "eval require Test::More;"]) == 0:
+if subprocess.call([perl, "-e", "eval require Test::More;"]) == 0:
     has_perl_test_more = True
 else:
     has_perl_test_more = False
@@ -157,7 +159,7 @@ def planperltestsuite(name, path):
     :param path: Path to the test runner
     """
     if has_perl_test_more:
-        plantestsuite(name, "none", "%s %s | %s" % (" ".join(perl), path, tap2subunit))
+        plantestsuite(name, "none", "%s %s | %s" % (perl, path, tap2subunit))
     else:
         skiptestsuite(name, "Test::More not available")