[PATCH] D42712: [utils] Add utils/update_cc_test_checks.py

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 28 20:16:18 PDT 2019


MaskRay marked an inline comment as done.
MaskRay added inline comments.


================
Comment at: llvm/trunk/utils/update_cc_test_checks.py:100
+    print('Please specify --llvm-bin or --clang', file=sys.stderr)
+    sys.exit(1)
+  if args.c_index_test is None:
----------------
vsk wrote:
> Just a heads-up: find_executable doesn't seem to do the right thing here when clang is found within 'llvm_bin'. It rejects the full path to clang as it isn't technically in PATH.
I think `find_executable` works as intended.

```
def find_executable(executable, path=None):
    ...
    if path is None:
        path = os.environ['PATH']

    paths = path.split(os.pathsep)
    base, ext = os.path.splitext(executable)

    if (sys.platform == 'win32') and (ext != '.exe'):
        executable = executable + '.exe'

    if not os.path.isfile(executable):
        for p in paths:
            f = os.path.join(p, executable)
            if os.path.isfile(f):
                # the file exists, we have a shot at spawn working
                return f
        return None
    else:
        return executable # if --clang is specified and is an absolute path to a regular file (or a symlink which can be resolved to a regular file)
```


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D42712/new/

https://reviews.llvm.org/D42712





More information about the llvm-commits mailing list