[LNT] r195498 - Fix an error caused by a partial commit of r194516.

Chris Matthews cmatthews5 at apple.com
Fri Nov 22 12:44:21 PST 2013


Author: cmatthews
Date: Fri Nov 22 14:44:20 2013
New Revision: 195498

URL: http://llvm.org/viewvc/llvm-project?rev=195498&view=rev
Log:
Fix an error caused by a partial commit of r194516.

Modified:
    lnt/trunk/lnt/testing/util/commands.py
    lnt/trunk/lnt/tests/compile.py
    lnt/trunk/lnt/tests/nt.py

Modified: lnt/trunk/lnt/testing/util/commands.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/testing/util/commands.py?rev=195498&r1=195497&r2=195498&view=diff
==============================================================================
--- lnt/trunk/lnt/testing/util/commands.py (original)
+++ lnt/trunk/lnt/testing/util/commands.py Fri Nov 22 14:44:20 2013
@@ -94,3 +94,27 @@ def which(command, paths = None):
                 return p
 
     return None
+
+def resolve_command_path(name):
+    """Try to make the name/path given into an absolute path to an
+    executable.
+
+    """
+    # If the given name exists (or is a path), make it absolute.
+    if os.path.exists(name):
+        return os.path.abspath(name)
+
+    # Otherwise we most likely have a command name, try to look it up.
+    path = which(name)
+    if path is not None:
+        note("resolved command %r to path %r" % (name, path))
+        return path
+
+    # If that failed just return the original name.
+    return name
+
+def isexecfile(path):
+    """Does this path point to a valid executable?
+
+    """
+    return os.path.isfile(path) and os.access(path, os.X_OK)

Modified: lnt/trunk/lnt/tests/compile.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/tests/compile.py?rev=195498&r1=195497&r2=195498&view=diff
==============================================================================
--- lnt/trunk/lnt/tests/compile.py (original)
+++ lnt/trunk/lnt/tests/compile.py Fri Nov 22 14:44:20 2013
@@ -15,7 +15,7 @@ from datetime import datetime
 
 import lnt.testing
 import lnt.testing.util.compilers
-from lnt.testing.util.commands import note, warning, error, fatal
+from lnt.testing.util.commands import note, error, fatal, resolve_command_path
 from lnt.testing.util.misc import TeeStream, timestamp
 from lnt.testing.util import commands, machineinfo
 from lnt.util import stats

Modified: lnt/trunk/lnt/tests/nt.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/tests/nt.py?rev=195498&r1=195497&r2=195498&view=diff
==============================================================================
--- lnt/trunk/lnt/tests/nt.py (original)
+++ lnt/trunk/lnt/tests/nt.py Fri Nov 22 14:44:20 2013
@@ -13,7 +13,7 @@ from datetime import datetime
 import lnt.testing
 import lnt.testing.util.compilers
 
-from lnt.testing.util.commands import note, warning, error, fatal
+from lnt.testing.util.commands import note, warning, error, fatal, resolve_command_path
 from lnt.testing.util.commands import capture, mkdir_p, which
 from lnt.testing.util.rcs import get_source_version
 from lnt.testing.util.misc import timestamp
@@ -386,20 +386,6 @@ class TestConfiguration(object):
         
 ###
 
-def resolve_command_path(name):
-    # If the given name exists (or is a path), make it absolute.
-    if os.path.exists(name):
-        return os.path.abspath(name)
-
-    # Otherwise we most likely have a command name, try to look it up.
-    path = which(name)
-    if path is not None:
-        note("resolved command %r to path %r" % (name, path))
-        return path
-
-    # If that failed just return the original name.
-    return name
-
 def scan_for_test_modules(config):
     base_modules_path = os.path.join(config.test_suite_root, 'LNTBased')
     if config.only_test is None:





More information about the llvm-commits mailing list