<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div apple-content-edited="true"><div style="orphans: auto; text-align: start; text-indent: 0px; widows: auto; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div style="orphans: auto; text-align: start; text-indent: 0px; widows: auto; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div style="orphans: auto; text-align: start; text-indent: 0px; widows: auto; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div style="orphans: auto; text-align: start; text-indent: 0px; widows: auto; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">When you specified something odd for --cc you'd get a really cryptic "Permission Denied" error when we go to check the compiler version. Do better checking on the --cc executable first, and error if it is not 1) executable and 2) a file. Also, make the compile test function use the same compiler resolution procedure, including this error.</div><div style="orphans: auto; text-align: start; text-indent: 0px; widows: auto; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br></div><div style="orphans: auto; text-align: start; text-indent: 0px; widows: auto; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">diff --git a/lnt/testing/util/compilers.py b/lnt/testing/util/compilers.py<br>index 6b8f0348c7b21865c576374c38d2d4b13c1b51ec..ffdd061edbf5add2fd7c119c78bb1fb76b6b7df2 100644<br>--- a/lnt/testing/util/compilers.py<br>+++ b/lnt/testing/util/compilers.py<br>@@ -13,6 +13,12 @@ def ishexhash(string):<br>              for c in string<br>              if c.isdigit() or c in 'abcdef']) == 40<br> <br>+<br>+def is_valid(path):<br>+    """Does this path point to a valid executable?"""<br>+    return os.path.isfile(path) and os.access(path, os.X_OK)<br>+<br>+<br> def get_cc_info(path, cc_flags=[]):<br>     """get_cc_info(path) -> { ... }<br> <br>diff --git a/lnt/tests/common.py b/lnt/tests/common.py<br>new file mode 100644<br>index 0000000000000000000000000000000000000000..23a6b11bfb40b645e1ccd2a834c796bdd409483c<br>--- /dev/null<br>+++ b/lnt/tests/common.py<br>@@ -0,0 +1,24 @@<br>+"""Some functions which are common to test suites."""<br>+import os<br>+from lnt.testing.util.commands import capture, mkdir_p<br>+<br>+<br>+def resolve_command_path(name):<br>+    """Try to make the name/path given into an absolute path to an<br>+    executable.<br>+<br>+    """<br>+    # If the given name exists (or is a path), make it absolute.<br>+    if os.path.exists(name):<br>+        return os.path.abspath(name)<br>+<br>+    # Otherwise we most likely have a command name, try to look it up.<br>+    path = which(name)<br>+    if path is not None:<br>+        note("resolved command %r to path %r" % (name, path))<br>+        return path<br>+<br>+    # If that failed just return the original name.<br>+    return name<br>+<br>+<br>diff --git a/lnt/tests/compile.py b/lnt/tests/compile.py<br>index 77a235da7fcfb55b558ef246ef71acf5d1531d94..eaa4f9bea34fc986d3875a70fe6eaac34f27ba32 100644<br>--- a/lnt/tests/compile.py<br>+++ b/lnt/tests/compile.py<br>@@ -19,6 +19,7 @@ from lnt.testing.util.commands import note, warning, error, fatal<br> from lnt.testing.util.misc import TeeStream, timestamp<br> from lnt.testing.util import commands, machineinfo<br> from lnt.util import stats<br>+from lnt.tests.common import resolve_command_path<br> <br> def args_to_quoted_string(args):<br>     def quote_arg(arg):<br>@@ -750,6 +751,13 @@ class CompileTest(builtintest.BuiltinTest):<br>         if len(args) != 0:<br>             parser.error("invalid number of arguments")<br> <br>+        # Resolve the cc_under_test path.<br>+        <a href="http://opts.cc">opts.cc</a> = resolve_command_path(<a href="http://opts.cc">opts.cc</a>)<br>+<br>+        if not lnt.testing.util.compilers.is_valid(<a href="http://opts.cc">opts.cc</a>):<br>+            parser.error('--cc does not point to a valid executable.')<br>+<br>+<br>         # Attempt to infer the cxx compiler if not given.<br>         if <a href="http://opts.cc">opts.cc</a> and opts.cxx is None:<br>             opts.cxx = lnt.testing.util.compilers.infer_cxx_compiler(<a href="http://opts.cc">opts.cc</a>)<br>diff --git a/lnt/tests/nt.py b/lnt/tests/nt.py<br>index cefb38c42c7c05cc24df76bc263e93cb50b7b09b..fd274e19bb22b27d2e535b2e7653e6ac0069823b 100644<br>--- a/lnt/tests/nt.py<br>+++ b/lnt/tests/nt.py<br>@@ -14,8 +14,9 @@ from datetime import datetime<br> import lnt.testing<br> import lnt.testing.util.compilers<br> <br>+from lnt.tests.common import resolve_command_path<br> from lnt.testing.util.commands import note, warning, error, fatal<br>-from lnt.testing.util.commands import capture, mkdir_p, which<br>+from lnt.testing.util.commands import capture, mkdir_p<br> from lnt.testing.util.rcs import get_source_version<br> from lnt.testing.util.misc import timestamp<br> <br>@@ -387,20 +388,6 @@ class TestConfiguration(object):<br>         <br> ###<br> <br>-def resolve_command_path(name):<br>-    # If the given name exists (or is a path), make it absolute.<br>-    if os.path.exists(name):<br>-        return os.path.abspath(name)<br>-<br>-    # Otherwise we most likely have a command name, try to look it up.<br>-    path = which(name)<br>-    if path is not None:<br>-        note("resolved command %r to path %r" % (name, path))<br>-        return path<br>-<br>-    # If that failed just return the original name.<br>-    return name<br>-<br> def scan_for_test_modules(config):<br>     base_modules_path = os.path.join(config.test_suite_root, 'LNTBased')<br>     if config.only_test is None:<br>@@ -1339,6 +1326,9 @@ class NTTest(builtintest.BuiltinTest):<br>         # Resolve the cc_under_test path.<br>         <a href="http://opts.cc">opts.cc</a>_under_test = resolve_command_path(<a href="http://opts.cc">opts.cc</a>_under_test)<br> <br>+        if not lnt.testing.util.compilers.is_valid(<a href="http://opts.cc">opts.cc</a>_under_test):<br>+            parser.error('--cc does not point to a valid executable.')<br>+<br>         # If there was no --cxx given, attempt to infer it from the --cc.<br>         if opts.cxx_under_test is None:<br>             opts.cxx_under_test = lnt.testing.util.compilers.infer_cxx_compiler(<br><br></div><div style="orphans: auto; text-align: start; text-indent: 0px; widows: auto; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"></div></div></div></div></div></body></html>